c# form uygulamasında aynı anda birden fazla dosya indirmeye çalışıyorum. Aşağıdaki kod biri bittikten sonra diğeri başlayarak indirme yapıyor. Aynı anda birden fazla indirme yapmak için ne yapabilirim?
private void btnStartDownload_Click(object sender, EventArgs e)
{
WebClient client = new WebClient();
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
// Starts the download
client.DownloadFileAsync(new Uri("SomeURLToFile"), "SomePlaceOnLocalHardDrive");
btnStartDownload.Text = "Download In Process";
btnStartDownload.Enabled = false;
}void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
double bytesIn = double.Parse(e.BytesReceived.ToString());
double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
double percentage = bytesIn / totalBytes * 100;
progressBar1.Value = int.Parse(Math.Truncate(percentage).ToString());
}void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show("Download Completed");
btnStartDownload.Text = "Start Download";
btnStartDownload.Enabled = true;
}