private void btnOK_Click(object sender, RoutedEventArgs e) { //Validation.GetHasError(txtOldPassword); string oldpwd = txtOldPassword.Password; string newpwd = txtNewPassword.Password; string surepwd = txtNewPasswordSure.Password; if (oldpwd.ToMD5String() != VMGlobal.CurrentUser.Password) { MessageBox.Show("当前密码输入错误."); return; } if (!SysUserBO.IsMatchPWDReg(newpwd)) { MessageBox.Show("新密码格式不正确,必须为至少6位字母和数字组合字符串."); return; } if (newpwd != surepwd) { MessageBox.Show("两次输入的新密码不一致."); return; } var result = ((SysUserBO)VMGlobal.CurrentUser).ResetPassword(newpwd); if (result.IsSucceed) { MessageBox.Show("修改成功,修改后密码为" + newpwd); this.Close(); } else { MessageBox.Show(result.Message); } }