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         }
  • 相关阅读:
    CSS知识(18---21.CSS完毕)
    CSS 知识(13---)
    CSS编辑知识 ( 1---12 )
    CSS 选择器
    前端CSS
    修建泳池的题解
    2020-3-7模拟赛题解
    奶牛排队的题解
    数的拆分的题解
    青蛙王子的题解
  • 原文地址:https://www.cnblogs.com/yuanchao/p/12104119.html
Copyright © 2011-2022 走看看