/******************************* * Worker update progress * /********************************/ private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { // update GUI method. if (MainView != null && MainView.Created) { MainView.Invoke(new Action(() => MainView.updateDownloadingInfo(currentFile + 1, downloadList.Count, currentFileString))); MainView.Invoke(new Action(() => MainView.updateDownloadedAmount(downloadedAmount))); } if (e.ProgressPercentage == 100) { MainView.Invoke(new Action(() => MainView.UpdateCompleted())); } }
/******************************* * Worker completed * /********************************/ private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Cancelled) { } else if (e.Error != null) { MessageBox.Show(e.ToString()); } else { if (MainView != null && MainView.Created) { MainView.Invoke(new Action(() => MainView.UpdateCompleted())); } } inter.StopNetworkInterface(); }