【发布时间】:2020-09-20 15:23:01
【问题描述】:
我需要一些帮助来加载未打包(或打包,如果您知道我该怎么做)的表单目录。
我搜索了很多,但没有找到任何更新的内容。
我正在尝试调用这个函数:
this.browser.RequestContext.LoadExtensionFromDirectory(Directory.GetCurrentDirectory() +
"/vendors/static/fcfhplploccackoneaefokcmbjfbkenj", ???????????? );
但我找不到获取文档中描述的IExtensionHandler 的方法:
RequestContextExtensions.LoadExtensionsFromDirectory
我在表单中有一个简单的 CefSharp 嵌入式浏览器,我正在尝试加载扩展。
我不知道如何得到这个IExtensionHandler。
这是我的代码:
public partial class MainEmbedBrowser : Form
{
private string ID;
private ChromiumWebBrowser browser;
public MainEmbedBrowser(string url, string combo)
{
InitializeComponent();
this.browser = new ChromiumWebBrowser("localhost", new RequestContext());
//this.browser.RequestContext.LoadExtensionFromDirectory(Directory.GetCurrentDirectory() + "/vendors/static/fcfhplploccackoneaefokcmbjfbkenj", extensionHandler);
this.Controls.Add(browser);
this.browser.Load("https://google.com");
this.browser.Height = this.Height;
this.browser.Width = this.Width;
this.Show();
}
}
如果有人可以帮助我,在此先感谢
【问题讨论】:
-
到目前为止您尝试过什么?你能分享你的代码吗?
标签: c# winforms cefsharp chromium-embedded