private async void Button_Click(object sender, RoutedEventArgs e) { if (this.textTonameInfo.Text == "" || this.textToaccountInfo.Text == "" || this.textMoneyInfo.Text == "") { rootPage.ShowMessage("Please fill out the information"); return; } TransferInfoData data = new TransferInfoData(); data.payAccount = this.activeAccount.accountNO; data.receiveAccount = this.textToaccountInfo.Text; data.receiveAccountName = this.textTonameInfo.Text; data.payMoney = this.textMoneyInfo.Text; LoginHelp loginHelp = new LoginHelp(this.activeAccount); if (this.activeAccount.UsesPassport) { bool rev = await loginHelp.SignInPassport(); if (rev) { this.Frame.Navigate(typeof(TransferInfo),data); this.clearInfo(); } } else { bool rev = await loginHelp.CreatePassportKey(this.activeAccount.Name); if (rev) { this.Frame.Navigate(typeof(TransferInfo), data); this.clearInfo(); } } }
/// <summary> /// The function that will be called when this frame is navigated to. /// /// Checks to see if Microsoft Passport is available and checks to see if an /// account was passed in. /// /// If an account was passed, check if it uses Microsoft Passport. /// and set the "adding user" flag so we don't add a new account /// to the list of users. /// </summary> /// <param name="e"></param> protected async override void OnNavigatedTo(NavigationEventArgs e) { rootPage = MainPage.Current; if (e.Parameter != null) { m_account = (Account)e.Parameter; textbox_Username.Text = m_account.Email; textbox_Username.IsEnabled = false; if (this.m_account.UsesPassport) { LoginHelp loginHelp = new LoginHelp(this.m_account); bool rev = await loginHelp.SignInPassport(); if (rev) { this.Frame.Navigate(typeof(AccountDetails), this.m_account); } } } var accountList = await AccountsHelper.LoadAccountList(); if (accountList.Count > 1) { this.btnSelectUser.Visibility = Visibility.Visible; } else { this.btnSelectUser.Visibility = Visibility.Collapsed; } }
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 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); } }
/// <summary> /// Function called when regular username/password sign in button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void Button_SignIn_Click(object sender, RoutedEventArgs e) { if (this.textbox_Username.Text == string.Empty || this.passwordbox_Password.Password == string.Empty) { this.textblock_ErrorField.Visibility = Visibility.Visible; return; } else { this.textblock_ErrorField.Visibility = Visibility.Collapsed; } bool isNewAccount = false; if (this.m_account == null) { this.m_account = new Account() { head = "Assets/head.png", Name = this.textbox_Username.Text, Email = this.textbox_Username.Text, loginCount = 0, UsesPassport = false, isAdd = false }; isNewAccount = true; } LoginHelp loginHelp = new LoginHelp(this.m_account); bool rev = await loginHelp.SignInPassword(isNewAccount); if (rev) { //Checks to see if Passport is ready to be used. //1. Having a connected MSA Account //2. Having a Windows PIN set up for that account on the local machine var keyCredentialAvailable = await KeyCredentialManager.IsSupportedAsync(); if (!this.m_account.UsesPassport && keyCredentialAvailable) { this.Frame.Navigate(typeof(SelecteHello), this.m_account); return; } this.Frame.Navigate(typeof(AccountDetails), this.m_account); } else { rootPage.ShowMessage("SignIn Failure"); } }
private async void btnQueue_Click(object sender, RoutedEventArgs e) { LoginHelp loginHelp = new LoginHelp(this.activeAccount); if (this.activeAccount.UsesPassport) { bool rev = await loginHelp.SignInPassport(); if (rev) { this.listBill.Visibility = Visibility.Visible; } } else { bool rev = await loginHelp.CreatePassportKey(this.activeAccount.Name); if (rev) { this.listBill.Visibility = Visibility.Visible; } } }
private async void Button_Click(object sender, RoutedEventArgs e) { if (this.textTonameInfo.Text == "" || this.textToaccountInfo.Text == "" || this.textMoneyInfo.Text == "") { rootPage.ShowMessage("Please fill out the information"); return; } TransferInfoData data = new TransferInfoData(); data.payAccount = this.activeAccount.accountNO; data.receiveAccount = this.textToaccountInfo.Text; data.receiveAccountName = this.textTonameInfo.Text; data.payMoney = this.textMoneyInfo.Text; LoginHelp loginHelp = new LoginHelp(this.activeAccount); if (this.activeAccount.UsesPassport) { bool rev = await loginHelp.SignInPassport(); if (rev) { this.Frame.Navigate(typeof(TransferInfo), data); this.clearInfo(); } } else { bool rev = await loginHelp.CreatePassportKey(this.activeAccount.Name); if (rev) { this.Frame.Navigate(typeof(TransferInfo), data); this.clearInfo(); } } }