public ChangePasswordViewModel() { ChangeCommand = new DelegateCommand((_) => { if (string.IsNullOrWhiteSpace(Password)) { ShowMessage("The password is required and cannot be empty"); return; } if (string.IsNullOrWhiteSpace(NewPassword)) { ShowMessage("The new password is required and cannot be empty"); return; } if (string.IsNullOrWhiteSpace(ConfirmPassword)) { ShowMessage("The confirm password is required and cannot be empty"); return; } if (NewPassword.Length < 6 || NewPassword.Length > 20) { ShowMessage("The new password must be at least 6 and not more than 20 characters long"); return; } if (NewPassword != ConfirmPassword) { ShowMessage("The new password and its confirm are not the same"); return; } if (AppSecurity.ChangePassword(Password, NewPassword, out string errorMessage)) { DialogResult = true; } else { ShowMessage(errorMessage); } }); CancelCommand = new DelegateCommand((_) => { DialogResult = false; }); }