WHAT'S IN THIS CHAPTER?
Mixing asynchronous programming with tasks
Working with TaskFactory.FromAsync
Programming continuations after asynchronous methods end
Combining results from multiple concurrent asynchronous operations
Creating a responsive UI
Performing asynchronous WPF UI updates
Performing asynchronous Windows Forms UI updates
Creating tasks that perform EAP operations
Working with TaskCompletionSource
This chapter is about the advantages of mixing existing asynchronous programming models with tasks. The asynchronous programming models aren't new and they've been included as part of .NET since the first version. However, the task-based programming model is completely new. Therefore, mixing the old models with the new one is a bit complex. This chapter provides real-life examples that take advantage of the simplicity of
Task instances and their task continuation features to perform concurrent asynchronous jobs related to the existing asynchronous programming models.
In addition, this chapter teaches one of the most complex topics related to concurrent programming: the process of updating the user interface (UI) from diverse tasks and threads. The chapter explains patterns to update the UI in both Windows Forms and Windows Presentation Foundation (WPF) applications.
Task represents an asynchronous operation, as explained in Chapter 2, "Imperative Data Parallelism." Therefore, if you want to perform ...