title: BackgroundWorker track method from another class
body: <p><strong>[EDIT]</strong></p>
  
  <p>I edited my question with complete code and explanation and hope something can give me clearer explanation.</p>
  
  <p>I have the following Class that has a backgroundworker to track the percentage progress of a loop and update the percentage progress on a Label on ProgressWin's XAML. The following code works perfectly. (My question is far below, after the code.)</p>
  
  <pre><code>public partial class ProgressWin : Window
  {
      BackgroundWorker backgroundWorker1 = new BackgroundWorker();
  
      public ProgressWin()
      {
          InitializeComponent();
          InitializeBackgroundWorker();
          startAsync();
      }
  
      // Set up the BackgroundWorker object by 
      // attaching event handlers. 
      private void InitializeBackgroundWorker()
      {
          backgroundWorker1.WorkerReportsProgress = true;
          backgroundWorker1.WorkerSupportsCancellation = true;
          backgroundWorker1.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
          backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
          backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
      }
  
      private void startAsync()
      {
          backgroundWorker1.RunWorkerAsync();
      }
  
      public void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
      {
          BackgroundWorker worker = sender as BackgroundWorker;
  
          for (int i = 1; i &lt;= 10; i++)
          {
              System.Threading.Thread.Sleep(500);
              worker.ReportProgress(i * 10);
          }
      }
  
      // This event handler updates the progress.
      public void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
      {
          label1.Content = (e.ProgressPercentage.ToString() + "%");
      }
  
      // This event handler deals with the results of the background operation.
      public void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
      {
           resultLabel.Content = "Done!";
      }
  }
  </code></pre>
  
  <p>Here comes my problem, now instead of tracking the loop within the ProgressWin, I need to track the loop in my MainWindow:</p>
  
  <pre><code>public partial class MainWindow : Window
  {
      public MainWindow()
      {
          InitializeComponent();
  
          for (int i = 1; i &lt;= 10; i++)
          {
              System.Threading.Thread.Sleep(500);
              ????.ReportProgress(i * 10);
          }
      }
  }
  </code></pre>
  
  <p>And I have no idea where to go from here. I tried instantiating an object from ProgressWin and call the DoWork but I end up frozen the ProgressWin window.</p>