title: WPF C# Application I get 2 main windows
body: <p>I am really new to WPF and c#, and have some questions about how the applications are initialized.  I am going through some tutorials on LINQ classes in the hopes that I can bind all of my SQL Server data with observableCollections.</p>
  
  <p>One of the examples I found has a start like so (in the App.xaml.cs file):</p>
  
  <pre><code>public partial class App : Application
  {
      protected override void OnStartup(StartupEventArgs e)
      {
          base.OnStartup(e);
  
          MainWindow app = new MainWindow();
          ProductViewModel context = new ProductViewModel();
          app.DataContext = context;
          app.Show();
      }
  }
  </code></pre>
  
  <p>When I run the application I get 2 main windows.  The commands above execute and open the first one, but then a second one gets called from some system code which I can't see (I can see in dissasembler, but that does not really help).  So it seems that the application that VS set up for me has a standard entry, but the sample code (from Rachel Lim) does not do this.  I have searched for differences in various files (like App.g.i.cs which has the void Main() call) and both my application and the sample are the same.  I am trying to "take control" of the application to handle creating my observablecollections with the LINQ classes.  Is anyone familiar enough with VS and C# to give me some hints on what might be happening?</p>