/// <summary>
        /// 引发 StatusChanged 事件。
        /// </summary>
        protected virtual void OnStatusChanged(EventArgs e)
        {
            if (StatusChanged != null)
            {
                if (this.status == MultiThreadedWebDownloaderStatus.Paused ||
                    this.Status == MultiThreadedWebDownloaderStatus.Canceled ||
                    this.Status == MultiThreadedWebDownloaderStatus.Completed)
                {
                    //当暂停时,更新时间 .
                    usedTime = usedTime.Add(DateTime.Now - lastStartTime);
                }


                StatusChanged(this, e);

                if (this.Status == MultiThreadedWebDownloaderStatus.Completed)
                {
                    MultiThreadedWebDownloaderCompletedEventArgs downloadCompletedEventArgs =
                        new MultiThreadedWebDownloaderCompletedEventArgs
                        (
                            this.DownloadedSize,
                            this.TotalSize,
                            this.TotalUsedTime
                        );

                    this.OnDownloadCompleted(downloadCompletedEventArgs);
                }
            }
        }
 /// <summary>
 ///引发   DownloadCompleted事件。
 /// </summary>
 protected virtual void OnDownloadCompleted(
     MultiThreadedWebDownloaderCompletedEventArgs e)
 {
     if (DownloadCompleted != null)
     {
         DownloadCompleted(this, e);
     }
 }
Пример #3
0
        /// <summary>
        ///处理 DownloadCompleted事件。
        /// </summary>
        void DownloadCompleted(object sender, MultiThreadedWebDownloaderCompletedEventArgs e)
        {
            lbSummary.Text =
                String.Format("接收: {0}KB, 总共: {1}KB, 时间: {2}:{3}:{4}",
                e.DownloadedSize / 1024, e.TotalSize / 1024, e.TotalTime.Hours,
                e.TotalTime.Minutes, e.TotalTime.Seconds);

            File.Move(tbPath.Text.Trim() + ".tmp", tbPath.Text.Trim());

            prgDownload.Value = 100;
        }
        /// <summary>
        /// 引发 StatusChanged 事件。
        /// </summary>
        protected virtual void OnStatusChanged(EventArgs e)
        {
            if (StatusChanged != null)
            {

                if (this.status == MultiThreadedWebDownloaderStatus.Paused
                    || this.Status == MultiThreadedWebDownloaderStatus.Canceled
                    || this.Status == MultiThreadedWebDownloaderStatus.Completed)
                {
                    //当暂停时,更新时间 .
                    usedTime = usedTime.Add(DateTime.Now - lastStartTime);
                }

                StatusChanged(this, e);

                if (this.Status == MultiThreadedWebDownloaderStatus.Completed)
                {
                    MultiThreadedWebDownloaderCompletedEventArgs downloadCompletedEventArgs =
                        new MultiThreadedWebDownloaderCompletedEventArgs
                        (
                            this.DownloadedSize,
                            this.TotalSize,
                            this.TotalUsedTime
                        );

                    this.OnDownloadCompleted(downloadCompletedEventArgs);
                }
            }
        }
 /// <summary>
 ///引发   DownloadCompleted事件。
 /// </summary>
 protected virtual void OnDownloadCompleted(
     MultiThreadedWebDownloaderCompletedEventArgs e)
 {
     if (DownloadCompleted != null)
     {
         DownloadCompleted(this, e);
     }
 }
Пример #6
0
        /// <summary>
        ///处理 DownloadCompleted事件。
        /// </summary>
        void DownloadCompleted(object sender, MultiThreadedWebDownloaderCompletedEventArgs e)
        {
            lbSummary.Text =
                String.Format("接收: {0}KB, 总共: {1}KB, 时间: {2}:{3}:{4}",
                e.DownloadedSize / 1024, e.TotalSize / 1024, e.TotalTime.Hours,
                e.TotalTime.Minutes, e.TotalTime.Seconds);

            File.Move(tbPath.Text.Trim() + ".tmp", tbPath.Text.Trim());

            prgDownload.Value = 100;
        }