Inheritance: System.ComponentModel.ProgressChangedEventArgs
示例#1
0
 protected virtual void OnDownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     if (null != this.DownloadProgressChanged)
     {
         this.DownloadProgressChanged(sender, e);
     }
 }
        protected override void OnDownloadProgressChanged(DownloadProgressChangedEventArgs e)
        {
            if (dt.Ticks == 0)
            {
                dt = DateTime.Now;
            }
            time = (DateTime.Now.Ticks - dt.Ticks) / (TimeSpan.TicksPerMillisecond * 1000);

            if (sw.ElapsedMilliseconds == 0)
            {
                sw.Start();
            }

            float dbSec = sw.ElapsedMilliseconds / 1000;
            string strSpeed;
            try
            {
                strSpeed = clsMain.formatBytes(e.BytesReceived / dbSec);
            }
            catch
            {
                strSpeed = "";
            }

            //System.Diagnostics.Debug.Print(((DateTime.Now.Ticks - dt.Ticks) / (TimeSpan.TicksPerMillisecond*1000) ).ToString());
            //System.Diagnostics.Debug.Print(((time / 60) % 60).ToString());
            //System.Diagnostics.Debug.Print((e.BytesReceived.ToString() + "\t" + (DateTime.Now.Ticks - dt.Ticks).ToString()));
            DownloadProgressChangedIndex(e, intCurrentClassIndex, String.Format("{0:00}:{1:00}:{2:00}", (int)time / 3600, (int)((time / 60) % 60), (int)(time % 60)), strSpeed);
        }
        private void DownloadStatusChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            // Prozentualen Fortschritt in progressBar1 anzeigen
            progressBar2.Value = e.ProgressPercentage;

            statusLabel2.Text = e.ProgressPercentage + "% (" + e.BytesReceived + " von " + e.TotalBytesToReceive + " Bytes)";
        }
示例#4
0
文件: Form1.cs 项目: Gigawiz/RipLeech
        void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            progressBar1.Value = e.ProgressPercentage;
            label2.Text = e.ProgressPercentage.ToString() + "%";
            bytesIn = double.Parse(e.BytesReceived.ToString());
            double totalBytescheck = double.Parse(e.TotalBytesToReceive.ToString());
            string type = null;
            if (totalBytescheck >= 1024)
            {
                double totalBytescheck2 = totalBytescheck /1024;
                if (totalBytescheck2 <= 1024)
                {
                    totalBytes = double.Parse(e.TotalBytesToReceive.ToString()) /1024;
                    type = "Kb";
                }
                else
                {
                    totalBytes = double.Parse(e.TotalBytesToReceive.ToString()) / 1024 / 1024;
                    type = "Mb";
                }
            }
            else
            {
                totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
                type = "Bytes";
            }
            string stripped = totalBytes.ToString().Split('.')[0];

            label5.Text = filedling + " (" + stripped + " "+ type + ")";
            double percentage = ((double)done / (double)count) * (double)100;
            progressBar2.Value = int.Parse(Math.Truncate(percentage).ToString());
            label4.Text = progressBar2.Value.ToString() +"%";
            label6.Text =  done + " / " + count + " Files Downloaded";
        }
 void webClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     test.Value = e.BytesReceived;
     //test.Value = e.ProgressPercentage;
     test.Maximum = e.TotalBytesToReceive;
     DownloadResultText.Text = "Downloaded " + e.BytesReceived + "/" + e.TotalBytesToReceive + "bytes, " + e.ProgressPercentage + "% completed.";
 }
 public void Report(DownloadProgressChangedEventArgs e)
 {
     Application.DoEvents();
     progressBar1.InvokeIfRequired(() => {
         progressBar1.Value = e.ProgressPercentage;
     });
 }
        /// <summary>Updates the download visuals (progress bar, text %, etc.)</summary>
        private void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            int index = GetDownloadFromWebClient((WebClient)sender);
            Download dld = (Download)clients[index]; //is this creating a copy?
            if (!dld.accountedFor)
            {
                dld.totalSize = e.TotalBytesToReceive;
                totalUpdateSize += e.TotalBytesToReceive;
                dld.accountedFor = true;
            }
            dld.completed = e.BytesReceived;
            clients[index] = dld; // put the copy into the array

            long tempTotal = 0;
            lstDownloadProgress.Items.Clear();
            //Should I make this next part thread safe? It isn't really an exact science, so I don't think it matters
            foreach (Download dl in clients)
            {
                tempTotal += dl.completed;
                lstDownloadProgress.Items.Add(dl);
            }

            totalUpdateRecieved = tempTotal;
            pbarDownload.Value = (int)(((double)totalUpdateRecieved / (double)totalUpdateSize) * 100);
            lblDownloadProgress.Text = "" + (int)(((double)totalUpdateRecieved / (double)totalUpdateSize) * 100) + "%";
        }
示例#8
0
 public void OnDownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     if (FileProgress != null)
     {
         FileProgress.Invoke(sender, e);
     }
 }
示例#9
0
 /// <summary>
 /// Callback by the web client when a new piece of file has been incrementally downloaded
 /// </summary>
 void ClientDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     string progress = String.Format("Downloaded {0} of {1} Kb", e.BytesReceived / 1024, e.TotalBytesToReceive / 1024);
     UIThread(() => labelProgress.Text = progress);
     UIThread(() => progressBar.Maximum = (int) e.TotalBytesToReceive);
     UIThread(() => progressBar.Value = (int) e.BytesReceived);
 }
 void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     progressBar1.Maximum = Convert.ToInt32(e.TotalBytesToReceive);
     progressBar1.Value = Convert.ToInt32(e.BytesReceived);
     label5.Text = e.BytesReceived.ToString();
     label6.Text = e.TotalBytesToReceive.ToString();
 }
 void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (e.UserState as string == "pompeu")
     {
         //txtStatus.Text = e.BytesReceived.ToString() + " bytes received.";
     }
 }
示例#12
0
 public void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (e.BytesReceived != 0)
     {
         this.Connected = true;
     }
 }
示例#13
0
        private void HandleDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            //Console.WriteLine("SyncClientService - HandleDownloadProgressChanged - progressPercentage: {0} bytesReceived: {1} totalBytesToReceive: {2}", e.ProgressPercentage, e.BytesReceived, e.TotalBytesToReceive);

            string fileName = string.Empty;
            if(_audioFiles != null && _audioFiles.Count >= _filesDownloaded+1)
                fileName = Path.GetFileName(_audioFiles[_filesDownloaded].FilePath);

            _bytesDownloaded += e.BytesReceived - _lastBytesReceived;
            _lastBytesReceived = e.BytesReceived;

            if (OnDownloadIndexProgress != null)
                OnDownloadIndexProgress(e.ProgressPercentage, e.BytesReceived, e.TotalBytesToReceive);

            if (OnDownloadAudioFileProgress != null)
                OnDownloadAudioFileProgress(new SyncClientDownloadAudioFileProgressEntity(){
                    Status = "Downloading files...",
                    PercentageDone = ((float)_filesDownloaded / (float)_audioFiles.Count()) * 100f, 
                    FilesDownloaded = _filesDownloaded, 
                    TotalFiles = _audioFiles.Count(),
                    DownloadBytesReceived = e.BytesReceived,
                    DownloadTotalBytesToReceive = e.TotalBytesToReceive,
                    DownloadPercentageDone = ((float)e.BytesReceived / (float)e.TotalBytesToReceive) * 100f,
                    DownloadSpeed = GetDownloadSpeed(),
                    Errors = _errorCount, 
                    DownloadFileName = fileName,
                    Log = string.Empty
                });
        }
 public ProgressIndicator(DownloadProgressChangedEventArgs args,string token = "")
 {
     Processed = args.BytesReceived;
     Remaining = args.TotalBytesToReceive;
     Percentage = args.ProgressPercentage;
     RequestToken = token;
 }
示例#15
0
 private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (this.ProgressChanged != null)
     {
         this.ProgressChanged(this, e.ProgressPercentage);
     }
 }
 private void DownloadClient_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     if (this.DownloadProgress != null)
     {
         this.DownloadProgress(this, e);
     }
 }
示例#17
0
 private void VideoProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     _progressTextBlock.Text = String.Format("{0} Downloaded {1} of {2} bytes. {3} % Complete...",
                                             (string)e.UserState, e.BytesReceived, e.TotalBytesToReceive,
                                             e.ProgressPercentage);
     _progressBar.Value = e.ProgressPercentage;
 }
示例#18
0
 private void ProgressChanged(object sender, DownloadProgressChangedEventArgs downloadProgressChangedEventArgs)
 {
     progressBar1.Invoke(new Action(() =>
         {
             progressBar1.Value = downloadProgressChangedEventArgs.ProgressPercentage;
         }));
 }
示例#19
0
 private void downloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (e.ProgressPercentage != updateProgress.Value)
     {
         updateProgress.Value = e.ProgressPercentage;
     }
 }
示例#20
0
        void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            progressBar1.Value = e.ProgressPercentage;



        }
示例#21
0
 private static void OnDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     var song = (Song) e.UserState;
     song.Progress = e.ProgressPercentage;
     song.BytesRecieved = e.BytesReceived;
     song.TotalBytesToRecieve = e.TotalBytesToReceive;
 }
 /************************************************************************/
 /*     EVENT HANDLERS                                                   */
 /************************************************************************/
 void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
   if (e.ProgressPercentage >= lastPercent + ReportPercentStep) {
     lastPercent = (e.ProgressPercentage / ReportPercentStep) * ReportPercentStep;
     if (DownloadProgressChanged != null) DownloadProgressChanged(this, new TasEventArgs(realFileName != "" ? realFileName : currentName, e.ProgressPercentage.ToString()));
   }
 }
示例#23
0
 void downloader_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     double bytesIn = double.Parse(e.BytesReceived.ToString());
     double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
     double percentage = bytesIn / totalBytes * 100;
     this.Dispatcher.Invoke(()=>progressBar.Value = int.Parse(Math.Truncate(percentage).ToString()));
 }
示例#24
0
 private void downloadClient_DownloadProgressChanged(object sender,
                                                     System.Net.DownloadProgressChangedEventArgs e)
 {
     label2.Text = string.Format("{0}% ({1}byte 中 {2}byte) ",
                                 e.ProgressPercentage, e.TotalBytesToReceive, e.BytesReceived);
     progressBar1.Value = e.ProgressPercentage;
 }
示例#25
0
 private void ClientOnDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs downloadProgressChangedEventArgs)
 {
     PrsBar.Maximum = downloadProgressChangedEventArgs.TotalBytesToReceive;
     PrsBar.Value = downloadProgressChangedEventArgs.BytesReceived;
     LabInfo.Content = "BMCL更新中   " + downloadProgressChangedEventArgs.ProgressPercentage.ToString(CultureInfo.InvariantCulture) + "%";
     //            var left = (this.Width - LabInfo.Width)/2;
     //            LabInfo.Margin = new Thickness(left, LabInfo.Margin.Top, left, LabInfo.Margin.Bottom);
 }
 void wc_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     progressBar1.Value = e.ProgressPercentage;
     if (e.ProgressPercentage == 100)
     {
         progressBar1.Visible = false; button5.Enabled = true;
     }
 }
示例#27
0
 public void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (e.ProgressPercentage != progBarDownload.Value)
     {
         progBarDownload.Value = e.ProgressPercentage;
     }
     //Console.Write("\r{0}Downloaded {1}kb of {2}kb. {3}% complete...", (string)e.UserState, e.BytesReceived / 1000, e.TotalBytesToReceive / 1000, e.ProgressPercentage);
 }
示例#28
0
 void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     int progress = e.ProgressPercentage * 78;
     if (progress > old) {
         Console.Write("=");
         old++;
     }
 }
示例#29
0
 void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     double bytesIn = double.Parse(e.BytesReceived.ToString());
     double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
     double percentage = bytesIn / totalBytes * 100;
     frmLauncher._FormInstance.UpdateProgressBar(int.Parse(Math.Truncate(percentage).ToString()));
     frmLauncher._FormInstance.UpdateState(bytesIn, totalBytes, percentage);
 }
示例#30
0
 void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     double bytesIn = double.Parse(e.BytesReceived.ToString());
     double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
     double percentage = (int)Math.Ceiling(bytesIn / totalBytes * 100);
     lblProgress.Text = downloaded + " " + e.BytesReceived + " " + of + " " + e.TotalBytesToReceive;
     prbProgress.Value = int.Parse(Math.Truncate(percentage).ToString());
 }
 private void DownloadProgressCallback(object sender, DownloadProgressChangedEventArgs e)
 {
     int pgdone = e.ProgressPercentage;
     Application.Current.Dispatcher.Invoke(new Action(() =>
     {
         UI_PB.Value = pgdone;
     }));
 }
示例#32
0
 private void wc_DownloadProgressChanged1(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     progressBar1.Value = e.ProgressPercentage;
     if (progressBar1.Value == progressBar1.Maximum)
     {
         progressBar1.Value = 0;
     }
 }
示例#33
0
        private void WebClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            var WebClient = sender as WebClient;

            size = e.TotalBytesToReceive;

            WebClient.CancelAsync();
        }
示例#34
0
 private void downloadClient_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     //Console.WriteLine("{0}% ({1}byte 中 {2}byte) ダウンロードが終了しました。",
     //    e.ProgressPercentage, e.TotalBytesToReceive, e.BytesReceived);
     //string msg = string.Format("{0}% ({1}byte 中 {2}byte) ダウンロードが終了しました。",
     //    e.ProgressPercentage, e.TotalBytesToReceive, e.BytesReceived);
     //SLogInv(msg);
 }
示例#35
0
 void m_downloadClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     Progress = e.ProgressPercentage;
     if (TransferProgressChanged != null)
     {
         TransferProgressChanged(e.ProgressPercentage);
     }
 }
示例#36
0
 //=========================================================//
 //       Прогрессбар закачки но пока не нужен              //
 //=========================================================//
 public void download_ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     try
     {
         //progressBar1.Value = e.ProgressPercentage;
     }
     catch (Exception) { }
 }
示例#37
0
        void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            double bytesIn = double.Parse(e.BytesReceived.ToString());
            double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
            double percentage = bytesIn / totalBytes * 100;

            progressBar1.Value = int.Parse(Math.Truncate(percentage).ToString());
        }
示例#38
0
 private void downloadClient_DownloadProgressChanged(object sender,
                                                     System.Net.DownloadProgressChangedEventArgs e)
 {
     progressbar.Maximum = (int)e.TotalBytesToReceive;
     progressbar.Value   = (int)e.BytesReceived;
     statusMessage.Text  = e.ProgressPercentage + "% ダウンロードが完了しました。";
     //Console.WriteLine("{0}% ({1}byte 中 {2}byte) ダウンロードが終了しました。",
     //    e.ProgressPercentage, e.TotalBytesToReceive, e.BytesReceived);
 }
        private void OnDownloadProgressChanged(System.Net.DownloadProgressChangedEventArgs e)
        {
            var copy = DownloadProgressChanged;

            if (copy != null)
            {
                copy(this, new DownloadProgressChangedEventArgs(e.BytesReceived, e.TotalBytesToReceive, e.ProgressPercentage, e.UserState));
            }
        }
示例#40
0
 protected virtual void OnDownloadProgressChanged(System.Net.DownloadProgressChangedEventArgs args)
 {
     // this.Wrapped.progress_segment = args.ProgressPercentage; //my line
     ProgressPercentage = args.ProgressPercentage;
     if (DownloadProgressChanged != null)
     {
         DownloadProgressChanged(this, args);
     }
 }
示例#41
0
 void client_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     this.BeginInvoke((MethodInvoker) delegate {
         double bytesIn    = double.Parse(e.BytesReceived.ToString());
         double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
         double percentage = bytesIn / totalBytes * 100;
         //lblProgress.Text = "Downloaded " + e.BytesReceived + " of " + e.TotalBytesToReceive;
         progressBar.Value = int.Parse(Math.Truncate(percentage).ToString());
     });
 }
示例#42
0
        private void DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
        {
            //Update the progress bar value with the percentage 0-100
            pBar1.Value = (int)e.ProgressPercentage;

            //download percentage display
            tB1.Text = Convert.ToString(pBar1.Value) + "%";

            //ProgressPercentage is avaliable so do not need to calculate percentage
        }
示例#43
0
 void WebClient_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     try
     {
         label.Text = e.ProgressPercentage.ToString() + "%" + "   " + (Convert.ToDouble(e.BytesReceived) / 1024 / 1024).ToString("0,00") + " МБ" + "  /  " + (Convert.ToDouble(e.TotalBytesToReceive) / 1024 / 1024).ToString("0.00") + " МБ";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#44
0
        void client_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
        {
            double bytesIn    = double.Parse(e.BytesReceived.ToString());
            double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
            double percentage = bytesIn / totalBytes * 100;

            currentByte = bytesIn - currentByte;
            _ProgressBarWindow.ProgressValue(int.Parse(Math.Truncate(percentage).ToString()));
            _ProgressBarWindow.ProgrssStateDisplay(fileName, currentByte / 1000, totalBytes / 1000, bytesIn / 1000);
            currentByte = bytesIn;
        }
示例#45
0
 void webClient_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     try
     {
         if (progress.Value != e.ProgressPercentage)
         {
             progress.Value = e.ProgressPercentage;
         }
     }
     catch (Exception ex)
     {
     }
 }
示例#46
0
 void client_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     this.BeginInvoke((MethodInvoker) delegate
     {
         downloaded_bytes         += e.BytesReceived - oldBytes;
         oldBytes                  = e.BytesReceived;
         string received           = FormatBytes(e.BytesReceived);
         string total              = FormatBytes(e.TotalBytesToReceive);
         taskforceProgress.Maximum = (int)e.TotalBytesToReceive;
         taskforceProgress.Value   = (int)e.BytesReceived;
         teamspeakDestination.Text = "Downloaded " + FormatBytes(downloaded_bytes) + " of " + FormatBytes(need_to_download);
     });
 }
示例#47
0
        private void ProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
        {
            progressBar1.Value = e.ProgressPercentage;
            //if (taskbar_progressbar != null)
            //	taskbar_progressbar.SetProgressValue(e.ProgressPercentage, 100);

            string speed = string.Format("{0} kb/s", (e.BytesReceived / 1024d / sw.Elapsed.TotalSeconds).ToString("0.00"));

            lbl_downloadinfo.Text = string.Format("{0} Mb of {1} Mb ({2}) {3}",
                                                  (e.BytesReceived / 1024 / 1024).ToString("0.00"),
                                                  (e.TotalBytesToReceive / 1024 / 1024).ToString("0.00"),
                                                  e.ProgressPercentage.ToString() + "%",
                                                  speed);
        }
示例#48
0
 private void BinaryDownloader_OnProgressChanges(System.Net.DownloadProgressChangedEventArgs e)
 {
     this.BeginInvoke((MethodInvoker) delegate
     {
         double bytesIn    = double.Parse(e.BytesReceived.ToString());
         double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
         double percentage = bytesIn / totalBytes * 100;
         statusLabel.Text  = "Downloaded " + e.BytesReceived + " of " + e.TotalBytesToReceive;
         if ((Math.Truncate(percentage) > progressBarDownlaod.Minimum && (Math.Truncate(percentage) < progressBarDownlaod.Maximum)))
         {
             progressBarDownlaod.Value = int.Parse(Math.Truncate(percentage).ToString());
         }
     });
 }
示例#49
0
        private void DoDownload_DownloadProgress(object sender, System.Net.DownloadProgressChangedEventArgs e)
        {
            int percent = e.ProgressPercentage;

            if (percent > 99)
            {
                percent = 99;
            }

            if (this.Progress != null)
            {
                this.Progress(percent, ProgressType.Downloading);
            }
        }
    protected void DownloadManager_OnDownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
    {
        String msg;

        if (e.TotalBytesToReceive > 0)
        {
            msg = String.Format("{0} of {1} downloaded ({2}%)", ByteToSizeStr(e.BytesReceived), ByteToSizeStr(e.TotalBytesToReceive), e.ProgressPercentage);
        }
        else
        {
            msg = String.Format("{0} downloaded", ByteToSizeStr(e.BytesReceived));
        }
        updateTextureWithString(msg);
    }
示例#51
0
        private void wc_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
        {
            OnUpdateDownloadProgressChanged(e.ProgressPercentage);
            try
            {
                progressTimer.Stop();
                UpdaterPresentation.GetSingleton().Dispatcher.BeginInvoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate
                {
                    try
                    {
                        UpdaterPresentation.GetSingleton().progressBar1.Value = e.ProgressPercentage;
                        if (DateTime.Now > lastGuiUpdateTime.AddMilliseconds(750))
                        {
                            double interval       = DateTime.Now.Subtract(lastTime).TotalMilliseconds;
                            lastTime              = DateTime.Now;
                            double bytes          = e.BytesReceived - bytesReceived;
                            bytesReceived         = e.BytesReceived;
                            double bytesPerSecond = (bytes / interval) * 1000.1;

                            if (bytesPerSecond < 1024)
                            {
                                UpdaterPresentation.GetSingleton().text.Text = string.Format("{0:0.00} Bytes/sec", bytesPerSecond);
                            }
                            else if (bytesPerSecond / 1024 < 1024)
                            {
                                UpdaterPresentation.GetSingleton().text.Text = string.Format("{0:0.00} KiB/sec", (bytesPerSecond / 1024.0));
                            }
                            else
                            {
                                UpdaterPresentation.GetSingleton().text.Text = string.Format("{0:0.00} MiB/sec", (bytesPerSecond / (1024.0 * 1024.0)));
                            }
                            lastGuiUpdateTime = DateTime.Now;
                        }
                    }
                    catch (Exception ex)
                    {
                        //wtf?
                    }
                }, e.ProgressPercentage);
                if (wc.IsBusy)
                {
                    progressTimer.Start();
                }
            }
            catch (Exception ex)
            {
                GuiLogMessage("Error during download: " + ex.Message, NotificationLevel.Error);
            }
        }
示例#52
0
        private void WebClient_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
        {
            // Calculate download speed and output it to labelSpeed.
            string speedInKB = string.Format("{0} kb/s", (e.BytesReceived / 1024d / stopwatch.Elapsed.TotalSeconds).ToString("0.00"));

            double bytesPerSecond   = e.BytesReceived / stopwatch.Elapsed.TotalSeconds;
            long   bytesLeft        = e.TotalBytesToReceive - e.BytesReceived;
            long   secondsRemaining = (long)(bytesLeft / bytesPerSecond);
            long   minutesRemaining = secondsRemaining / 60;

            secondsRemaining -= (minutesRemaining * 60);
            string timeRemaining = string.Format("{0}m {1}s", minutesRemaining, secondsRemaining);
            string percentage    = e.ProgressPercentage.ToString() + "%";

            SetStatus($"Downloading from Pastebin...\r\n{speedInKB} ( {percentage} )\r\nTime Remaining: {timeRemaining}");
            SetProgress(e.ProgressPercentage);
        }
示例#53
0
 private void Bf_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     try
     {
         this.Invoke(new MethodInvoker(() =>
         {
             toolStripProgressBar1.Value = e.ProgressPercentage;
             toolStripStatusLabel1.Text  = $"{e.ProgressPercentage}% 初始化...";
             if (toolStripProgressBar1.Value == toolStripProgressBar1.Maximum)
             {
                 toolStripStatusLabel1.Text = "准备";
             }
         }));
     }
     catch (Exception ex)
     {
     }
 }
示例#54
0
 void client_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     lblStatus.Text = "Status: Downloading";
     if (chkUseLoop.Checked)
     {
         lblStatus.Text += " Page " + Page;
     }
     if (e.TotalBytesToReceive != -1)
     {
         lblStatus.Text    += " " + Helper.FormatByteSize(e.BytesReceived) + " of " + Helper.FormatByteSize(e.TotalBytesToReceive);
         progressBar1.Value = e.ProgressPercentage < 100 ? e.ProgressPercentage : 100;
         progressBar1.Style = ProgressBarStyle.Continuous;
     }
     else
     {
         lblStatus.Text    += " " + Helper.FormatByteSize(e.BytesReceived);
         progressBar1.Style = ProgressBarStyle.Marquee;
     }
 }
示例#55
0
        void webClient_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
        {
            try
            {
                //    if (labelX1.Text != (Convert.ToDouble(e.BytesReceived) / 1024 / sw.Elapsed.TotalSeconds).ToString("0"))
                //      labelX2.Text = (Convert.ToDouble(e.BytesReceived) / 1024 / sw.Elapsed.TotalSeconds).ToString("0.00") + " ÊÁ/ñ";

                if (downloadbar.Value != e.ProgressPercentage)
                {
                    downloadbar.Value = e.ProgressPercentage;
                }

                if (downloadperc.Text != e.ProgressPercentage.ToString() + "%")
                {
                    downloadperc.Text = e.ProgressPercentage.ToString() + "%";
                }

                downloadperc.Text = (Convert.ToDouble(e.BytesReceived) / 1024 / sw.Elapsed.TotalSeconds).ToString("0.00") + " KB/c " + e.ProgressPercentage.ToString() + "%";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#56
0
 private void onDownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     _displayMessage = String.Format("{0} of {1} downloaded ({2}%)", e.BytesReceived, e.TotalBytesToReceive, e.ProgressPercentage);
 }
 private void WebClientB_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     progressBar1.Value = e.ProgressPercentage;
 }
示例#58
0
 private void DownloadProgressCallback(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     SetLoadingLabel("正在下载数据库..." + e.ProgressPercentage + "%");
     SetLoadingProgressBar(databaseSyncStart + e.ProgressPercentage * (databaseSyncEnd - databaseSyncStart) / 100);
 }
示例#59
0
 void wc_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     //throw new NotImplementedException();
     progressBar2.Value = e.ProgressPercentage;//将progressbar的值设为下载的百分比
     label2.Text        = progressBar2.Value + "%";
 }
 private void client_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
 {
     OnDownloadProgressChanged(e);
 }