Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
- {
- richTextBox1.Invoke(new Action(delegate () { richTextBox1.Text += "Downloading file: "; }));
- Task task = new Task (() => {
- WebClient client = new WebClient();
- Console.WriteLine("Down");
- client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
- client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
- client.DownloadFileAsync(new Uri("http://distro.ibiblio.org/damnsmall/current/dsl-4.4.10-syslinux.iso"), @"E:\dls.iso");
- while(client.IsBusy);
- });
- task.RunSynchronously();
- richTextBox1.Invoke(new Action(delegate () { richTextBox1.Text += "DONE "+Environment.NewLine; }));
Advertisement
Add Comment
Please, Sign In to add comment