What is the best way to open Rhino.UI.Dialogs from another thread and get the result?
Do i have to use RhinoApp.InvokeOnUiThread ?
How can this return the Dialog result instead of void
Hi @dale I am using my F# scripting editor (@nathanletwory knows it).
It evaluates F# scripts on another thread. This is nice because it keeps the editor window alive while running my scripts.
However for UI dialogs I need to switch back to the UI thread. So it would be convenient to have the Synchronisation Context of the UI thread exposed on RhinoCommon.
I am aware that it is probably not always safe to manipulate the RhinoDoc from another thread. But so far I had no problems doing it. I would be curious what you think of this.
I found a workaround. The running F# scripts have to reference the running editor plugin rhp file.
In the editor plugin I created a property called SynchronizationContext. It gets set to System.Threading.SynchronizationContext.Current when the plugin is loaded.
It would be nicer if this property was on RhinoCommon which is always referenced.
I think Rhino.RhinoApp could also have a property called SynchronizationContext
It would be set to System.Threading.SynchronizationContext.Current when RhinoCommon is first loaded.