Using BackgroundWorker

As we have seen, desktop applications have to be multi-threaded to be responsive. When multi-threading our applications, we spawn a new thread (or use the ThreadPool) and then when the background thread finishes executing, the background thread might need to notify the other threads (especially the UI thread). There are signalling constructs available in .NET, such as EventWaitHandle for thread synchronization, that we can use. We also frequently need to show the progress of execution of certain tasks to the user, using something like a progress bar or status bar. The .NET framework makes all of this possible, but it requires a lot of understanding of multithreading and code that is difficult to develop and maintain.

Get MVVM Survival Guide for Enterprise Architectures in Silverlight and WPF now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.