private void CheckInputChangeInfo() { bool isInputValid = true; if (tbxNickName.Text == "") { tbxNickName.Background = UserBrushes.MereWhite; isInputValid = false; } else if (CheckUtil.Nickname(tbkNickName.Text)) { tbxNickName.Background = UserBrushes.MereWhite; } else { isInputValid = false; tbxNickName.Background = UserBrushes.Warning; } if (isInputValid) { ibarChangeInfo.IsEnabled = true; } else { ibarChangeInfo.IsEnabled = false; } }
private void CheckInput() { var flag = true; if (tbxUser.Text == "") { flag = false; tbxUser.Background = UserBrushes.MereWhite; } else if (CheckUtil.Nickname(tbxUser.Text)) { tbxUser.Background = UserBrushes.MereWhite; } else { flag = false; tbxUser.Background = UserBrushes.Warning; } if (pwb1.Password == "") { flag = false; pwb1.Background = UserBrushes.MereWhite; } else if (CheckUtil.Password(pwb1.Password)) { pwb1.Background = UserBrushes.MereWhite; } else { flag = false; pwb1.Background = UserBrushes.Warning; } if (pwb2.Password == "") { flag = false; pwb2.Background = UserBrushes.MereWhite; } else if (CheckUtil.Password(pwb2.Password) && pwb1.Password == pwb2.Password) { pwb2.Background = UserBrushes.MereWhite; } else { flag = false; pwb2.Background = UserBrushes.Warning; } if (flag) { gridLogin.Background = Brushes.DeepSkyBlue; btnLogin.IsEnabled = true; } else { gridLogin.Background = new SolidColorBrush(Color.FromRgb(0xaa, 0xaa, 0xaa)); btnLogin.IsEnabled = false; } }
private void TbkChangeNickname_TextChanged(object sender, TextChangedEventArgs e) { if (CheckUtil.Nickname(tbkChangeNickname.Text)) { btnChangeNickname.IsEnabled = true; } else { btnChangeNickname.IsEnabled = false; } }
private void CheckRegisterInput() { var message = ""; var isvalid = true; if (tbxnick.Text == "" || pwb2.Password == "" || pwb3.Password == "") { tbkMsg.Text = ""; btn2.IsEnabled = false; } else { if (!CheckUtil.Nickname(tbxnick.Text)) { isvalid = false; message += "昵称太长或太短\n"; } if (pwb2.Password != pwb3.Password) { isvalid = false; message += "两次密码不相等"; } else { if (!CheckUtil.Password(pwb2.Password)) { isvalid = false; message += "密码太长或太短"; } } tbkMsg.Text = message; btn2.IsEnabled = isvalid; } }