title: How to run event handler on target thread
body: <p>Given the <strong>C#</strong> code example:</p>
  
  <pre><code>using System;
  using System.Threading;
  using System.Windows.Forms;
  
  public class MnFrm : Form
  {
     private void MnFrm_Load(Object sender, EventArgs e)
     {
        this.WorkCompleted += MnFrm_WorkCompleted;
     }
  
     private void btn_Click(Object sender, EventArgs e)
     {
        ThreadPool.QueueUserWorkItem(AsyncMethod);
     }
  
     private void MnFrm_WorkCompleted(Object sender, Boolean e)
     {
        MessageBox.Show("Work completed");
     }
  
     private void AsyncMethod(Object state)
     {
        // Do stuff
        Boolean result = true; // just as an example
        WorkCompleted?.Invoke(this, result);
     }
  
     private event EventHandler&lt;Boolean&gt; WorkCompleted;
  }
  </code></pre>
  
  <p>When the user clicks the button <code>btn</code> the method <code>AsyncMethod</code> is executed on another thread managed by the ThreadPool.  After some time the work is done and the result is posted back via another event.
  This event handler (<code>WorkCompleted</code>) executes on the thread used to run <code>AsyncMethod</code> because when the app is executed you get the 'Cross-Threading' exception.</p>
  
  <p>So the question is how to run the event handler <code>MnFrm_WorkCompleted</code> on the UI thread?</p>