private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(viewModel.IsLoggedIn): //When the first screen of the app is launched after user has logged in, initialize the processor that manages connection to OBD Device and to the IOT Hub Services.OBDDataProcessor.GetProcessor().Initialize(ViewModel.ViewModelBase.StoreManager); SplitViewShell shell = new SplitViewShell(this.Frame); Window.Current.Content = shell; shell.SetTitle("CURRENT TRIP"); Frame.Navigate(typeof (CurrentTripView)); break; } }
private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(viewModel.IsLoggedIn): //When the first screen of the app is launched after user has logged in, initialize the processor that manages connection to OBD Device and to the IOT Hub Services.OBDDataProcessor.GetProcessor().Initialize(ViewModel.ViewModelBase.StoreManager); SplitViewShell shell = new SplitViewShell(this.Frame); Window.Current.Content = shell; shell.SetTitle("CURRENT TRIP"); Frame.Navigate(typeof(CurrentTripView)); break; } }
/// <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) { SplitViewShell shell = Window.Current.Content as SplitViewShell; // Do not repeat app initialization when the Window is already present, // just ensure that the window is active if (shell == null) { // Create a Frame to act as the navigation context and navigate to the first page Frame rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; //Register platform specific implementations of shared interfaces ServiceLocator.Instance.Add<IAuthentication, Authentication>(); ServiceLocator.Instance.Add<Utils.Interfaces.ILogger, PlatformLogger>(); ServiceLocator.Instance.Add<IOBDDevice, OBDDevice>(); if (Settings.Current.IsLoggedIn) { //When the first screen of the app is launched after user has logged in, initialize the processor that manages connection to OBD Device and to the IOT Hub MyDriving.Services.OBDDataProcessor.GetProcessor().Initialize(ViewModel.ViewModelBase.StoreManager); // Create the shell and set it to current trip shell = new SplitViewShell(rootFrame); shell.SetTitle("CURRENT TRIP"); shell.SetSelectedPage("CURRENT TRIP"); rootFrame.Navigate(typeof(CurrentTripView), e.Arguments); Window.Current.Content = shell; } else if (Settings.Current.FirstRun) { rootFrame.Navigate(typeof(GetStarted1), e.Arguments); Window.Current.Content = rootFrame; } else { rootFrame.Navigate(typeof(LoginView), e.Arguments); Window.Current.Content = rootFrame; } } // Ensure the current window is active Window.Current.Activate(); }