// Initialize Window and assign variables public LoginWindow(MainWindow mainWindow) { InitializeComponent(); _mainWindow = mainWindow; UserNameTextBox.Focus(); // Auto Login _useAdminCreds = false; if (_useAdminCreds) { UserNameTextBox.Text = "Admin"; PasswordTextBox.Text = "Passw0rd"; } }
private bool IsValid() { if (UserNameTextBox.Text.Trim() == string.Empty) { MessageBox.Show("User Name is required!", "Form validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserNameTextBox.Focus(); return(false); } if (PasswordTextBox.Text.Trim() == string.Empty) { MessageBox.Show("Password is required!", "Form validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); PasswordTextBox.Focus(); return(false); } return(true); }
private void AfterRegistration(bool isSucceed) { if (isSucceed) { Connection1.Stop(); Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => { SignupGrid.Visibility = Visibility.Collapsed; SuccessFullRegistrationtxtBlock.Visibility = Visibility.Visible; SuccessFullRegistrationtxtBlock.Text = "Registration successful. Login to continue."; LoginGrid.Visibility = Visibility.Visible; UserNameTextBox.Focus(); PasswordTextBox.Focus(); })); } }
private void Bind() { UserNameTextBox.Focus(); IdentifyingCode ic = new IdentifyingCode(); identifyingCode = ic.IdentifyingCodeStringGenerate(); try { IdentifyingCodePictureBox.BackgroundImage = ic.IdentifyingCodeImageGenerate(identifyingCode); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } ToolTip.SetToolTip(IdentifyingCodePictureBox, "Click to change"); }
public RegisterView(RegisterViewModel viewModel) { InitializeComponent(); ViewModel = viewModel; this.WhenActivated(disposableRegistration => { this.WhenAnyValue(v => v.UserNameTextBox.Text) .BindTo(ViewModel, vm => vm.UserName) .DisposeWith(disposableRegistration); Observable.FromEventPattern(PasswordTextBox, nameof(PasswordTextBox.PasswordChanged)) .Select(ep => PasswordTextBox.Password) .BindTo(ViewModel, vm => vm.Password) .DisposeWith(disposableRegistration); Observable.FromEventPattern(PasswordRepeatTextBox, nameof(PasswordRepeatTextBox.PasswordChanged)) .Select(ep => PasswordRepeatTextBox.Password) .BindTo(ViewModel, vm => vm.PasswordRepeat) .DisposeWith(disposableRegistration); this.WhenAnyValue(v => v.NameTextBox.Text) .BindTo(ViewModel, vm => vm.Name) .DisposeWith(disposableRegistration); this.WhenAnyValue(v => v.NationalIdentificationNumberTextBox.Text) .BindTo(ViewModel, vm => vm.NationalIdentificationNumber) .DisposeWith(disposableRegistration); this.BindCommand(ViewModel, vm => vm.RegisterCommand, v => v.RegisterButton) .DisposeWith(disposableRegistration); ViewModel.Registered.RegisterHandler(interactioni => { interactioni.SetOutput(Unit.Default); UserNameTextBox.Clear(); PasswordTextBox.Clear(); PasswordRepeatTextBox.Clear(); NameTextBox.Clear(); NationalIdentificationNumberTextBox.Clear(); ParentView.Navigate(ParentView.AccountInfoSideMenu.Name); }).DisposeWith(disposableRegistration); }); }
private void SignInButton_Click(object sender, EventArgs e) { if (!isValid()) { MessageBox.Show("Please Fill User Name OR Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { bool IsUserNameCurrect, IsPasswordCurrect; GetIsUserLoginCurrect(out IsUserNameCurrect, out IsPasswordCurrect); if (IsUserNameCurrect && IsPasswordCurrect) { Expanses Exp = new Expanses(); Exp.Show(); this.Hide(); } else { if (!IsUserNameCurrect) { MessageBox.Show("User Name is Not Currect.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserNameTextBox.Clear(); PasswordTextBox.Clear(); UserNameTextBox.Focus(); } else { MessageBox.Show("Password is Not Currect.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); PasswordTextBox.Clear(); PasswordTextBox.Focus(); } } } catch (Exception ex) { MessageBox.Show("Error" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private bool IsValidated() { try { if (LicenseFileTextBox.Text.Length == 0) { MessageBox.Show(this, "Please enter the License File.", _ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning); LicenseFileTextBox.Focus(); BrowseLicenseFile(); return(false); } if (!File.Exists(LicenseFileTextBox.Text)) { MessageBox.Show(this, "Can not find the License File.", _ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning); LicenseFileTextBox.Focus(); BrowseLicenseFile(); return(false); } if (CompanyNameTextBox.Text.Length == 0) { MessageBox.Show(this, "Please enter Company Name.", _ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning); CompanyNameTextBox.Focus(); return(false); } if (UserNameTextBox.Text.Length == 0) { MessageBox.Show(this, "Please enter User Name.", _ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning); UserNameTextBox.Focus(); return(false); } if (EmailTextBox.Text.Length == 0 || !Regex.IsMatch(EmailTextBox.Text, @"^(([^<>()[\]\\.,;:\s@\""]+" + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@" + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+" + @"[a-zA-Z]{2,}))$")) { MessageBox.Show(this, "Please enter a valid Email Address.", _ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning); EmailTextBox.Focus(); return(false); } return(true); } catch { throw; } }
private void ResetFormControl() { UserNameTextBox.Clear(); PasswordTextBox.Clear(); RolesComboBox.SelectedIndex = 0; IsActiveCheckBox.Checked = true; DescriptionTextBox.Clear(); UserNameTextBox.Focus(); if (this.IsUpdate) { this.IsUpdate = false; SaveButton.Text = "Save User Information"; DeleteButton.Enabled = false; this.UserName = null; } }
private void SaveButton_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrWhiteSpace(UserNameTextBox.Text.Trim()) == false && String.IsNullOrWhiteSpace(PasswordBox.Password) == false) { App.configurationViewModel.UserName = UserNameTextBox.Text.Trim(); App.configurationViewModel.Password = PasswordBox.Password.Trim(); } else { if (String.IsNullOrWhiteSpace(UserNameTextBox.Text.Trim())) { UserNameTextBox.Focus(); } else { PasswordBox.Focus(); } } }
private bool IsFormValid() { if (UserNameTextBox.Text.Trim() == String.Empty) { MessageBox.Show("User name is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserNameTextBox.Clear(); UserNameTextBox.Focus(); return(false); } if (PasswordTextBox.Text.Trim() == String.Empty) { MessageBox.Show("Password is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); PasswordTextBox.Clear(); PasswordTextBox.Focus(); return(false); } return(true); }
private void LoginButton_Click(object sender, EventArgs e) { //check username and password is empty or not if (string.IsNullOrEmpty(UserNameTextBox.Text) || string.IsNullOrEmpty(PasswordTextBox.Text)) { if (string.IsNullOrEmpty(UserNameTextBox.Text)) { UserNameTextBox.Focus(); errorProvider1.SetError(UserNameTextBox, "Please enter username"); }//end of string.IsNullOrEmpty(UserNameTextBox.Text)) else { PasswordTextBox.Focus(); errorProvider1.SetError(PasswordTextBox, "Please enter password"); }////end of settinng password text box error } else { LoginDal logInDataAccess = new LoginDal(); // created an object to invoke the login data access connection in the DAL. Login _loginDetails = new Login { UserName = UserNameTextBox.Text, PassWord = PasswordTextBox.Text }; int recordsCount = logInDataAccess.GetuserDetails(_loginDetails); //this statement acts multipurpose 1)recordsCount acts as variable for checking number of rows retrived 2) for validating the entered user details if (recordsCount > 0) // when the username and password matches one row will be retrived from the database so count is > 0 { this.Hide(); AdminMenuForm menuFm = new AdminMenuForm(); menuFm.Closed += (s, args) => this.Close(); // if username and password matches by using delegate property the current form will be hidden and admin menu form is shown. menuFm.Show(); } else { ErrorMessagelabel.Visible = true; //MessageBox.Show("Please enter Correct Username and Password"); // errorProvider1.SetError(UserNameTextBox, "User Name is Invaldi"); } } }
private void ConnectUserView_OnLoaded(object sender, RoutedEventArgs e) { if (String.IsNullOrWhiteSpace(UserNameTextBox.Text)) { UserNameTextBox.Focus(); UserNameTextBox.SelectAll(); } else { PasswordTextBox.Focus(); PasswordTextBox.SelectAll(); } var viewModel = (PrincipalViewModel)DataContext; if (viewModel.CanAutoConnect) { viewModel.SignInCommand.Execute(null); } }
private bool isFormValid() { if (UserNameTextBox.Text.Trim() == string.Empty) { SMSMessageBox.ShowErrorMessage("User name is not correct"); UserNameTextBox.Clear(); UserNameTextBox.Focus(); return(false); } if (PasswordTextBox.Text.Trim() == string.Empty) { SMSMessageBox.ShowErrorMessage("Password is not correct"); PasswordTextBox.Clear(); PasswordTextBox.Focus(); return(false); } return(true); }
//This just does exactly the same thing as the Login Button, but ...uses the "Enter" key private void PasswordTextBox_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { //This part will get the User Name and Password data from the MYSQL database MySqlConnection conn = new MySqlConnection(DBset()); conn.Open(); MySqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT username, password FROM user_accounts_table WHERE username = @username"; cmd.Parameters.AddWithValue("@username", UserNameTextBox.Text); MySqlDataReader reader = cmd.ExecuteReader(); //This part checks if what the user has inputted MATCHES what is inputted in the HIS MySQL database if (reader.HasRows == true) { while (reader.Read()) { if (UserNameTextBox.Text == reader[0].ToString() && PasswordTextBox.Text == reader[1].ToString()) { MessageBox.Show("Login Successful"); ControlPanel cp = new ControlPanel(); cp.Show(); this.Hide(); } else { //User has inputted wrong credentials. He has to start over. Text Boxes are cleared. MessageBox.Show("Login Failed. Please input correct username and/or password"); UserNameTextBox.Clear(); PasswordTextBox.Clear(); } } } else { MessageBox.Show("No Such User Found"); UserNameTextBox.Clear(); PasswordTextBox.Clear(); } } }
private void LoginButton_Click(object sender, EventArgs e) { String userName = UserNameTextBox.Text; String password = PasswordTextBox.Text; // Successful Authentication if (userDatabase.Login(userName, password)) { userDatabase.SetAuthentication(userName, true); user = userDatabase.GetByUserName(userName); IsAuthenticated = true; this.Close(); } // Failure to Authenticate else { MessageBox.Show("Incorrect Username or Password.", "Attention"); UserNameTextBox.Clear(); PasswordTextBox.Clear(); } }
/// <summary> /// Udalost kliknuti na tlacitko Prihlasit: overeni udaju a prihlaseni zakaznika nebo admina /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LoginUserButton_Click(object sender, EventArgs e) { // prihlaseni administratora if (adminLogin) { if (PasswordTextBox.Text == Administrator.Password) { Session.LoginAdmin(); Close(); } else { PasswordTLPanel.BackColor = Color.MistyRose; Message.InvalidPasswordWarning(); PasswordTextBox.Clear(); } } // prihlaseni zakaznika else { string userEmail = UserNameTextBox.Text; string userPassword = PasswordTextBox.Text; Customer customer = Database.GetVerifiedCustomer(userEmail, userPassword); if (customer != null) { Session.LoginCustomer(customer); Close(); } else { UserNameTextBox.Clear(); PasswordTextBox.Clear(); UserNameTLPanel.BackColor = Color.MistyRose; PasswordTLPanel.BackColor = Color.MistyRose; Message.InvalidCredentialsWarning(); } } }
private async void LoginButton_Click(object sender, RoutedEventArgs e) { string username = UserNameTextBox.Text; string password = PasswordTextBox.Password; //username = "******"; //password = "******"; try { userList = EmployeeService.GetLoggedEmployeeByUserNamePassword(username, password); if (userList.Count() == 1) { Session.LoggedEmployee = userList.SingleOrDefault(); Session.Account_Type = userList.SingleOrDefault().ACCOUNT_TYPE; Session.EmployeeID = userList.SingleOrDefault().EMP_ID; MainWindow.Instance.Show(); ShouldClose = true; this.Close(); } else { await this.ShowMessageAsync("Login Error", "Please check your username and password", MessageDialogStyle.Affirmative); UserNameTextBox.Clear(); PasswordTextBox.Clear(); } } catch (Exception ex) { capturedException = ex; } if (capturedException != null) { await this.ShowMessageAsync("Login Error", capturedException.Message.ToString(), MessageDialogStyle.Affirmative); } }
private bool IsFormValid() { if (UserNameTextBox.Text.Trim() == string.Empty) { MessageBox.Show("User name is Required.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserNameTextBox.Focus(); return(false); } if (UserNameTextBox.Text.Length >= 50) { MessageBox.Show("Role Title length should be less than or equal to 50 characters.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserNameTextBox.Focus(); return(false); } if (PasswordTextBox.Text.Trim() == string.Empty) { MessageBox.Show("Password is Required.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserNameTextBox.Focus(); return(false); } if (PasswordTextBox.Text.Length >= 50) { MessageBox.Show("Password length should be less than or equal to 50 characters.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserNameTextBox.Focus(); return(false); } if (RolesComboBox.SelectedIndex == -1) //if user doesn't select an option in the combobox { MessageBox.Show("Please Select user role from drop down.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); RolesComboBox.Focus(); return(false); } return(true); }
public void buildGui() { UserNameTextBox = this.add_Label("Username:"******""); UserNameTextBox.onTextChange((text) => UserName = text) .align_Right(this); PasswordTextBox = this.add_Label("Password: "******"") .isPasswordField(); PasswordTextBox.onTextChange((text) => Password = text) .align_Right(this); var OKButton = this.add_Button("OK", 60, 0); OKButton.onClick(answerAvailable) .left(this.width() - OKButton.width() - 1) .anchor_BottomRight(); this.parentForm().Closed += (sender, e) => answerAvailable(); }
private void InitializeControls() { RoutingTableFilePathTextBox.DataBindings.Clear(); IfpValidationCheckBox.DataBindings.Clear(); GcdValidationCheckBox.DataBindings.Clear(); CustomRoutingTableFilePathCheckbox.DataBindings.Clear(); PasswordTextBox.DataBindings.Clear(); UserNameTextBox.DataBindings.Clear(); CertificateSettingsUc.Settings = _settings?.CertificateSettings; if (Settings == null) { return; } RoutingTableFilePathTextBox.SetTextDataBinding(_settings, nameof(_settings.RoutingTableFilePath)); IfpValidationCheckBox.SetCheckedDataBinding(_settings, nameof(_settings.ValidateIfpData)); GcdValidationCheckBox.SetCheckedDataBinding(_settings, nameof(_settings.ValidateGcdData)); CustomRoutingTableFilePathCheckbox.SetCheckedDataBinding(_settings, nameof(_settings.IsAutoDownloadRoutingTableFileDisabled)); UserNameTextBox.SetTextDataBinding(_settings, nameof(_settings.SftpSchufaFilesUserName)); PasswordTextBox.SetTextDataBinding(_settings, nameof(_settings.SftpSchufaFilesPassword)); }
private bool IsDataValid() { // Validation (Data Entry Validation) if (UserNameTextBox.Text == string.Empty) { MessageBox.Show("User Name is required.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserNameTextBox.Focus(); return(false); } if (PasswordTextBox.Text == string.Empty) { MessageBox.Show("Password is required.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); PasswordTextBox.Focus(); return(false); } return(true); }
private void PasswordTextBox_KeyUp(object sender, KeyEventArgs e) { try { if (e.KeyCode != Keys.Enter) { return; } if (PasswordTextBox.Text.Length > 0 && UserNameTextBox.Text.Length == 0) { UserNameTextBox.Focus(); } else if (PasswordTextBox.Text.Length == 0) { return; } else { Login(); } } catch { throw; } }
private void LoginButton_Click(object sender, EventArgs e) { if (isValid()) { bool IsUserNameCurrect, IsPasswordCurrect; GetIsUserLoginCurrect(out IsUserNameCurrect, out IsPasswordCurrect); if (IsUserNameCurrect && IsPasswordCurrect) { DashBoardForm dbf = new DashBoardForm(); dbf.Show(); this.Hide(); } else { if (!IsUserNameCurrect) { MessageBox.Show("UserName is Not Currect.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserNameTextBox.Clear(); PasswordTextBox.Clear(); UserNameTextBox.Focus(); } else { MessageBox.Show("Password is Not Currect.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); PasswordTextBox.Clear(); PasswordTextBox.Focus(); } } } else { MessageBox.Show("Please Enter User Name And Password", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Sets the focus to the control /// </summary> /// <param name="setFocusToPasswordBox">Set explicit focus to the password box</param> private void SetFocus(bool setFocusToPasswordBox = false) { // First give the silverlight control focus try { // Doesn't work outside browser - catch any issues System.Windows.Browser.HtmlPage.Plugin.Focus(); } catch { } //// And then ourself //this.Focus(); // Set focus to the password box if (setFocusToPasswordBox) { PasswordBox.Focus(); } else { UserNameTextBox.Focus(); } }
private void Loginbtn_Click(object sender, EventArgs e) { if (UserNameTextBox.Text == "" || PasswordTextBox.Text == "") { MessageBox.Show("Username or password can not be empty"); } else { UserService userService = new UserService(); bool result = userService.LoginValidation(UserNameTextBox.Text, PasswordTextBox.Text); if (result) { Dashboard dashBoard = new Dashboard(); dashBoard.Show(); this.Hide(); } else { MessageBox.Show("Invalid Username or password"); UserNameTextBox.Clear(); PasswordTextBox.Clear(); } } }
private void RefreshButton_Click(object sender, RoutedEventArgs e) { string name = UserNameTextBox.Text.Trim(); string password = PasswordTextBox.Password.Trim(); if (string.IsNullOrEmpty(name)) { MessageBox.Show("用户名不能为空。", "警告", MessageBoxButton.OK); UserNameTextBox.Focus(); } else if (string.IsNullOrEmpty(password)) { MessageBox.Show("用户名不能为空。", "警告", MessageBoxButton.OK); UserNameTextBox.Focus(); } else if (BundleActivator.BundleManagementServiceTracker.IsServiceAvailable) { BundlesDataGrid.DataContext = null; LoadBundlesProgressBar.IsIndeterminate = true; LoadBundlesProgressBar.Visibility = Visibility.Visible; new Thread((ThreadStart) delegate { bool failed = false; IBundleManagementService defaultOrFirstService = BundleActivator.BundleManagementServiceTracker.DefaultOrFirstService; List <BundleDetails> bundles = new List <BundleDetails>(); try { List <ProjectData> projectsByUser = defaultOrFirstService.GetProjectsByUser(name, password); ProjectData bundleRepositoryProject = defaultOrFirstService.GetBundleRepositoryProject(); foreach (ProjectData item in projectsByUser) { if (!item.ProjectId.Equals(bundleRepositoryProject.ProjectId)) { List <BundleDetails> repositoryBundlesByProject = defaultOrFirstService.GetRepositoryBundlesByProject(item.ProjectId, name, password); if (repositoryBundlesByProject != null && repositoryBundlesByProject.Count > 0) { bundles.AddRange(repositoryBundlesByProject); } } } } catch { failed = true; } Action method = delegate { if (failed) { MessageBox.Show("获取插件失败,请输入正确的帐号并确保网络畅通。", "错误", MessageBoxButton.OK); } else { LoadBundlesProgressBar.IsIndeterminate = false; LoadBundlesProgressBar.Visibility = Visibility.Hidden; if (bundles.Count == 0) { BundlesDataGrid.Visibility = Visibility.Hidden; MessageBox.Show("插件列表为空。", "提示", MessageBoxButton.OK); } else { BundlesDataGrid.Visibility = Visibility.Visible; BundlesDataGrid.ItemsSource = null; BundlesDataGrid.ItemsSource = bundles; } } }; base.Dispatcher.Invoke(method, new object[0]); }).Start(); } }
private void UserNameTextBox_TextChanged(object sender, EventArgs e) { UserNameTextBox.Focus(); }
private void ChangePasswordButton_Click(object sender, EventArgs e) { User user = new User() { UserName = UserNameTextBox.Text.Trim(), Password = OriginalPasswordTextBox.Text.Trim() }; Response response = new Response(); if (string.IsNullOrEmpty(UserNameTextBox.Text.Trim())) { UserNameTextBox.Focus(); UserNameErrorProvider.SetError(UserNameTextBox, "UserName can't be vacant!"); } else { UserNameErrorProvider.SetError(UserNameTextBox, ""); if (string.IsNullOrEmpty(OriginalPasswordTextBox.Text.Trim())) { OriginalPasswordTextBox.Focus(); OriginalPasswordErrorProvider.SetError(OriginalPasswordTextBox, "OriginalPassword can't be vacant!"); } else { OriginalPasswordErrorProvider.SetError(OriginalPasswordTextBox, ""); if (string.IsNullOrEmpty(NewPasswordTextBox.Text.Trim())) { NewPasswordTextBox.Focus(); NewPasswordErrorProvider.SetError(NewPasswordTextBox, "NewPassword can't be vacant!"); } else { NewPasswordErrorProvider.SetError(NewPasswordTextBox, ""); if (string.IsNullOrEmpty(ConfirmPasswordTextBox.Text.Trim())) { ConfirmPasswordTextBox.Focus(); ConfirmPasswordErrorProvider.SetError(ConfirmPasswordTextBox, "ConfirmPassword can't be vacant!"); } else { try { response = new UserService().Authentication(user); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } if (string.IsNullOrEmpty(response.Message)) { if (NewPasswordTextBox.Text.Trim() != OriginalPasswordTextBox.Text.Trim()) { if (ConfirmPasswordTextBox.Text.Trim() == NewPasswordTextBox.Text.Trim()) { try { user.UserId = new UserService().GetUserIdByUserName(user.UserName); user.Password = ConfirmPasswordTextBox.Text.Trim(); response = new UserService().ChangePassword(user); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } if (response.IsFailed) { MessageBox.Show("Changing password fails", "System prompt", MessageBoxButtons.OK, MessageBoxIcon.Information); UserNameTextBox.Focus(); UserNameTextBox.Text = string.Empty; OriginalPasswordTextBox.Text = string.Empty; NewPasswordTextBox.Text = string.Empty; ConfirmPasswordTextBox.Text = string.Empty; } else { MessageBox.Show("Changing password succeeds", "System prompt", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { MessageBox.Show("Please repeat new password again.", "System prompt", MessageBoxButtons.OK, MessageBoxIcon.Information); NewPasswordTextBox.Text = string.Empty; ConfirmPasswordTextBox.Text = string.Empty; } } else { MessageBox.Show("New password and current password are same.", "System prompt", MessageBoxButtons.OK, MessageBoxIcon.Information); NewPasswordTextBox.Text = string.Empty; ConfirmPasswordTextBox.Text = string.Empty; } } else { MessageBox.Show(response.Message, "System prompt", MessageBoxButtons.OK, MessageBoxIcon.Information); UserNameTextBox.Focus(); UserNameTextBox.Text = string.Empty; OriginalPasswordTextBox.Text = string.Empty; NewPasswordTextBox.Text = string.Empty; ConfirmPasswordTextBox.Text = string.Empty; } } } } } }
/// <summary> /// Initialize the form and get the UserName from login interface. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChangePassword_Load(object sender, EventArgs e) { UserNameTextBox.Focus(); ((UserLogin)this.Owner).ClearInformation(); }
// // Misc Events // private void UserNameTextBox_PreviewMouseUp(object sender, MouseButtonEventArgs e) { UserNameTextBox.Focus(); UserNameTextBox.SelectAll(); }