title: Open new window after first
body: <p>How can this be done </p>
  
  <p>Login window appears first and if every thing is fine just close login window and open second Main window.
  in win forms we modify program.cs but in wpf there is no program.cs.</p>
  
  <p>Any solutions.?</p>
  
  <p>Actully i did most of the work in the window that is created By default and now want to make it secondary(mean it should appear and then close when wanted giving control to new window)</p>
  
  <pre><code>   &lt;Application x:Class="DevnMark_V1._0.App"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               Startup="Application_Startup"&gt;
  
      &lt;Application.Resources&gt;
  
      &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  
  
  
   public partial class App : Application
      {
          private void Application_Startup(object sender, StartupEventArgs e)
          {
              var login = new MainWindow();
              login.ShowDialog();
              if (myAppSett.Default.validated == true)
              {
              var mainWindow = new DevNMarkMainWindow();              
                  mainWindow.ShowDialog();
              }
          }
  </code></pre>
  
  <p>Login Window start XML</p>
  
  <pre><code>&lt;Window x:Class="DevnMark_V1._0.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
          xmlns:local="clr-namespace:Progress"
          Title="MainWindow" Height="292" Width="563" WindowStyle="None" BorderBrush="#FF0A6277" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Topmost="True"&gt;
  </code></pre>
  
  <p>Exception occurs when i close Login window and occurs at point  <code>InitializeComponent();</code>of second window when it is viewed when it is going to be initilized</p>