O'Reilly logo

C# Multithreaded and Parallel Programming by Rodney Ringler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

WPF example with an asynchronous BackgroundWorker

A loop like the one used in the previous example is an ideal task to run in an independent thread. That way, we could keep control over the UI and have the possibility of canceling the job, displaying its progress, hiding the CodeBreaker controls, and displaying our Fishes game. Hence, we can avoid being shot by the guard (death or jail).

In this section, we will see how to use the BackgroundWorker component in a simple way to create a second concurrent thread in our application, which will allow the user to perform other actions while the CodeBreaking process is being performed.

We will first do this in an asynchronous way and then in a synchronous way in the next chapter. The differences will be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required