您的位置:首页 > 其它

win8 中实现断点续传

2014-04-01 21:18 330 查看
1) Resume method does resume on cases where resume is possible. Meaning if the server accepts range-requests, the download would resume, otherwise restart.

2) When you are creating the storage file store your data, you have to use GenerateUnique name enum value to avoid overriding the existing file.

StorageFile destinationFile = await KnownFolders.PicturesLibrary.CreateFileAsync(
destination,CreationCollisionOption.GenerateUniqueName);BackgroundDownloader downloader =newBackgroundDownloader();DownloadOperation download = downloader.CreateDownload(source, destinationFile)


3) If the HttpClient is giving you a hard time with the download, you can always embellish it with a download progress. This would sustain the fluid UI and avoid non responsive application. Here is an example that is to be used with servers which allow chunked encoding: Download / Send Request Async with Progress

(Posted in: Windows 8, WinRT. Tagged: BackgroundDownloader, Download, GetStringAsync, HttpClient,IAsyncOperationWithProgress, SendAsync. 11 Comments

Hope it helps, and you might want to try to post it to a local group rather than the english one. You might get more responses.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: