Donnerstag, 22. August 2013

how to update the UI from another thread / parallel task

Use MYCLASS.Dispatcher.Invoke and post code for the queue of the UI thread.
Imagine, you will fill a listbox in an async & await initialized parallel thread or in another object.

...
MyMainWindowInstance.Dispatcher.Invoke(DispatcherPriority.Normal, (Actiondelegate() { MyMainWindowInstance.MyListBox.Items.Add("from parallel!!!!!!!!"); }  );
...

Benefit from the best Windows Desktop app in the world and use Strokey.Net!

Keine Kommentare:

Kommentar veröffentlichen