private PrimesBigInteger GetPrimesCount() { PrimesBigInteger result = PrimesBigInteger.One; try { IValidator <PrimesBigInteger> validator = new BigIntegerMinValueValidator(tbN.Text, PrimesBigInteger.ValueOf(1)); TextBoxValidator <PrimesBigInteger> tbValidator = new TextBoxValidator <PrimesBigInteger>(validator, tbN, "1"); tbValidator.Validate(ref result); } catch (ControlValidationException cvex) { switch (cvex.ValidationResult) { case Primes.WpfControls.Validation.ValidationResult.WARNING: Info(cvex.Message, cvex.Control as TextBox); break; case Primes.WpfControls.Validation.ValidationResult.ERROR: Error(cvex.Message, cvex.Control as TextBox); break; } } return(result); }
private void InjectServices() { var service = new TextBoxValidator(); NewContactPanel.InjectService(service); UpdateContactPanel.InjectService(service); }
public PrimesBigInteger ValidateInput(TextBox tbSource) { PrimesBigInteger result = PrimesBigInteger.Zero; InputValidator <PrimesBigInteger> m_Validator; if (m_Validators.ContainsKey(tbSource.Tag.ToString())) { m_Validator = m_Validators[tbSource.Tag.ToString()]; } else { m_Validator = new InputValidator <PrimesBigInteger>(); m_Validator.Validator = new BigIntegerValidator(tbSource.Text); } try { TextBoxValidator <PrimesBigInteger> tbvalidator = new TextBoxValidator <PrimesBigInteger>(m_Validator.Validator, tbSource, m_Validator.DefaultValue); tbvalidator.Validate(ref result); } catch (ControlValidationException cvex) { cvex.HelpAction = m_Validator.LinkOnlinehelp; throw cvex; } return(result); }
public GLSharpness() { InitializeComponent(); var viewmodel = DataContext as GLSharpnessViewModel; textBoxValidator = new TextBoxValidator(); Unloaded += (sender, e) => viewmodel.UnsubscribePrismEvents(); }
public CLCurrentCorrection() { InitializeComponent(); var viewmodel = DataContext as CLCurrentCorrectionViewModel; textBoxValidator = new TextBoxValidator(); Unloaded += (sender, e) => viewmodel.UnsubscribePrismEvents(); }
public LoginForm(IUserService service, IPasswordHasher passwordHasher) { InitializeComponent(); validator = new TextBoxValidator(loginLabel.ForeColor); userService = service; TextBoxLabelPairs = new Dictionary <TextBox, Label>() { [loginTextBox] = loginLabel, [passwordTextBox] = passwordLabel, }; hasher = passwordHasher; }
private string validate() { StringBuilder builder = new StringBuilder(); TextBoxValidator validator = new TextBoxValidator(); validator.append(builder, validator.checkValidLength(vactination_name.Text.Trim(), 50, "Название вакцины")); if (String.IsNullOrEmpty(builder.ToString())) { return(null); } return(builder.ToString()); }
private string validate() { StringBuilder builder = new StringBuilder(); TextBoxValidator validator = new TextBoxValidator(); validator.append(builder, validator.checkValidLength(animal_id.Text.Trim(), 10, "Id Животного")); validator.append(builder, validator.checkValidLength(vactination_id.Text.Trim(), 10, "Id вакцины")); if (String.IsNullOrEmpty(builder.ToString())) { return(null); } return(builder.ToString()); }
private string validate() { StringBuilder builder = new StringBuilder(); TextBoxValidator validator = new TextBoxValidator(); validator.append(builder, validator.checkValidLength(service_name.Text.Trim(), 50, "Название услуги")); validator.append(builder, validator.isValidDoubleValue(prices.Text.Trim(), "Ценник")); if (String.IsNullOrEmpty(builder.ToString())) { return(null); } return(builder.ToString()); }
private string validate() { StringBuilder builder = new StringBuilder(); TextBoxValidator validator = new TextBoxValidator(); validator.append(builder, validator.checkValidLength(owner_id.Text.Trim(), 10, "Id Владельца")); validator.append(builder, validator.checkValidLength(service_id.Text.Trim(), 10, "Id услуги")); if (String.IsNullOrEmpty(builder.ToString())) { return(null); } return(builder.ToString()); }
public RegistrationForm(IUserService service, IPasswordHasher passwordHasher) { InitializeComponent(); TextBoxLabelPairs = new Dictionary <TextBox, Label> { [firstNameTextBox] = firstNameLabel, [lastNameTextBox] = lastNameLabel, [emailTextBox] = emailLabel, [userNameTextBox] = userNameLabel, [passwordTextBox] = passwordLabel, }; validator = new TextBoxValidator(firstNameLabel.ForeColor); userService = service; hasher = passwordHasher; }
private string validate() { StringBuilder builder = new StringBuilder(); TextBoxValidator validator = new TextBoxValidator(); validator.append(builder, validator.checkValidLength(veterinarian_name.Text.Trim(), 50, "Имя")); validator.append(builder, validator.checkValidLength(veterinarian_surname.Text.Trim(), 50, "Фамилия")); validator.append(builder, validator.checkValidLength(veterinarian_lastname.Text.Trim(), 50, "Отчество")); validator.append(builder, validator.checkValidLength(email.Text.Trim(), 25, "Email")); if (String.IsNullOrEmpty(builder.ToString())) { return(null); } return(builder.ToString()); }
private string validate() { StringBuilder builder = new StringBuilder(); TextBoxValidator validator = new TextBoxValidator(); validator.append(builder, validator.checkValidLength(owner_name.Text.Trim(), 50, "Имя владельца")); validator.append(builder, validator.checkValidLength(owner_surname.Text.Trim(), 50, "Фамилия владельца")); validator.append(builder, validator.checkValidLength(owner_lastname.Text.Trim(), 50, "Отчество владельца")); validator.append(builder, validator.PhoneNumberValidate(phone.Text.Trim())); if (String.IsNullOrEmpty(builder.ToString())) { return(null); } return(builder.ToString()); }
private string validate() { StringBuilder builder = new StringBuilder(); TextBoxValidator validator = new TextBoxValidator(); validator.append(builder, validator.checkValidLength(AnimalName.Text.Trim(), 50, "Имя животного")); validator.append(builder, validator.checkValidLength(AnimalBreed.Text.Trim(), 50, "Порода животного")); validator.append(builder, validator.checkValidLength(AnimalGender.Text.Trim(), 50, "Пол животного")); validator.append(builder, validator.checkValidLength(AnimalAge.Text.Trim(), 10, "Возраст животного")); validator.append(builder, validator.checkValidLength(AnimalAge.Text.Trim(), 10, "Id Ветеринара")); validator.append(builder, validator.checkValidLength(AnimalAge.Text.Trim(), 10, "Id Владельца")); if (String.IsNullOrEmpty(builder.ToString())) { return(null); } return(builder.ToString()); }
private void txbThird_KeyPress(object sender, KeyPressEventArgs e) { TextBoxValidator.validateNumberContent(e); }
public PersonalData() { InitializeComponent(); textBoxValidator = new TextBoxValidator(); }
public void Setup() { validator = new TextBoxValidator(); }
private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e) { e.Handled = !TextBoxValidator.IsFloatTextAllowed(e.Text); }
private void TextBoxMoneyToEmployee_Of_Material_PreviewTextInput(object sender, TextCompositionEventArgs e) { e.Handled = !TextBoxValidator.IsFloatTextAllowed(e.Text); }