title: Thread-safe events - is this a "clean" way?
body: <p>I stumbled over some code in a professional library and am uncertain if this is a clean way to handle cross-thread event calls.</p>
  
  <p>The code below is in a forms application. Thread calls are made from a class that itself starts a new thread and receives messages:</p>
  
  <pre><code>private void Library_StatusChanged(object sender, AbstractTestCase.StatusChangedEventArgs e)
  {
      if (this.InvokeRequired)
      {
          this.lblProgress.Invoke((MethodInvoker)delegate ()
          {
              lblProgress.Text = "Current state: " + e.Step;
              lblProgress.Refresh();
          }
          );
  
          this.pbProgess.Invoke((MethodInvoker)delegate ()
          {
              pbProgess.Value = e.Percentage;
              pbProgess.Refresh();
          });
  
          this.lstStatus.Invoke((MethodInvoker)delegate ()
          {
              lstStatus.Items.Add("    " + e.Step);
              lstStatus.Refresh();
  
          });
  
          this.Invoke((MethodInvoker)delegate ()
          {
              this.Refresh();
          });
      }
      else
      {
          lblProgress.Text = "Current state:" + e.Step;
          lblProgress.Refresh();
  
          pbProgess.Value = e.Percentage;
          pbProgess.Refresh();
  
          lstStatus.Items.Add("    " + e.Step);
          lstStatus.Refresh();
  
          this.Refresh();
      }
  
      Application.DoEvents();
  }
  </code></pre>
  
  <p>Is this "state of the art"? In my opinion it's a little messy?!</p>