简体   繁体   中英

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

using System.Windows.Threading;

how can i call a javascript function in a thread loop??

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.

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):

 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

您必须在线程中执行以下操作:

webbrowser.Dispatcher.Invoke(new Action(() => this.webbrowser.InvokeScript("JS F", arg)));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM