private async void recoverPasswordButton_Click(object sender, EventArgs e) { string userName = this.userNameTextBox.Text.Trim(); if (userName == string.Empty) { MessageBox.Show("Please enter your user name to recover your password.", "Empty User Name text box", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.userNameTextBox.SelectAll(); this.userNameTextBox.Focus(); return; } loginFormLoadingCircle.Visible = true; string question = await Task.Run(() => bLogic.getSecurityQuestion(userName)); loginFormLoadingCircle.Visible = false; if (question == String.Empty) { MessageBox.Show("Invalid UserName, Please enter valid user name", "Invalid User Name", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.userNameTextBox.SelectAll(); this.userNameTextBox.Focus(); return; } RecoverForm recoverForm = new RecoverForm(question, userName, bLogic); recoverForm.FormClosed += new FormClosedEventHandler(event_FormClosed); recoverForm.Show(); this.Hide(); }
private async void recoverPasswordButton_Click(object sender, EventArgs e) { string userName = this.userNameTextBox.Text.Trim(); if (userName == string.Empty) { MessageBox.Show("Please enter your user name to recover your password.", "Empty User Name text box", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.userNameTextBox.SelectAll(); this.userNameTextBox.Focus(); return; } loginFormLoadingCircle.Visible = true; string question = await Task.Run(() => bLogic.getSecurityQuestion(userName)); loginFormLoadingCircle.Visible = false; if (question == String.Empty) { MessageBox.Show("Invalid UserName, Please enter valid user name", "Invalid User Name", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.userNameTextBox.SelectAll(); this.userNameTextBox.Focus(); return; } RecoverForm recoverForm = new RecoverForm(question, userName,bLogic); recoverForm.FormClosed += new FormClosedEventHandler(event_FormClosed); recoverForm.Show(); this.Hide(); }