#Windows Runtime

Simple async file access using Windows 8, part 2

In the previous article I presented a helper library for reading and writing to the file system using the new Windows Runtime asynchronous file APIs.

One downside of the code I presented is that the actual reading and writing was still happening on the main UI thread. While this may not be a problem in a simple application, it is undesirable for complex documents.

The challenge is that we still need to be on the UI thread when we collect the data we want to save, but the writing itself could be on a background thread.

In this article I will cover a way to extend the API I presented previously, to allowing reading and writing via a background thread.

Read More

Simple async file access using Windows 8

This article refers to pre-release software. Some or all of what is presented could change between now and release.

This week at the Build Windows conference, Microsoft announced Windows 8 and introduced the new Windows Runtime APIs for the developers.

As a C# developer, one of the defining features of the Runtime is that a lot of the .NET Framework is “gone”, or moved to new namespaces. Nowhere is this more true than in System.IO, which is now fairly barren. The reason is that most of the file I/O APIs in the Windows Runtime are designed to be asynchronous, and as these new APIs are in the Runtime, they’ve moved into the Windows.* namespace.

As it turns out, reading and writing files using the new asynchronous APIs is a little convoluted. OK, its a lot convoluted, but I’ve put together some code that should simplify it for you, while also taking you through the steps involved.

Read More