コード例 #1
0
 public void Completed(AsyncCompletedEventArgs e)
 {
     try {
         if (DownloadData != null)
         {
             DownloadData.Close();
         }
     }
     catch {
     }
     try {
         if (fileStream != null)
         {
             fileStream.Close();
         }
     }
     catch {
     }
     if (e.Error != null)
     {
         DownloadStatus = DownloadStatus.Failed;
     }
     else if (e.Cancelled)
     {
         DownloadStatus = DownloadStatus.Cancelled;
     }
     else
     {
         DownloadStatus = DownloadStatus.Success;
     }
     DownloadSpeed = 0;
 }
コード例 #2
0
 protected override void OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
 {
     try { if (DownloadData != null)
           {
               DownloadData.Close();
           }
     }
     catch { }
     try { if (fileStream != null)
           {
               fileStream.Close();
           }
     }
     catch { }
     if (e.Cancelled)
     {
         DownloadStatus = DownloadStatus.Canceled;
     }
     else if (e.Error != null)
     {
         DownloadStatus = DownloadStatus.Failed;
     }
     else
     {
         DownloadStatus = DownloadStatus.Success;
     }
     DownloadSpeed = 0;
     base.OnRunWorkerCompleted(e);
 }