title: How to 'await' raising an EventHandler event
body: <p>Sometimes the event pattern is used to raise events in MVVM applications by or a child viewmodel to send a message to its parent viewmodel in a loosely coupled way like this. </p>
  
  <p><strong>Parent ViewModel</strong></p>
  
  <pre><code>searchWidgetViewModel.SearchRequest += (s,e) =&gt; 
  {
      SearchOrders(searchWidgitViewModel.SearchCriteria);
  };
  </code></pre>
  
  <p><strong>SearchWidget ViewModel</strong></p>
  
  <pre><code>public event EventHandler SearchRequest;
  
  SearchCommand = new RelayCommand(() =&gt; {
  
      IsSearching = true;
      if (SearchRequest != null) 
      {
          SearchRequest(this, EventArgs.Empty);
      }
      IsSearching = false;
  });
  </code></pre>
  
  <hr>
  
  <p>In refactoring my application for .NET4.5 I am making as much as code possible to use <code>async</code> and <code>await</code>. However the following doesn't work (well I really wasn't expecting it to)</p>
  
  <pre><code> await SearchRequest(this, EventArgs.Empty);
  </code></pre>
  
  <p>The framework definitely does this to call event handlers <a href="http://www.i-programmer.info/programming/c/1514-async-await-and-the-ui-problem.html" rel="noreferrer">such as this</a>, but I'm not sure how it does it?</p>
  
  <pre><code>private async void button1_Click(object sender, RoutedEventArgs e)
  {
     textBlock1.Text = "Click Started";
     await DoWork();
     textBlock2.Text = "Click Finished";
  }
  </code></pre>
  
  <p>Anything I've found on the subject of raising events asynchrously <a href="http://msdn.microsoft.com/en-us/library/e7a34yad.aspx" rel="noreferrer">is</a> <a href="http://msdn.microsoft.com/en-us/library/wewwczdw.aspx" rel="noreferrer">ancient</a> but I can't find something in the framework to support this.</p>
  
  <p>How can I <code>await</code> the calling of an event but remain on the UI thread.</p>