Beispiel #1
0
 protected virtual void OnDownloadCompleted(HttpDownloadCompletedEventArgs e)
 {
     if (DownloadCompleted != null)
     {
         DownloadCompleted(this, e);
     }
 }
        /// <summary>
        /// Handle DownloadCompleted event.
        /// </summary>
        void DownloadCompleted(object sender, HttpDownloadCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                //lbSummary.Text =
                //    String.Format("Received: {0}KB, Total: {1}KB, Time: {2}:{3}:{4}",
                //    e.DownloadedSize / 1024, e.TotalSize / 1024, e.TotalTime.Hours,
                //    e.TotalTime.Minutes, e.TotalTime.Seconds);



                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", 0);
                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Remaining].Text = String.Format("{0} KB", e.TotalSize / 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", 0);


                if (File.Exists(tbPath[e.Index].Trim()))
                {
                    File.Delete(tbPath[e.Index].Trim());
                }

                File.Move(tbPath[e.Index].Trim() + ".tmp", tbPath[e.Index].Trim());
                //prgDownload.Value = 100;
            }
            else
            {
                //lbSummary.Text = e.Error.Message;
                if (File.Exists(tbPath[e.Index].Trim() + ".tmp"))
                {
                    File.Delete(tbPath[e.Index].Trim() + ".tmp");
                }
                //prgDownload.Value = 0;
            }
        }
 protected virtual void OnDownloadCompleted(HttpDownloadCompletedEventArgs e)
 {
     if (DownloadCompleted != null)
     {
         DownloadCompleted(this, e);
     }
 }
        /// <summary>
        /// Handle DownloadCompleted event.
        /// </summary>
        void DownloadCompleted(object sender, HttpDownloadCompletedEventArgs e)
        {
            if (e.Error == null)
            {

                //lbSummary.Text =
                //    String.Format("Received: {0}KB, Total: {1}KB, Time: {2}:{3}:{4}",
                //    e.DownloadedSize / 1024, e.TotalSize / 1024, e.TotalTime.Hours,
                //    e.TotalTime.Minutes, e.TotalTime.Seconds);



                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", 0);
                lwDownloadInfo.Items[e.Index].SubItems[(int)ListViewColumn.Remaining].Text = String.Format("{0} KB", e.TotalSize / 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", 0);


                if (File.Exists(tbPath[e.Index].Trim()))
                {
                    File.Delete(tbPath[e.Index].Trim());
                }

                File.Move(tbPath[e.Index].Trim() + ".tmp", tbPath[e.Index].Trim());
                //prgDownload.Value = 100;
            }
            else
            {
                //lbSummary.Text = e.Error.Message;
                if (File.Exists(tbPath[e.Index].Trim() + ".tmp"))
                {
                    File.Delete(tbPath[e.Index].Trim() + ".tmp");
                }
                //prgDownload.Value = 0;
            }

        }