crazytudou
313 天前
//注入对象给 html 调用
var obj = new JsEvent(System.Threading.SynchronizationContext.Current);
webBrowser.JavascriptObjectRepository.Register("wform", obj, isAsync: false, options: BindingOptions.DefaultBinder);
public class JsEvent
{
private System.Threading.SynchronizationContext context;
public JsEvent(System.Threading.SynchronizationContext context)
{
this.context = context;
}
//给 html 调用
public void testmsg(string type)
{
//
}
}
前端这么调用(js)
wform.testmsg("test");
你都用 cef 了,winform 和 wpf 应该都没啥区别吧