public void Report(DownloadProgressChangedEventArgs e)
 {
     Application.Invoke(delegate
         {
             progressbar1.Adjustment.Value = e.ProgressPercentage;
         });
 }
 static void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     //every time new bytes are received this method is triggered
         double percentage = e.ProgressPercentage;
         Console.Write("{0} bytes / {1} bytes : ", e.BytesReceived, e.TotalBytesToReceive);
         Console.WriteLine("{0} %", percentage);
         Thread.Sleep(50);
 }
Example #3
0
 public ImapClient()
 {
     Messages = new Query<IMessageQueryable>(new ImapMessageQueryProvider(this));
     ResponseTimeout = TimeSpan.FromSeconds(20);
     UpdateDownloadProgressTriggerChunkSize = Size.FromBytes(500);
     UsePeek = true;
     _downloadProgressChangedEventArgs = new DownloadProgressChangedEventArgs(0, 1);
 }
Example #4
0
 public void download_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     double bytesIn = double.Parse(e.BytesReceived.ToString());
     double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
     double percentage = bytesIn / totalBytes * 100;
     double downloaded = bytesIn / 1024;
     double max = totalBytes / 1024;
     label1.Text = Math.Round(downloaded, 2) + "KB of " + Math.Round(max, 2) +"KB downloaded.";
 }
Example #5
0
    private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
    {
        //UnityEngine.Debug.Log(e.ProgressPercentage);
        /*
        UnityEngine.Debug.Log(string.Format("{0} MB's / {1} MB's",
            (e.BytesReceived / 1024d / 1024d).ToString("0.00"),
            (e.TotalBytesToReceive / 1024d / 1024d).ToString("0.00")));
        */
        //float value = (float)e.ProgressPercentage / 100f;
        string value = string.Format("{0} kb/s", (e.BytesReceived / 1024d / mStopwatch.Elapsed.TotalSeconds).ToString("0.00"));
        NotiData data = new NotiData(NotiConst.UPDATE_PROGRESS, value);
        if (mSyncEvent != null) mSyncEvent(data);

        if (e.ProgressPercentage == 100 && e.BytesReceived == e.TotalBytesToReceive)
        {
            mStopwatch.Reset();

            data = new NotiData(NotiConst.UPDATE_DOWNLOAD, mCurDownFile);
            if (mSyncEvent != null) mSyncEvent(data);
        }
    }
 private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
 }
Example #7
0
        /// <summary>
        /// Вызывает событие <see cref="DownloadProgressChanged"/>.
        /// </summary>
        /// <param name="e">Аргументы события.</param>
        protected virtual void OnDownloadProgressChanged(DownloadProgressChangedEventArgs e)
        {
            EventHandler<DownloadProgressChangedEventArgs> eventHandler = _downloadProgressChangedHandler;

            if (eventHandler != null)
            {
                eventHandler(this, e);
            }
        }
        private void client_progresoDescarga(object sender, DownloadProgressChangedEventArgs e)
        {
            Home home = (Home)AppContext.Instance.get("Home");

            home.escribirLabel("Porcentaje de descarga: " + e.ProgressPercentage.ToString());
        }
 void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     //progressBar.Visible = true;
 }
 private void OnDownloadProgressChangedHandler (object sender,
                                                DownloadProgressChangedEventArgs e)
 {
     OnDownloadProgressChanged (
         e.BytesReceived,
         e.TotalBytesToReceive,
         e.ProgressPercentage,
         userState
     );
 }
 /// <summary>
 /// Raise DownloadProgressChanged event. If the status is Completed, then raise
 /// DownloadCompleted event.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnDownloadProgressChanged(
     DownloadProgressChangedEventArgs e)
 {
     if (DownloadProgressChanged != null)
     {
         DownloadProgressChanged(this, e);
     }
 }
 private void AssetTests_OnDownloadProgress(object sender, DownloadProgressChangedEventArgs e)
 {
     _downloadProgress = e.Progress;
     Trace.WriteLine(_downloadProgress);
 }
Example #13
0
 private static void progress(object sender, DownloadProgressChangedEventArgs e)
 {
     Console.Write("\rDownloading: {0:000} %", e.ProgressPercentage);
 }
Example #14
0
 private void wb_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     //when ever the progress is changed then
     downloadedPercent = e.ProgressPercentage;
 }
Example #15
0
 void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (sf.Count >= 1)
     SignalCompleting(sf[sf.Count - 1].HostName, sf[sf.Count - 1].id, sf[sf.Count - 1].Status, sf[sf.Count - 1].Url.AbsoluteUri, sf[sf.Count - 1].TotalSize, sf[sf.Count - 1].DownloadedSize, sf[sf.Count - 1].TotalUsedTime);
 }
 private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     downloadProgress_ = e.ProgressPercentage;
 }
 void DownloadProgressCallback( object sender, DownloadProgressChangedEventArgs arg )
 {
     currentDownloadPercentage = " - " + arg.ProgressPercentage.ToString () + "% Complete";
 }
Example #18
0
 private void WebClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     Progress = e.ProgressPercentage;
 }
Example #19
0
 private void ClientDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     Program.Frm.SetProgress(e.ProgressPercentage);
 }
Example #20
0
        /// <summary>
        /// Событие DownloadProgressChanged для всех
        /// </summary>
        void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            lock (locker)
               {
               if (DownloadProgressChanged != null)
               {
                   int speed = 0;
                   DateTime current = DateTime.Now;
                   TimeSpan interval = current - lastNotificationTime;

                   if (interval.TotalSeconds < 60)
                   {
                       speed = (int)Math.Floor((this.DownloadedSize + this.CachedSize -
                           this.lastNotificationDownloadedSize) / interval.TotalSeconds);
                   }

                   lastNotificationTime = current;
                   lastNotificationDownloadedSize = this.DownloadedSize + this.CachedSize;

                   var downloadProgressChangedEventArgs =
                       new DownloadProgressChangedEventArgs(
                           DownloadedSize, TotalSize, speed);
                   this.OnDownloadProgressChanged(downloadProgressChangedEventArgs);
                   Server.SignalCompleting(this.HostName, this.id, this.Status, this.Url.AbsoluteUri, this.TotalSize, this.DownloadedSize, this.TotalUsedTime);
               }

               }
        }
Example #21
0
 private void wcNus_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     ulong pv = (((ulong) e.BytesReceived + bytesdone_total)*(ulong) pbt.Maximum/bytestotal);
     if ((int)pv > pbt.Maximum) return;
     pbs.Value = (int) (e.BytesReceived*pbs.Maximum / e.TotalBytesToReceive);
     pbt.Value = (int)pv;
 }
        /// <summary>
        /// Handle the DownloadProgressChanged event of all the HttpDownloadClients, and 
        /// calculate the download speed.
        /// </summary>
        void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            lock (locker)
            {
                if (DownloadProgressChanged != null)
                {
                    int speed = 0;
                    DateTime current = DateTime.Now;
                    TimeSpan interval = current - lastNotificationTime;

                    if (interval.TotalSeconds < 60)
                    {
                        speed = (int)Math.Floor((this.DownloadedSize + this.CachedSize-
                            this.lastNotificationDownloadedSize) / interval.TotalSeconds);
                    }

                    lastNotificationTime = current;
                    lastNotificationDownloadedSize = this.DownloadedSize + this.CachedSize;

                    var downloadProgressChangedEventArgs =
                        new DownloadProgressChangedEventArgs(
                            DownloadedSize, TotalSize, speed);
                    this.OnDownloadProgressChanged(downloadProgressChangedEventArgs);
                }

            }
        }
Example #23
0
 void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     try {
         Application.Invoke (delegate {
             progressbar1.Fraction = e.ProgressPercentage / 100.0;
             downloadSpeed (e.BytesReceived);
         }
         );
     } catch (Exception ex) {
         errorLog (true, ex.Message, true, "Downloading Video/Audio");
     }
 }
        private void OnDownloadProgressChanged (DownloadProgressChangedEventArgs args)
        {
            EventHandler <DownloadProgressChangedEventArgs>
                handler = DownloadProgressChanged;

            if (handler != null) {
                handler (this, args);
            }
        }
        private void CurrentDownload_ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            try
            {
                Dispatcher.Invoke(() =>
                {
                    if (e.ProgressPercentage >= 1)
                    {
                        this.Title = string.Format("{0:0}% ", e.ProgressPercentage) + downloadData.FileName;
                    }

                    FileSize.Text = Helper.SizeSuffix(e.TotalBytesToReceive, 3) != null && Helper.SizeSuffix(e.TotalBytesToReceive, 3) != "-1.00 bytes" ? Helper.SizeSuffix(e.TotalBytesToReceive, 3) : "Unknown";
                    downloadData.Size = e.TotalBytesToReceive;

                    Downloaded.Text = Helper.SizeSuffix(e.BytesReceived, 3) + string.Format(" ( {0:0.00} % )", e.ProgressPercentage);

                    TransferRate.Text = Helper.SizeSuffix((long)e.CurrentSpeed, 3) + "/sec";
                    downloadData.TransferRate = Helper.SizeSuffix((long)e.CurrentSpeed, 3) + "/sec";

                    TimeLeft.Text = e.TimeLeft.ToString(@"dd\.hh\:mm\:ss");
                    downloadData.TimeLeft = e.TimeLeft.ToString(@"dd\.hh\:mm\:ss");

                    ProgressBar.Value = e.ProgressPercentage;
                    downloadData.Status = string.Format("{0:0.00}% ", e.ProgressPercentage);
                    TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Normal; // you need to set this, otherwise progressvalue does nothing
                    TaskbarItemInfo.ProgressValue = e.ProgressPercentage / 100f;
                });
            }
            catch (System.Threading.Tasks.TaskCanceledException) {}
        }
Example #26
0
 void webClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     var key = e.UserState.ToString();
     if (ContainKey(key))
     {
         var task = GetTask(key);
         task.OnProgress(e.ProgressPercentage);
         task.OnTotalBytesToReceive(e.TotalBytesToReceive);
         task.OnBytesReceived(e.BytesReceived);
         task.OnTotalProgress(e.ProgressPercentage, e.TotalBytesToReceive, e.BytesReceived);
         //添加处理taskProgress
         if (TaskProgress != null)
         {
             int count = tasks.Where(ta => ta.bFineshed).Count();
             string filename = task.FileName.Substring(task.FileName.LastIndexOf("/") + 1);
             TaskProgress(tasks.Count, count, filename);
         }
         System.Threading.Thread.Sleep(100);
     }
 }
Example #27
0
        private void OnProgressChanged()
        {
            double pctComplete = CalculateCompletedPercentage();
            double kbPerSec = CalculateDownloadSpeed();

            if (ProgressChanged != null)
            {
                DownloadProgressChangedEventArgs eventArgs = new DownloadProgressChangedEventArgs
                    (
                    pctComplete,
                    kbPerSec,
                    _httpWebRequestState.ContentCursor,
                    _httpWebRequestState.ContentLength
                    );

                ProgressChanged(this, eventArgs);
            }
        }
Example #28
0
        /// <summary>Reports that the download progress has changed.</summary>
        /// <param name="sender">The object that called the event.</param>
        /// <param name="e">The <c>DownloadProgressChangedEventArgs</c> instance containing the event data.</param>
        static void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            IsInstalling = true;
            if (isClientConnected)
            {
                client.OnDownloadProgressChanged(sender, e);
            }

            Application.Current.Dispatcher.BeginInvoke(
                UpdateNotifyIcon,
                string.Format(CultureInfo.CurrentCulture, Resources.DownloadProgress, e.FilesTransferred, e.FilesTotal));
        }
Example #29
0
 private void Downloader_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     prgDownload.Value = e.ProgressPercentage;
     lblStatus.Text = "Status : Downloading...";
     lblDownload.Text = "Downloaded: " + (e.BytesRead / 1024d / 1024d).ToString("0.000 MB out of ") + (e.TotalBytes / 1024d / 1024d).ToString("0.000 MB");
 }
Example #30
0
 protected override void OnDownloadProgressChanged(DownloadProgressChangedEventArgs e)
 {
     if (progress != null)
         progress(e);
 }
Example #31
0
        /// <summary>Updates the UI when the download progress has changed.</summary>
        /// <param name="e">The DownloadProgress data.</param>
        void DownloadProgressChanged(DownloadProgressChangedEventArgs e)
        {
            if (Core.IsReconnect)
            {
                Core.Instance.UpdateAction = UpdateAction.Downloading;
                Core.IsReconnect = false;
            }

            if (e.BytesTotal > 0 && e.BytesTransferred > 0)
            {
                if (e.BytesTotal == e.BytesTransferred)
                {
                    return;
                }

                ulong progress = e.BytesTransferred * 100 / e.BytesTotal;
                App.TaskBar.ProgressState = TaskbarItemProgressState.Normal;
                App.TaskBar.ProgressValue = Convert.ToDouble(progress) / 100;
                this.tbStatus.Text = string.Format(
                    CultureInfo.CurrentCulture,
                    Properties.Resources.DownloadPercentProgress,
                    Utilities.ConvertFileSize(e.BytesTotal),
                    progress.ToString("F0", CultureInfo.CurrentCulture));
            }
            else
            {
                App.TaskBar.ProgressState = TaskbarItemProgressState.Indeterminate;
                this.tbStatus.Text = string.Format(
                    CultureInfo.CurrentCulture, Properties.Resources.DownloadProgress, e.FilesTransferred, e.FilesTotal);
            }
        }
 protected virtual void OnProgressChanged(DownloadProgressChangedEventArgs e)
 {
     var handler = ProgressChanged;
     if (handler != null)
     {
         handler(this, e);
     }
 }
Example #33
0
 /// <summary>Updates the UI when the download progress has changed.</summary>
 /// <param name="sender">The object that called the event.</param>
 /// <param name="e">The <c>SevenUpdate.DownloadProgressChangedEventArgs</c> instance containing the event data.</param>
 void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (!this.Dispatcher.CheckAccess())
     {
         this.Dispatcher.BeginInvoke(this.DownloadProgressChanged, e);
     }
     else
     {
         this.DownloadProgressChanged(e);
     }
 }
 void UpdateProgressBar(object sender, DownloadProgressChangedEventArgs e)
 {
     double bytesIn = double.Parse(e.BytesReceived.ToString());
     double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
     double percentage = bytesIn / totalBytes * 100;
     richTextBox1.Text += dot + "Downloaded " + e.BytesReceived + " of " + e.TotalBytesToReceive + "\n";
     progressBar.Value = int.Parse(Math.Truncate(percentage).ToString());
 }
Example #35
0
 private void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     DownloadProgress.Value = e.ProgressPercentage;
 }