views:

75

answers:

1

Hello I am using this code to download multiple file. My problem is that it downloads them all at one time and what I want to do is have the progress bar show each file downloaded to 100% then go to the next file. I mean I want the first file to download and go to 100% in progress bar then the second one and start the progress bar again till 100% and so on. But in my code it just has one progressbar that shows the progress for all files being downloaded at once. How can I do this?

WebClient webClient = new WebClient();

            webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);

            webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged); //Progress Bar Handler

            webClient.DownloadFileAsync(new Uri("http://www.somesite.com/Update/Updates.zip.001"), @"Updates.zip.001");
            webClient.DownloadFileAsync(new Uri("http://www.somesite.com/Update/Updates.zip.002"), @"Updates.zip.002");
+1  A: 

You can start downloading the second file in the Completed handler for the first file.

However, you should stick with your current behavior; it's better to download both files at once.

SLaks
Wow that was fast maybe the fastest I ever had a reply. If its better to download all at once then why do I see updaters on games for example fame guard show each file as a separate 0 to 100% progress bar one after the other? Also why is it better not to do that? Can you show me how I could put that in my code because I have 10 files all together not just 2.
Jay
Also I dont think there is anything wrong with parallell downloading its just the effect I want. Am experimenting here.
Jay
Hey that was easy and works exactly. How logically sensible as well I cant believe I could not figure that out. Thank you for your guidance. I have a couple other conundrums I need help with so I am gonna make another post. Thank you thank you thank YOU!!!
Jay