/// <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 async void OnLaunched(LaunchActivatedEventArgs e) { var shell = Window.Current.Content as AppShell; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (shell == null) { // Create a AppShell to act as the navigation context and navigate to the first page shell = new AppShell {Language = ApplicationLanguages.Languages[0]}; shell.MyAppFrame.NavigationFailed += OnNavigationFailed; } // Place our app shell in the current Window Window.Current.Content = shell; ApplicationLanguages.PrimaryLanguageOverride = GlobalizationPreferences.Languages[0]; if (shell.MyAppFrame.Content == null) { // When the navigation stack isn't restored, navigate to the first page // suppressing the initial entrance animation. var setup = new Setup(shell.MyAppFrame); setup.Initialize(); var start = Mvx.Resolve<IMvxAppStart>(); start.Start(); shell.ViewModel = Mvx.Resolve<MenuViewModel>(); } new TileHelper().DoNavigation(string.IsNullOrEmpty(e.Arguments) ? e.TileId : e.Arguments); await new BackgroundTaskService().RegisterTasksAsync(); OverrideTitleBarColor(); //If Jump Lists are supported, adds them if (ApiInformation.IsTypePresent("Windows.UI.StartScreen.JumpList")) { SetJumplist(); } CallRateReminder(); // Ensure the current window is active Window.Current.Activate(); }
/// <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 AppShell() { InitializeComponent(); Loaded += (sender, args) => { Current = this; TogglePaneButton.Focus(FocusState.Programmatic); }; var currentView = SystemNavigationManager.GetForCurrentView(); currentView.BackRequested += SystemNavigationManager_BackRequested; NavMenuListTop.ItemsSource = navlistTop; NavMenuListBottom.ItemsSource = navlistBottom; //start with the "accounts" navigation button selected NavMenuListTop.SelectedIndex = 0; //start with a hidden back button. This changes when you navigate to an other page currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; }
public LoginView() { InitializeComponent(); appShell = Window.Current.Content as AppShell; appShell?.SetLoginView(); }