Example #1
0
        public async Task StarDownload(string fileName, Uri uri)
        {
            fileName = _utilityHelper.ReplaceInvalidCharactorsInFileName(fileName);

            //创建文件
            //td:此处添加文件存在检测逻辑
            var file = await _storageService.CreaterFile(defaultFolder, fileName);

            var downloadinfo = await _downloadService.CreateDownload(uri, file, DownloadProgress);

            DownloadingVM.DownloadOperations.Add(downloadinfo);

            try
            {
                await downloadinfo.Start();

                //下载完成动作
                DownloadingVM.DownloadOperations.Remove(downloadinfo);
                FinishedDownload(downloadinfo);
            }
            catch (TaskCanceledException)
            {
            }
        }