This recipe describes another very important aspect of dealing with tasks, which is a proper way to work with UI from the asynchronous code. We will learn what a task scheduler is, why it is so important, how it can harm our application, and how to use it to avoid errors.
To step through this recipe, you will need Visual Studio 2012. There are no other prerequisites. The source code for this recipe can be found at
For tweaking tasks execution with
TaskScheduler, perform the following steps: