Beispiel #1
0
 /*******************************
  *  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()));
     }
 }
Beispiel #2
0
 /*******************************
  *  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();
 }