Пример #1
0
        private void thread_downloadProgressUpdate(object sender, DownloadProgressChangedEventArgs e)
        {
            if (this.progress_download.InvokeRequired)
            {
                threadDelegate_downloadProgress d = new threadDelegate_downloadProgress(thread_downloadProgressUpdate);
                this.Invoke(d, sender, e);
            }
            else
            {
                download_bytesReceived_new = e.BytesReceived / 1024;
                download_bytesTotal        = e.TotalBytesToReceive / 1024;

                double mb_down  = Math.Round(download_bytesReceived_new * 0.0009765625, 2);
                double mb_total = Math.Round(download_bytesTotal * 0.0009765625, 2);

                int percent = e.ProgressPercentage;
                this.progress_download.Value     = percent;
                this.lbl_downloadProgress.Text   = mb_down + "MB / " + mb_total + "MB\n" + percent + "% (" + download_kbps + " kb/s)";
                this.timer_downloadSpeed.Enabled = true;
            }
        }
Пример #2
0
        private void thread_downloadProgressUpdate(object sender, DownloadProgressChangedEventArgs e)
        {
            
            if (this.progress_download.InvokeRequired)
            {
                threadDelegate_downloadProgress d = new threadDelegate_downloadProgress(thread_downloadProgressUpdate);
                this.Invoke(d, sender, e);
            }
            else
            {
                download_bytesReceived_new = e.BytesReceived / 1024;
                download_bytesTotal = e.TotalBytesToReceive / 1024;

                double mb_down = Math.Round(download_bytesReceived_new * 0.0009765625, 2);
                double mb_total = Math.Round(download_bytesTotal * 0.0009765625, 2);

                int percent = e.ProgressPercentage;
                this.progress_download.Value = percent;
                this.lbl_downloadProgress.Text = mb_down + "MB / " + mb_total + "MB\n" + percent + "% (" + download_kbps + " kb/s)";
                this.timer_downloadSpeed.Enabled = true;
            }
        }