Пример #1
0
        public void Progress1( DownloadState ds )
        {
            if ( ds.error != null )
             {
            label1.Text = ds.error.Status + "  "+ ds.error.Message;
            return;
             }

             progressBar1.Maximum = (int)ds.BufferRead.Length;
             progressBar1.Value = ds.bytesRead;
             label1.Text = ds.Progress().ToString();

             if ( ds.DataLeft() == 0 )
             {
            dw.Download(urlBox.Text, this, Progress2);
             }
        }
Пример #2
0
        public void Progress2( DownloadState ds )
        {
            if (ds.error != null)
             {
            label2.Text = ds.error.Status + "  " + ds.error.Message;
            return;
             }

             progressBar2.Maximum = (int)ds.BufferRead.Length;
             progressBar2.Value = ds.bytesRead;
             label2.Text = ds.Progress().ToString();

             if (ds.Progress() == 50)
             {
            ds.Abort();
             }
        }
Пример #3
0
 /// <summary>
 /// Progress callback, called when we've read another packet of data.
 /// It get's the GUIs thread and calls pd 
 /// </summary>
 private void Progress(ProgressDelegate pd, DownloadState ds)
 {
     if (this.InvokeRequired)
      {
     ProgressFormDelegate del = new ProgressFormDelegate(Progress);
     this.Invoke(del, new object[] { pd, ds });
      }
      else
      {
     pd(ds);
      }
 }