private async Task CreateRootFrame(ApplicationExecutionState executionState, string args) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif Root = Window.Current.Content as MainFrame; //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 to act as the navigation context and navigate to the first page Root = new MainFrame(); // Place the frame in the current Window Window.Current.Content = Root; await Root.EnsureLoadedAsync; RootFrame = Root.RootFrame; RootFrame.CacheSize = 6; RootFrame.NavigationFailed += OnNavigationFailed; NavigationService.SetFrame(RootFrame); // Register this frame with the suspension manager SuspensionManager.RegisterFrame(RootFrame, "appFrame"); if (executionState == ApplicationExecutionState.Terminated) { // Attempt to restore the navigation state if the application was terminated try { await SuspensionManager.RestoreAsync(); await SuspensionManager.DeleteSavedStatesAsync(); } catch (Exception) { } } //Window.Current.Content = rootFrame; } if (RootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter NavigationService.Navigate(typeof(HomePage), args); //RootFrame.Navigate(typeof(HomePage), args); } // Ensure the current window is active Window.Current.Activate(); if (DeviceInformation.Instance.IsPhone) { var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView(); if (statusBar != null) { statusBar.BackgroundOpacity = 1; statusBar.BackgroundColor = Windows.UI.Color.FromArgb(255, 244, 241, 234); statusBar.ForegroundColor = Windows.UI.Color.FromArgb(255, 51, 51, 51); } } else { SetTitleBar(); } }