You can distinguish the different web clients with the sender parameter passed to your event handler.
But your code looks very bad.
Here some suggestions:
private WebClient StartDownloadFile(Uri source, string targetFilename)
{
WebClient wc = new WebClient();
wc.DownloadFileCompleted += DownloadFileCompleted;
wc.DownloadProgressChanged += DownloadProgressChanged;
wc.DownloadFileAsync(source, targetFilename);
return wc;
}
private Dictionary<string, WebClient> webClients = new Dictionary<string, WebClient>();
private void DownloadMultipleFiles(string[] sourceFiles)
{
for (int i = 0; i < sourceFiles.Length - 1; i++)
{
webClients[sourceFiles[i]] = StartDownloadFile(
new Uri(sourceFiles[i]), @"F:\test" + i + ".mp4");
rtbUrls.AppendText(sourceFiles[z]);
}
}
private void DownloadProgressChanged(object sender, EventArgs args)
{
WebClient wc = (WebClient)sender;
string url = webClients[wc];
}
BTW.:
If you want to display more progress details (e.g. average speed), you should read this article:
Copy a Stream with Progress Reporting[
^]