O
Oli
Hi - I am communicating with my UI thread using the following
technique. This has appalled one of my co-workers - any comments
about it's brilliantness or lack thereof welcome.....
two threads:
1) UI thread
2) Worker thread
- something happens in the worker thread - I need to update the UI.
- worker thread exposes an event - UI thread wires an event handler
into that event
- when worker thread needs something to happen - it raises the event
*** but for the event handler to run on the UI thread - the worker
thread raises the event (via "Invoke") ***
I like this because the UI thread code needs to simply wire up an
event handler. There is hence good separation between the code running
the UI, and the code running the Worker thread.
O.
technique. This has appalled one of my co-workers - any comments
about it's brilliantness or lack thereof welcome.....
two threads:
1) UI thread
2) Worker thread
- something happens in the worker thread - I need to update the UI.
- worker thread exposes an event - UI thread wires an event handler
into that event
- when worker thread needs something to happen - it raises the event
*** but for the event handler to run on the UI thread - the worker
thread raises the event (via "Invoke") ***
I like this because the UI thread code needs to simply wire up an
event handler. There is hence good separation between the code running
the UI, and the code running the Worker thread.
O.