When I am running my method to download a file, it is not waiting for the download to finish before calling the next method “unzipfiles”, how could I make it wait until the file is downloaded?
private void Download_Click(object sender, EventArgs e)
{
WebClient webClient = new WebClient();
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
webClient.DownloadFileAsync(new Uri("http://download1us.softpedia.com/dl/f4932a906a7dd98c7ff002b07e9bd94b/4e065004/100079174/software/portable/security/ccsetup307.zip"), @"ccsetup307.zip");
// Call unzip method
unzipfiles();
}
Call your
unzipfiles()method in DownloadFileCompleted event