/// <summary> /// 暂停,继续下载 /// </summary> /// <param name="bstop"></param> public void myTaskReStart(bool bstop) { try { if (bstop) { if (bolDownloadingFlag) { //webcDownloading.Suspend() if (webcDownloading.IsBusy) { //取消异步下载 webcDownloading.CancelAsync(); //异步取消,直到IsBusy为False while (webcDownloading.IsBusy) { //do something if (bolItemDestroyed) { break; } } } } } else { // '如果开启了下载,且下载任务EventDone状态不为已完成,则继续下载, // 'WebClient的异步下载文件已修改为支持断点续传 if (bolDownloadingFlag) { //已修改WebClient增加断点续传 DownloadFileAsync(this.DownloadUrl); } } } catch (Exception ex) { } }