protected override DependencyObject CreateShell() { Shell shell = new Shell(); shell.Show(); return shell; }
/// <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 DEBUG if (System.Diagnostics.Debugger.IsAttached) { // disabled, obscures the hamburger button, enable if you need it //this.DebugSettings.EnableFrameRateCounter = true; } #endif var shell = Window.Current.Content as Shell; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (shell == null) { // Create a Shell which navigates to the first page shell = new Shell(); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // set the Shell as content Window.Current.Content = shell; } // Ensure the current window is active Window.Current.Activate(); }
/// <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 DEBUG if (System.Diagnostics.Debugger.IsAttached) { // disabled, obscures the hamburger button, enable if you need it //this.DebugSettings.EnableFrameRateCounter = true; } #endif var shell = Window.Current.Content as Shell; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (shell == null) { // Create a Shell which navigates to the first page shell = new Shell(); // hook-up shell root frame navigation events shell.RootFrame.NavigationFailed += OnNavigationFailed; shell.RootFrame.Navigated += OnNavigated; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // set the Shell as content Window.Current.Content = shell; // listen for back button clicks (both soft- and hardware) SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested; if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { HardwareButtons.BackPressed += OnBackPressed; } UpdateBackButtonVisibility(); } // Ensure the current window is active Window.Current.Activate(); }