private void ReportProgressInternal(YouHandler.FileDownloadingInfo video, double progress) { int index = _videosInProgress.IndexOf(video); if (index == -1) { CreateProgressReportHandler(new List <YouHandler.FileDownloadingInfo>() { video }); index = _videosInProgress.Count - 1; } int barLeftBrace = _progressbarStartList[index]; SetProgressBarValue(barLeftBrace, barLeftBrace + ProgressBarString.Length - 1, progress); if (progress >= 1.0f) { _videosInProgress.RemoveAt(index); _progressbarStartList.RemoveAt(index); if (_videosInProgress.Count == 0) { MessageBox.Show("All tasks finished!"); } } }
public void ReportProgress(YouHandler.FileDownloadingInfo video, double progress) { if (InvokeRequired) { Invoke(new Action <YouHandler.FileDownloadingInfo, double>(ReportProgressInternal), new object[] { video, progress }); } else { ReportProgressInternal(video, progress); } }