Posts tagged ‘MessageWindow’

Mobile Development: Easy to use background thread with GUI update

Although there are well know ways to update the GUI from a background thread not running in the GUI thread, I looked for an easiest to use solution. After some experiments I got a background thread class that is very easy to use. No BeginInvoke or Control.Invoke needed any more to update a GUI element.

The final solution uses a MessageWindow inside a control based class with a worker thread. As the control and the MessageWindow is part of the GUI thread, there is no need to use Invokes.

Inside the thread I use SendMessage to transfer background thread informations to the control, which then fires an event you can subscribe in the GUI thread.

The test app attached shows three threads running independently and all update the GUI frequently without blocking the GUI.


Here is my try to visualize my idea and solution

Continue reading ‘Mobile Development: Easy to use background thread with GUI update’ »