Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: problem with backgroundworker

0
0
Hello notahack,

Windows script engines (JScript/VBScript) have thread affinity; that is, each instance can only be accessed on the thread that created it.

ClearScript supports this requirement by associating each WindowsScriptEngine instance with a Dispatcher that you can use to invoke operations on the appropriate thread.

Depending on your application's architecture, such invocations may or may not have to be asynchronous. Here's an example of a synchronous one:
engine.Dispatcher.Invoke(new Action(() => engine.Execute(scriptCode)));
Good luck!

Viewing all articles
Browse latest Browse all 2297