private void DownloadProgressChanged(object sender, DownloadEventArgs e) { if (sender is DownloadTask) { DownloadTask currentDownloadTask = sender as DownloadTask; int index = downloadTasks.FindIndex(downloadTask => downloadTask.Url.Equals(currentDownloadTask.OutFilename, StringComparison.Ordinal)); DownloadListItem downloadListItem = flowLayoutPanel1.Controls[index] as DownloadListItem; downloadListItem.SetProgress(e.Progress); } }
private void DownloadStatusChanged(object sender, DownloadEventArgs e) { if (e.Status == DownloadStatus.Completed) { Done(); } else if (e.Status == DownloadStatus.Error) { statusLabel.Visible = true; } }
private void DownloadStatusChanged(object sender, DownloadEventArgs e) { if (sender is DownloadTask) { DownloadTask currentDownloadTask = sender as DownloadTask; int index = downloadTasks.FindIndex(downloadTask => downloadTask.Url.Equals(currentDownloadTask.OutFilename, StringComparison.Ordinal)); DownloadListItem downloadListItem = flowLayoutPanel1.Controls[index] as DownloadListItem; if (e.Status == DownloadStatus.Completed) { downloadListItem.Done(); } } }
private void FireStatusChangedEvent(DownloadStatus status) { if (DownloadStatusChanged != null) { DownloadEventArgs args = new DownloadEventArgs(status); if (DownloadStatusChanged.Target is System.Windows.Forms.Control) { System.Windows.Forms.Control targetForm = DownloadStatusChanged.Target as System.Windows.Forms.Control; targetForm.Invoke(DownloadStatusChanged, new object[] { this, args }); } else { DownloadStatusChanged(this, args); } } }
private void DownloadStatusChanged(object sender, DownloadEventArgs e) { if (e.Status == DownloadStatus.Completed) { Done(); } else if(e.Status == DownloadStatus.Error) { statusLabel.Visible =true; } }
private void DownloadProgressChanged(object sender, DownloadEventArgs e) { progressBar1.Value = e.Progress; }