zoukankan      html  css  js  c++  java
  • C# 反射使用使用外部DLL

     1 private void Init()
     2         {
     3             string path = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
     4             string dllPath = path + @"\CefWebBorwser\" + "CefWebBrowserControl.dll";
     5             if (System.IO.File.Exists(dllPath))
     6             {
     7                 Assembly assembly = Assembly.LoadFrom(dllPath);
     8                 Type browserType = assembly.GetType("CefWebBrowserControl.CefWebBrowser");
     9                 object browserObj = System.Activator.CreateInstance(browserType);
    10                 MethodInfo method = browserType.GetMethod("OpenUrl");
    11                 string dataStatisticUrl = $"http://{UserHelper.Instance.CurrentUser.ServerIp}:{UserHelper.Instance.CurrentUser.WebPort}/#/login.html?userSession={_websocketService.GetSession()}&lang={GetLang()}&route=2";
    12                 CommonHelper.LogDebug("dataStatisticUrl:" + dataStatisticUrl);
    13                 method.Invoke(browserObj, new object[] { dataStatisticUrl });
    14                 System.Windows.Forms.UserControl browser = (System.Windows.Forms.UserControl)browserObj;
    15                 browser.Dock = DockStyle.Fill;
    16                 host.Child = browser;
    17             }
    18         }
  • 相关阅读:
    spring无法接收上传文件
    springcloud feign增加熔断器Hystrix
    mybatis调用存储过程(@Select方式)
    spring在注解标注的方法上加切面
    java注解Annotation
    java包装类
    JZ-C-43
    JZ-C-42-Plus
    JZ-C-42
    JZ-C-41-Plus
  • 原文地址:https://www.cnblogs.com/yuanchao/p/12104119.html
Copyright © 2011-2022 走看看