WinRT applications, available on both Windows 8 and Windows RT operating systems, make extensive use of asynchronous programming concepts. In fact, with WinRT, Microsoft has followed a simple rule: if an API is expected to take more than 50 milliseconds to run, the API is asynchronous. The rationale behind this decision was to make user experience fluid and not hang or block the UI while an operation is being completed.
In this tutorial, we create two simple applications that demonstrate the use of asynchronous programming using direct API calls as well as writing custom methods that are asynchronous. We discuss the ‘Await” keyword and how it is used. We also demonstrate the concepts of an asynchronous ‘task’ and how we use tasks to implement asynchronous activities.