Interpreter.Stop() and Start() problem

May 21, 2010 at 4:05 AM
Edited May 21, 2010 at 6:18 AM
Hi there, I faced problem in interpreter.stop() where the event of interpreter.stopped+=.... cannot be invoked. My question is is this method Stop() or Start() is run in thread? Using previous version the interpreter.stop() works perfectly. Thanks Bernad
Developer
May 21, 2010 at 3:41 PM

For performance reasons, none of the events in GPS.Net - especially static events - are guaranteed to execute on any particular thread.  If the code in your event handler requires thread affinity, then it is up to you to marshal to the appropriate thread.  A common example of this is a GUI application where an event handler needs to update the UI.  Since the UI can only be updated from the WndProc thread, you have to marshal to that thread.  In WPF, this can be done using the Dispatcher.Invoke method. In WinForms, you can use the Control.Invoke method. Or you can use SynchronizationContext.Send, which will work in any environment.