Esempio n. 1
0
        /// <summary>
        /// Handle DownloadProgressChanged event.
        /// </summary>
        void DownloadProgressChanged(object sender, HttpDownloadProgressChangedEventArgs e)
        {
            // Refresh the summary every second.
            if (DateTime.Now > lastNotificationTime.AddSeconds(1))
            {
                //lbSummary.Text = String.Format("Received: {0}KB, Total: {1}KB, Speed: {2}KB/s",
                //    e.ReceivedSize / 1024, e.TotalSize / 1024, e.DownloadSpeed / 1024);
                //for (int i = 0; i < lwDownloadInfo.Items.Count; i++)
                //{

                //    lwDownloadInfo.Items[i].SubItems[(int)ListViewColumn.Status].Text = client.Status.ToString();
                //    lwDownloadInfo.Items[i].SubItems[(int)ListViewColumn.Download].Text = String.Format("{0} KB", e.ReceivedSize / 1024);
                //    lwDownloadInfo.Items[i].SubItems[(int)ListViewColumn.Remaining].Text = String.Format("{0} KB", e.TotalSize / 1024 - e.ReceivedSize / 1024);
                //    lwDownloadInfo.Items[i].SubItems[(int)ListViewColumn.Size].Text = String.Format("{0} KB", e.TotalSize / 1024);
                //    lwDownloadInfo.Items[i].SubItems[(int)ListViewColumn.Speed].Text = String.Format("{0} KB", e.DownloadSpeed / 1024);
                //}

                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Status].Text    = clients[e.Index].Status.ToString();
                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Download].Text  = String.Format("{0} KB", e.ReceivedSize / 1024);
                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Remaining].Text = String.Format("{0} KB", e.TotalSize / 1024 - e.ReceivedSize / 1024);
                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Size].Text      = String.Format("{0} KB", e.TotalSize / 1024);
                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Speed].Text     = String.Format("{0} KB", e.DownloadSpeed / 1024);

                //prgDownload.Value = (int)(e.ReceivedSize * 100 / e.TotalSize);
                lastNotificationTime = DateTime.Now;
            }
        }
Esempio n. 2
0
 protected virtual void OnDownloadProgressChanged(HttpDownloadProgressChangedEventArgs e)
 {
     if (DownloadProgressChanged != null)
     {
         DownloadProgressChanged(this, e);
     }
 }
 protected virtual void OnDownloadProgressChanged(HttpDownloadProgressChangedEventArgs e)
 {
     if (DownloadProgressChanged != null)
     {
         DownloadProgressChanged(this, e);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Handle DownloadProgressChanged event.
        /// </summary>
        void DownloadProgressChanged(object sender, HttpDownloadProgressChangedEventArgs e)
        {
            // Refresh the summary every second.
            if (DateTime.Now > lastNotificationTime.AddSeconds(1))
            {
                //lbSummary.Text = String.Format("Received: {0}KB, Total: {1}KB, Speed: {2}KB/s",
                //    e.ReceivedSize / 1024, e.TotalSize / 1024, e.DownloadSpeed / 1024);
                //for (int i = 0; i < lwDownloadInfo.Items.Count; i++)
                //{

                //    lwDownloadInfo.Items[i].SubItems[(int)ListViewColumn.Status].Text = client.Status.ToString();
                //    lwDownloadInfo.Items[i].SubItems[(int)ListViewColumn.Download].Text = String.Format("{0} KB", e.ReceivedSize / 1024);
                //    lwDownloadInfo.Items[i].SubItems[(int)ListViewColumn.Remaining].Text = String.Format("{0} KB", e.TotalSize / 1024 - e.ReceivedSize / 1024);
                //    lwDownloadInfo.Items[i].SubItems[(int)ListViewColumn.Size].Text = String.Format("{0} KB", e.TotalSize / 1024);
                //    lwDownloadInfo.Items[i].SubItems[(int)ListViewColumn.Speed].Text = String.Format("{0} KB", e.DownloadSpeed / 1024);
                //}

                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Status].Text = clients[e.Index].Status.ToString();
                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Download].Text = String.Format("{0} KB", e.ReceivedSize / 1024);
                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Remaining].Text = String.Format("{0} KB", e.TotalSize / 1024 - e.ReceivedSize / 1024);
                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Size].Text = String.Format("{0} KB", e.TotalSize / 1024);
                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Speed].Text = String.Format("{0} KB", e.DownloadSpeed / 1024);

                //prgDownload.Value = (int)(e.ReceivedSize * 100 / e.TotalSize);
                lastNotificationTime = DateTime.Now;
            }
        }