/// <summary> /// Raise DownloadCompleted event. /// </summary> protected virtual void OnDownloadCompleted( DownloadCompletedEventArgs e) { if (DownloadCompleted != null) { DownloadCompleted(this, e); } }
/// <summary> /// The method will be called by the OnStatusChanged method. /// </summary> /// <param name="e"></param> protected virtual void OnDownloadCompleted(DownloadCompletedEventArgs e) { if (e.Error != null && this.status != DownloadStatus.Canceled) { this.Status = DownloadStatus.Completed; } if (DownloadCompleted != null) { DownloadCompleted(this, e); } }
/// <summary> /// Handle the DownloadCompleted event of all the HttpDownloadClients. /// </summary> void client_DownloadCompleted(object sender, DownloadCompletedEventArgs e) { if (e.Error != null && this.Status != DownloadStatus.Canceling && this.Status != DownloadStatus.Canceled) { this.Cancel(); this.OnDownloadCompleted(new DownloadCompletedEventArgs( null, this.DownloadedSize, this.TotalSize, this.TotalUsedTime, e.Error)); } }