/// <summary> /// 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. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { if (ApplicationData.Current.LocalSettings.Values.ContainsKey(StoredAccountKey)) { ActivationService.Initalise(); // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (!(Window.Current.Content is AppShell shell)) { // Create a AppShell to act as the navigation context and navigate to the first page shell = new AppShell(); shell.AppFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //ApplicationData.Current.LocalSettings.Values["PreviouslyLaunched"] = false; //TODO: Load state from previously suspended application } } // Place our app shell in the current Window Window.Current.Content = shell; if (shell.AppFrame.Content == null) { shell.AppFrame.Navigate(typeof(Views.Overview.MainPage)); } } else { if (!(Window.Current.Content is Frame rootFrame)) { rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { rootFrame.Navigate(typeof(Views.SignIn.MainPage), e.Arguments); } } } // Ensure the current window is active Window.Current.Activate(); }