title: C# : Show dialog on UI thread from another thread
body: <p>I'm new to C#, but i've done a lots of java. Here's my problem : I'm trying to open a "SaveFileDialog" from a thread that is not the UI thread.</p>
  
  <p>This is exactly what I try to do:</p>
  
  <pre><code>public partial class Form1: Form
  {
      public string AskSaveFile()
      {
          var sfd = new SaveFileDialog();
          sfd.Filter = "Fichiers txt (*.txt)|*.txt|Tous les fichiers (*.*)|*.*";
          sfd.FilterIndex = 1;
          sfd.RestoreDirectory = true;
          DialogResult result = (DialogResult) Invoke(new Action(() =&gt; sfd.ShowDialog(this)));
          if(result == DialogResult.OK)
          {
              return sfd.FileName;
          }
  
          return null;
      }
  }
  </code></pre>
  
  <p>This method will always be called from a thread different from the one who owns the Form. The problem is that when I execute this code, the "Form1" freeze and the "SaveFileDialog" doesn't show up.</p>
  
  <p>Do you have some clue to help me to show the dialog from an independant thread?</p>