title: Any way to circumvent "Dialogs must be user-initiated" exception?
body: <p>My app has a 'open file' button. Before launching the OpenFileDialog, it asks whether the user wants to save the current file, and if they do, it launches a SaveFileDialog. It then launches the OpenFileDialog. Pretty standard stuff.</p>
  
  <p>My problem is that silverlight then sees the OpenFileDialog.ShowDialog() method as not user-initiated, and I get a SecurityException. </p>
  
  <p>Is there any known reasonable way to avoid this exception? Surely this is a pretty standard scenario?</p>
  
  <p>The app is within a browser.</p>
  
  <p>Any ideas welcome</p>
  
  <p>EDIT:</p>
  
  <p>Sorry, not allowed to release actual code :( The logic is pretty simple though: In psuedocode the 'OpenFile" button press event calls a method something like:</p>
  
  <p>*Launch a new SL message asking whether to save first.</p>
  
  <p>*On message window yes/no clicked:
  -If No, Go to Load
  -If Yes, Launch SaveFileDialog.ShowDialog(), go to Load</p>
  
  <p>*Load:
  Launch An Open File Dialog</p>
  
  <p>EDIT 2:
  Mini programme...</p>
  
  <p>XML content for the main page:</p>
  
  <pre><code>&lt;Grid x:Name="LayoutRoot" Background="White"&gt;
      &lt;Button Content="Open" Click="Button_Click"/&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>using System.Windows;
  using System.Windows.Controls;
  
  namespace SilverlightApplication15
  {
  public partial class MainPage : UserControl
  {
      AskWindow aw = new AskWindow();
  
      public MainPage()
      {
          InitializeComponent();
          aw.Closed += new System.EventHandler(aw_Closed);
      }
  
      private void Button_Click(object sender, RoutedEventArgs e)
      {
          aw.Show();
      }
  
      private void aw_Closed(object sender, System.EventArgs e)
      {
          if (aw.DialogResult == true)
          {
              SaveFileDialog svd = new SaveFileDialog();
              svd.ShowDialog();
          }
  
  
          OpenFileDialog ofd = new OpenFileDialog();
          ofd.ShowDialog();//Causes security exception
      }
  }
  
  public class AskWindow : ChildWindow
  {
      public AskWindow()
      {
          Button b = new System.Windows.Controls.Button();
          b.Click += new System.Windows.RoutedEventHandler(b_Click);
          b.Content = "Yes, save it";
          this.Content = b;
      }
  
      private void b_Click(object sender, System.Windows.RoutedEventArgs e)
      {
          this.DialogResult = true;
      }
  }
  }
  </code></pre>