title: Returning the client_DownloadProgressChanged event from another class
body: <p>I'm trying to make a class with a downloader that I can keep reusing so I don't get a enormous code after a while. But I can't seem to return the <code>client_DownloadProgressChanged</code> event. This is the code I have right now:</p>
  
  <pre><code>public static string progress;
      public static int percent;
      static WebClient client = new WebClient();
      /// &lt;summary&gt;
      /// Download a file from the internet
      /// &lt;/summary&gt;
      /// &lt;param name="url"&gt;The URL to download from&lt;/param&gt;
      /// &lt;param name="path"&gt;The path to save to don't forget the / at the end&lt;/param&gt;
      /// &lt;param name="filename"&gt;The filename of the file that is going to be download&lt;/param&gt;
      public static string DownloadFile(string url, string path, string filename)
      {
          try
          {
              Thread bgThread = new Thread(() =&gt;
                                               {
                                                   client.DownloadProgressChanged += client_DownloadProgressChanged;
                                                   client.DownloadFileCompleted += client_DownloadFileCompleted;
                                                   client.DownloadFileAsync(new Uri(url), path + filename);
                                               });
              bgThread.Start();
          }
          catch (Exception e)
          {
              Console.WriteLine(e.ToString());
          };
          return progress;
      }
  
      static void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
      {
          double bytesIn = double.Parse(e.BytesReceived.ToString(CultureInfo.InvariantCulture));
          double totalBytes = double.Parse(e.TotalBytesToReceive.ToString(CultureInfo.InvariantCulture));
          double percentage = bytesIn/totalBytes*100;
          progress = "Downloaded " + e.BytesReceived + " of " + e.TotalBytesToReceive;
          percent = int.Parse(Math.Truncate(percentage).ToString(CultureInfo.InvariantCulture));
          while (client.IsBusy)
          {
              return progress;
          }
      }
  </code></pre>