コード例 #1
0
        /// <summary>
        /// Adds sub-downloader as a current suboperation, so its progress will be returned as current operation
        /// progress.
        /// </summary>
        /// <param name="subDownloader">Downloader to register as sub-downloader.</param>
        protected void AddAsCurrentOperation(AbstractDownloader subDownloader)
        {
            this.AddSubDownloader(subDownloader);

            subDownloader.ProgressChanged +=
                (sender, args) => this.SetCurrentOperationProgress(subDownloader, subDownloader.Info, args.Progress);
            subDownloader.EstimationChanged +=
                (sender, args) => this.SetCurrentOperationEstimation(subDownloader, args.Estimation);

            this.SetCurrentOperationEstimation(subDownloader, subDownloader.Estimation);
            this.SetCurrentOperationProgress(subDownloader, subDownloader.Info, subDownloader.Progress);
        }
コード例 #2
0
 /// <summary>
 /// Registers another downloader as sub-downloader of this downloader, capable of doing part of the job,
 /// reporting progress, status and current operation progress.
 /// </summary>
 /// <param name="subDownloader">Downloader to register as sub-downloader.</param>
 public void AddSubDownloader(AbstractDownloader subDownloader)
 {
     lock (this)
     {
         this.AddTask(subDownloader);
         this.SubDownloaders.Add(subDownloader);
         subDownloader.StatusAccumulator                  = this.StatusAccumulator;
         subDownloader.StatusChanged                     += this.OnStatusChanged;
         subDownloader.PreliminaryResultsReady           += this.PreliminaryResultsReady;
         subDownloader.CurrentOperationEstimationChanged += this.OnCurrentOperationEstimationChanged;
         subDownloader.CurrentOperationProgressChanged   += this.OnCurrentOperationProgressChanged;
     }
 }