title: Use AsyncTask for Downloading files and show the Progress in a Progress Bar
body: <p>I'm currently working on a small Mini-game. The Game has the ability to open some Options, in the Options you can click "Enable Music" for example. Because the Application would be too big including the Audio files, I want the User to choose if he wants Music, and has to Download it, or not. </p>
  
  <p>I'm using an Async-Task for this Option since the Options should Pop-Up while downloading, this is my Code so far:</p>
  
  <pre><code>        public void CheckForFiles()
      {
          // searches the current directory and sub directory
          int fCount = Directory.GetFiles(path, "*", SearchOption.AllDirectories).Length;
          //If there are NOT all of the Audiofiles, delete all of them and re-download!
          if (fCount != 2)
          {
              //Just to be sure, delete all previous files!
              Array.ForEach(Directory.GetFiles(@"C:\Users\Public\Documents\Ultimate Tic-Tac-Toe\Audios\"), File.Delete);
              //Change the Button from "Apply" to "Download"
              apply_options.Text = "Download";
              //Set the Warning Text
              warning_text.Text = "Warning! Downloading the needed Audiofiles. DO NOT interrupt the Proccess!";
              //SHow the Download-Progress Bar
              download_progress.Visible = true;
              //Download all
              WebClient webClient = new WebClient();
              webClient.DownloadProgressChanged += (s, y) =&gt;
              {
                  download_progress.Value = y.ProgressPercentage;
              };
              webClient.DownloadFileCompleted += (s, y) =&gt;
              {
                  download_progress.Visible = false;
                  warning_text.Text = "Complete!";
                  CheckForFiles();
              };
              webClient.DownloadFileAsync(new Uri(remoteUri_dark), fileName_dark);
              //Text = "Downloading File one of" + WAITLIST;
          }
  </code></pre>
  
  <p>This downloads one file, but I need two.
  So I tried to wait for my Progress-Bar to fill, download the next one, and if I have 2 Files, Finish! But the Code jumps right into "DownloadFileCompleted", so that does not work. I'm sitting at this for round about 2 hours now, fiddling around.</p>
  
  <p>How do I get the Async Task to create a "Que" of two files, download them and then jump to "DownloadFileCompleted" and still show the Progress? 
  Thank you!</p>