Posted By: vesuvius | May 11th @ 12:12 AM
page 1 of 1
Comments: 5 | Views: 855
vesuvius
vesuvius
Das Glasperlenspiel
Is there a way to achive multi-threading with the ease and elegance that the BackgroundWorker does in Windows Forms?
Well, of course, you use the BackgroundWorker! It's not Windows Forms specific.
I'm not sure what timers have to do with BackgroundWorker.

The DispatcherTimer is basically the equivalent of the WinForms timer. The WinForms timer is implemented using the Win32 message loop and WM_TIMER messages and the DispatcherTimer is implemented using the WPF Dispatcher (which broadly speaking is the equivalent to the Win32 message loop).

The other 2 timers that I know of invoke the "tick" callback on a different thread than the UI thread, they're not aware of SynchronizationContext(s) like BackgroundWorker is.

What would a DispatcherBackgroundWorker do? The dispatcher is associated with a thread. Would that mean that a DispacthedBackgroundWorker is associated with that tread too? Then it wouldn't be "background" anymore.

They did create a DispatcherSynchronizationContext which enables the BackgroundWorker to forward calls from the backgound thread to the UI thread. Just like the WindowsFormsSynchronizationContext does.

page 1 of 1
Comments: 5 | Views: 855
Microsoft Communities