I prefer to schedule a Task
for the user interface thread. You can get the UI thread scheduler by calling TaskScheduler.FromCurrentSynchronizationContext
during the UI thread. MSDN has an example here .
I usually prefer SynchronizationContext
based solutions over Dispatcher
based solutions because they are not tied to WPF / Silverlight. Thus, it is possible to write a common business object layer that handles synchronization; it can still be used from WPF, ASP.NET, Windows Forms, Win32 Services, etc.
source share