Async System.Net.WebClient for Windows Phone 8

Posted by Brandon H on November 14, 2012 Tags: , , , , , ,

Started working on a WP8 project tonight and much to my dismay, TPL was not added to System.Net.WebClient of the WP8 SDK like it was slapped all over WinRT. So what to do?

Well, I did what I did when I created the Async Live SDK project, I wrapped the EAP model with the TPL constructs to facilitate async/await. This has the added bonus of giving the same capability to the GZip WebClient (that you should be using instead, anyway) since that inherits from WebClient.

You can find it here, on nuGet, or in the sidebar of my blog under ‘Projects’.

Enjoy!

Disclaimer: I can only confirm this code makes the previous Async CTP calls that were available for WebClient compile. As I don’t have a WP8 I haven’t tested this on a device, only the emulator. Feel free to contribute to the source if you find problems!

No Comments