WinRT : how to cancel a Background Download Operation

, , 8 Comments

cancelDownloadOperationsToday a quick tip, easy to code but hard to find if you don’t know where to look for : how to cancel a DownloadOperation !

There is some useful methods on the DownloadOperation : Resume, Pause, Start … but wait there is no “Stop” ??

In fact, you have to attach the operation to your app before to be able to cancel it. The code is then really easy :
[csharp]theDownloadOperation.AttachAsync().Cancel();[/csharp]

Now you know how download operations are canceled in this beautiful Dropbox Client for Windows 8 : 8 Files In A Box !

 

8 Responses

Comments are closed.