private async void BtnStart_Click(object sender, RoutedEventArgs e) { //Create Passport LoginHelp loginHelp = new LoginHelp(this.activeAccount); bool rev = await loginHelp.CreatePassportKey(this.activeAccount.Name); if (rev) { //add possport to server. bool serverAddedPassportToAccount = await loginHelp.AddPassportToAccountOnServer(); if (serverAddedPassportToAccount == true) { //update userPassport state this.activeAccount.UsesPassport = true; foreach (Account a in UserSelect.accountList) { if (a.Email == this.activeAccount.Email) { UserSelect.accountList.Remove(a); break; } } UserSelect.accountList.Add(this.activeAccount); AccountsHelper.SaveAccountList(UserSelect.accountList); } this.Frame.Navigate(typeof(AccountDetails), this.activeAccount); } }
private void updateAccount() { //find current account and update foreach (Account a in UserSelect.accountList) { if (a.Email == this.activeAccount.Email) { UserSelect.accountList.Remove(a); break; } } UserSelect.accountList.Add(this.activeAccount); AccountsHelper.SaveAccountList(UserSelect.accountList); }
/// <summary> /// Handles user saving for our list of users if this is a new user /// </summary> private void SuccessfulSignIn(bool isAdd) { // If this is an already existing account, replace the old // version of this account in the account list. if (isAdd == false) { foreach (Account a in UserSelect.accountList) { if (a.Email == this.activeAccount.Email) { UserSelect.accountList.Remove(a); break; } } } UserSelect.accountList.Add(this.activeAccount); AccountsHelper.SaveAccountList(UserSelect.accountList); }
private void btnClearAccount_Click(object sender, RoutedEventArgs e) { UserSelect.accountList.Clear(); AccountsHelper.SaveAccountList(UserSelect.accountList); rootPage.ShowMessage("Clear Account Success."); }