private static void MarkProblem(string invalidControlName, IAccountInfoForm controlInterface) { var control = (Control)controlInterface; var ic = control.FindName(invalidControlName); if (ic is Control c) { c.Background = new SolidColorBrush(Colors.OrangeRed); } }
private string ValidateComponents(IAccountInfoForm control, AccountInfo accountInfo) { if (!ValidateEmail(accountInfo)) { return("emailBox"); } if (control.PassWordMustBeChanged && !ValidatePassword(accountInfo)) { return("passwordBox"); } return(null); }
public bool ValidateForm(IAccountInfoForm control, AccountInfo accountInfo) { ResetBackgroundColors(control); var problem = ValidateComponents(control, accountInfo); if (problem != null) { MarkProblem(problem, control); return(false); } return(true); }
private static void ResetBackgroundColors(IAccountInfoForm control) { control.PasswordBox.Background = null; control.EmailBox.Background = null; }