C# 反射使用使用外部DLL
2021-01-21 17:15
标签:login name from path user com style directory ast C# 反射使用使用外部DLL 标签:login name from path user com style directory ast 原文地址:https://www.cnblogs.com/yuanchao/p/12104119.html 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 }
下一篇:windows网卡数据转发