/// <summary> /// Initializes a new instance of the AppShell, sets the static 'Current' reference, /// adds callbacks for Back requests and changes in the SplitView's DisplayMode, and /// provide the nav menu list with the data to display. /// </summary> public NavigationPage() { this.InitializeComponent(); this.Loaded += (sender, args) => { Current = this; this.TogglePaneButton.Focus(FocusState.Programmatic); }; this.RootSplitView.RegisterPropertyChangedCallback( SplitView.DisplayModeProperty, (s, a) => { // Ensure that we update the reported size of the TogglePaneButton when the SplitView's // DisplayMode changes. this.CheckTogglePaneButtonSizeChanged(); }); SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested; // If on a phone device that has hardware buttons then we hide the app's back button. //if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) //{ this.BackButton.Visibility = Visibility.Collapsed; //} NavMenuList.ItemsSource = navlist; this.highlightBtnTimer = new DispatcherTimer(); this.highlightBtnTimer.Tick += HighlightBtnTimer_Tick; this.highlightBtnTimer.Interval = new TimeSpan(HIGHLIGHT_BTN_TIMER_TICKS); }
/// <summary> /// Create a new navigation page and register it in the suspension manager. Language selection is also handled here. /// </summary> /// <returns></returns> private NavigationPage CreateNewNavigationPage() { // Create a navigation page to act as the navigation context and navigate to the first page NavigationPage shell = new NavigationPage(); shell.AppFrame.NavigationFailed += OnNavigationFailed; // Register the Frame in navigation page to suspension manager SuspensionManager.RegisterFrame(shell.AppFrame); AppEventSource.Log.Debug("App: AppFrame registered in suspension manager."); // Set the default language shell.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; return shell; }