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.
BackgroundWorker is an easier alternative to accomplishing the goals listed previously. It executes the operations on a background thread using the
BackgroundWorker also makes progress reporting to the UI thread easier, by providing a