title: C# UWP closing application multiple views
body: <p>I have a UWP app that dynamically creates another view. But, the problem is when I close the first window, the second still stays on.</p>
  
  <p>With this code I am creating new view:</p>
  
  <pre><code>        CoreApplicationView newView = CoreApplication.CreateNewView();
          int newViewId = 0;
          await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =&gt;
          {
              Frame frame = new Frame();
              frame.Navigate(typeof(SecondPage), null);
              Window.Current.Content = frame;
              // You have to activate the window in order to show it later.
              Window.Current.Activate();
  
              newViewId = ApplicationView.GetForCurrentView().Id;
          });
          bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
  </code></pre>
  
  <p>How to close the application when user close the first window?</p>