Example #1
0
        public static string Calculate(int digits, int startingAt)
        {
            System.ComponentModel.DoWorkEventArgs eventArgs = new System.ComponentModel.DoWorkEventArgs(digits);

            CalculatePi(typeof(PiCalculator), eventArgs, startingAt);
            return (string)eventArgs.Result;
        }
Example #2
0
 public TVDBLoader(AbstractRepositoryFactory _repositories,
     System.ComponentModel.BackgroundWorker _worker,
     System.ComponentModel.DoWorkEventArgs _eventArgs)
 {
     repositories = _repositories;
     worker = _worker;
     eventArgs = _eventArgs;
 }
Example #3
0
 public XLSLoader(string _filename,
     AbstractRepositoryFactory _factory,
     System.ComponentModel.BackgroundWorker _worker,
     System.ComponentModel.DoWorkEventArgs _eventArgs)
 {
     factory = _factory;
     filename = _filename;
     worker = _worker;
     eventArgs = _eventArgs;
 }
        public void Run_BackgroundWorkerOnDoWork_SetsFilesToEventResult()
        {
            // arrange
            var eventArgs = new System.ComponentModel.DoWorkEventArgs(null);

            // act
            _worker.Run(new RandomizerWorkerSettings(), (x) => { }, (y) => { }, () => { });
            _backgroundWorkerMock.Raise(x => { x.OnDoWork += null; }, null, eventArgs);

            // assert
            Assert.IsTrue(eventArgs.Result.GetType() == new List<AppFile>().GetType());
        }
			public void InitializeBackgroundWorker(object sender, System.ComponentModel.DoWorkEventArgs args)
			{
				BgWorker = sender as System.ComponentModel.BackgroundWorker;
				BgWorkerArgs = args;
			}
Example #6
0
 private void updateListDownloader_DoWork(object sender, DoWorkEventArgs e)
 {
     e.Result = DownloadManager.GetDownloads(updateListDownloader_ProgressChanged);
 }
Example #7
0
 private void installer_DoWork(object sender, DoWorkEventArgs e)
 {
     List<DownloadInfo> downloads = (List<DownloadInfo>)e.Argument;
        ProgressManager progress = new ProgressManager();
        progress.Total = downloads.Count;
        foreach (DownloadInfo download in downloads)
        {
     ++progress.Completed;
     try
     {
      installer_ProgressChanged(download,
       new ProgressChangedEventArgs(progress, null));
      download.Install();
      installer_ProgressChanged(download,
       new ProgressChangedEventArgs(progress, null));
     }
     catch (Exception ex)
     {
      installer_ProgressChanged(download,
       new ProgressChangedEventArgs(progress, ex));
     }
        }
        e.Result = e.Argument;
 }
Example #8
0
 private void downloader_DoWork(object sender, DoWorkEventArgs e)
 {
     List<DownloadInfo> downloads = (List<DownloadInfo>)e.Argument;
        SteppedProgressManager overallProgress = new SteppedProgressManager();
        long totalDownloadSize = downloads.Sum(delegate(DownloadInfo download)
     {
      return download.FileSize;
     });
        foreach (DownloadInfo download in downloads)
        {
     ProgressManagerBase downloadProgress = null;
     ProgressChangedEventHandler localHandler =
      delegate(object sender2, ProgressChangedEventArgs e2)
      {
       DownloadInfo downloadInfo = (DownloadInfo)sender2;
       if (downloadProgress == null)
       {
        downloadProgress = e2.Progress;
        overallProgress.Steps.Add(new SteppedProgressManagerStep(
     e2.Progress, download.FileSize / (float)totalDownloadSize));
       }
       downloader_ProgressChanged(sender2,
        new ProgressChangedEventArgs(overallProgress, e2.UserState));
      };
     download.Download(localHandler);
        }
        e.Result = e.Argument;
 }