我正在尝试使用 awesomium 创建一个基本的应用程序,我正在测试 js <----> c# 通信,但这似乎效果不佳......我创建了一个本地 html 并打开它......到目前为止一切都很好..但是当我尝试调用 js 时,什么也没有发生,没有错误,没有错误,什么都没有,只是这不会调用 js ..
我的基本 js 代码是:
var base = {
newItem : function(item){
$("#botones").append('<div class="botonMenu">' + item + '</div>');
},
other : function(){
alert("hi!!");
}
}
如果我在萤火虫中测试这个显然我可以很好地调用我的函数并创建项目或警报框......
现在..我的 C# 代码是这样的
//I've wrote this code inside the winForms sample..but change the code for load
//my local file and call js....
WebCore.BaseDirectory = @"C:\Documents and Settings\ME\dummytests\codes\views";
webView.LoadFile("base.html");
JSValue param1 = new JSValue("nameItem");
webView.CallJavascriptFunction("base", "other");
webView.CallJavascriptFunction("base","newItem", param1);
webView.Focus();
文件加载良好,但 js 通信不起作用非常感谢,我希望能帮助我......这个 awesomium 真的很棒