Properly Reacting to PreviousExecutionState

You can see the proper pattern for handling launch by looking at the OnLaunched implementation in a Visual Studio-generated App.xaml.cs file:

protected override void OnLaunched(LaunchActivatedEventArgs args) { #if DEBUG   if (System.Diagnostics.Debugger.IsAttached)   {     this.DebugSettings.EnableFrameRateCounter = true;   } #endif   Frame rootFrame = Window.Current.Content as Frame;   // Do not repeat app initialization when the Window already has content,   // just ensure that the window is active   if (rootFrame == null)   {     // Create a Frame and navigate to the first page     var rootFrame = new Frame();     // TODO: change this value to a cache size     // ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.