/// <summary> /// Creates the new account from the information in the form. /// </summary> public void CreateAccount(object passwordEntry) { // Create the account of the appropriate manual/automatic type Account newAccount; if (CanCreateManualAccount()) { newAccount = CreateManualAccount(); } else if (CanCreateAutomaticAccount(passwordEntry)) { // Create the automatic account newAccount = CreateAutomaticAccount(passwordEntry); } else { return; // Unreachable } var locator = new ViewModelLocator(); // Update accounts on accounts view locator.Accounts.UpdateAccounts(); // Set selected locator.Accounts.SelectedAccount = newAccount; // Transition back to accounts view _modernNavigationService.NavigateTo(nameof(ViewModelLocator.Accounts)); // Do not allow navigation back to add account screen _modernNavigationService.ClearNavigationHistory(); }
/// <summary> /// Progresses from the welcome screen on to the accounts screen and positions to add account /// </summary> public void GetStarted() { // Transition view to add account _modernNavigationService.NavigateTo(nameof(ViewModelLocator.AddAccount)); // Do not allow navigation back to welcome screen _modernNavigationService.ClearNavigationHistory(); }
/// <summary> /// Async wrapper for database init followed by proper page transition /// </summary> private async void AsyncInit() { // Initialize database await Task.Run(() => DataService.Initialize()); // If there are accounts, start in the accounts view using (var dataService = new DataService()) { if (dataService.AnyExistingAccounts()) { _modernNavigationService.NavigateTo(nameof(ViewModelLocator.Accounts)); } else { // No existing accounts, show welcome screen _modernNavigationService.NavigateTo(nameof(ViewModelLocator.Welcome)); } } //prevent the user from navigating to this point or further back _modernNavigationService.ClearNavigationHistory(); }