[英]Invoke JavaScript in thread loop
i am using 我在用
this.webbrowser.InvokeScript("JS function", arguments);
to call a javascript function ==> works fine but i need to use Threading System for Multi tasking 调用javascript函数==>效果很好,但我需要使用Threading System进行多任务处理
using System.Windows.Threading;
how can i call a javascript function in a thread loop?? 我如何在线程循环中调用JavaScript函数?
my project is to create a GCS for UAV (Ground control station for drones), so i have geographical coordinate coming from my drone (GPS), and i need to draw the path in my windows app. 我的项目是为UAV(无人机地面控制站)创建GCS,因此我的地理坐标来自无人机(GPS),并且需要在Windows应用程序中绘制路径。
so i'm loading a localpage code (using google api,html and javascript) in a web browser, this is the JS function i need to call (not to use it in my windows app, just to execute the function in my browser): 所以我要在网络浏览器中加载本地页面代码(使用google api,html和javascript),这是我需要调用的JS函数(不要在Windows应用程序中使用它,而只是在浏览器中执行该函数) :
function DrawLinePlane(lat,lon,alt){ // some code flightString.getCoordinates().pushLatLngAlt(lat,lon,alt); // Add LineString points. //some code }
so basically when ever i receive new coodinate i have to call the DrawLinePlane finction in my page, for this i'm using a thread loop to receive those coordinate and draw that path, and the invokeScript didn't work in this loop 所以基本上,当我收到新的字典时,我必须在页面中调用DrawLinePlane函数,为此,我正在使用线程循环来接收这些坐标并绘制该路径,而invokeScript在此循环中不起作用
您必须在线程中执行以下操作:
webbrowser.Dispatcher.Invoke(new Action(() => this.webbrowser.InvokeScript("JS F", arg)));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.