Invoked when the application is launched normally by the end user. Other entry points will be used such as when the application is launched to open a specific file. Details about the launch request and process.
(LaunchActivatedEventArgs e)
| 51 | /// </summary> |
| 52 | /// <param name="e">Details about the launch request and process.</param> |
| 53 | protected override void OnLaunched(LaunchActivatedEventArgs e) |
| 54 | { |
| 55 | Frame rootFrame = Window.Current.Content as Frame; |
| 56 | |
| 57 | // Do not repeat app initialization when the Window already has content, |
| 58 | // just ensure that the window is active |
| 59 | if (rootFrame == null) |
| 60 | { |
| 61 | // Create a Frame to act as the navigation context and navigate to the first page |
| 62 | rootFrame = new Frame(); |
| 63 | |
| 64 | rootFrame.NavigationFailed += OnNavigationFailed; |
| 65 | |
| 66 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) |
| 67 | { |
| 68 | //TODO: Load state from previously suspended application |
| 69 | } |
| 70 | |
| 71 | // Place the frame in the current Window |
| 72 | Window.Current.Content = rootFrame; |
| 73 | } |
| 74 | |
| 75 | if (e.PrelaunchActivated == false) |
| 76 | { |
| 77 | if (rootFrame.Content == null) |
| 78 | { |
| 79 | // When the navigation stack isn't restored navigate to the first page, |
| 80 | // configuring the new page by passing required information as a navigation |
| 81 | // parameter |
| 82 | rootFrame.Navigate(typeof(MainPage), e.Arguments); |
| 83 | } |
| 84 | // Ensure the current window is active |
| 85 | Window.Current.Activate(); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | /// <summary> |
| 90 | /// Invoked when Navigation to a certain page fails |
nothing calls this directly
no outgoing calls
no test coverage detected