Reputation: 1
For downloading I use BackgroundDownloader. If user needs to delete a file(status = downloading), I need to cancel DownloadOperation. But I did not find method in the DownloadOperation`s list. Tell me, please, how to implement this?
Upvotes: 0
Views: 134
Reputation: 32775
How can I cancel DownloadOperation?
You could cancel download easily with cancel token. You could pass CancellationToken
to DownloadOperation
when you start DownloadOperation
await download.StartAsync().AsTask(cts.Token, progressCallback);
If you want to cancel above DownloadOperation
, you just call the following.
cts.Cancel();
cts.Dispose();
For more detail please refer BackgroundTransfer
code sample.
Upvotes: 1