title: Async ShowDialog
body: <p>I'm using async/await to asynchronously load my data from database and during the loading process, I want to popup a loading form, it's just a simple form with running progress bar to indicate that there's a running process. After data has been loaded, the dialog will automatically be closed. How can I achieve that ? Below is my current code: </p>
  
  <pre><code> protected async void LoadData() 
      {
         ProgressForm _progress = new ProgressForm();  
         _progress.ShowDialog()  // not working
         var data = await GetData();          
         _progress.Close();
      }
  </code></pre>
  
  <p><strong>Updated:</strong></p>
  
  <p>I managed to get it working by changing the code:</p>
  
  <pre><code> protected async void LoadData() 
          {
             ProgressForm _progress = new ProgressForm();  
             _progress.BeginInvoke(new System.Action(()=&gt;_progress.ShowDialog()));
             var data = await GetData();          
             _progress.Close();
          }
  </code></pre>
  
  <p>Is this the correct way or there's any better ways ? </p>
  
  <p>Thanks for your help.</p>