예제 #1
0
 // 添加任务
 private static void AddJob(DownloadJob job)
 {
     job.DownloadCompleted += Job_DownloadCompleted;
     job.DownloadCancel    += Job_DownloadCancel;
     DownloadJobs.Add(job);
     Downloader.Add(job);
 }
예제 #2
0
 // 下载被取消时
 private static async void Job_DownloadCancel(DownloadJob job)
 {
     job.DownloadCompleted -= Job_DownloadCompleted;
     job.DownloadCancel    -= Job_DownloadCancel;
     await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
         CoreDispatcherPriority.Normal, () =>
     {
         DownloadJobs.Remove(job);
         FinishedJobs.Add(job);
     });
 }