Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private void InjectServices()
        {
            var service = new TextBoxValidator();

            NewContactPanel.InjectService(service);
            UpdateContactPanel.InjectService(service);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public GLSharpness()
        {
            InitializeComponent();

            var viewmodel = DataContext as GLSharpnessViewModel;

            textBoxValidator = new TextBoxValidator();

            Unloaded += (sender, e) => viewmodel.UnsubscribePrismEvents();
        }
Exemplo n.º 5
0
        public CLCurrentCorrection()
        {
            InitializeComponent();

            var viewmodel = DataContext as CLCurrentCorrectionViewModel;

            textBoxValidator = new TextBoxValidator();

            Unloaded += (sender, e) => viewmodel.UnsubscribePrismEvents();
        }
Exemplo n.º 6
0
 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());
        }
Exemplo n.º 8
0
        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());
        }
Exemplo n.º 9
0
        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());
        }
Exemplo n.º 10
0
        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());
        }
Exemplo n.º 11
0
        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());
        }
Exemplo n.º 13
0
        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());
        }
Exemplo n.º 14
0
        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());
        }
Exemplo n.º 15
0
 private void txbThird_KeyPress(object sender, KeyPressEventArgs e)
 {
     TextBoxValidator.validateNumberContent(e);
 }
Exemplo n.º 16
0
        public PersonalData()
        {
            InitializeComponent();

            textBoxValidator = new TextBoxValidator();
        }
Exemplo n.º 17
0
 public void Setup()
 {
     validator = new TextBoxValidator();
 }
Exemplo n.º 18
0
 private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
 {
     e.Handled = !TextBoxValidator.IsFloatTextAllowed(e.Text);
 }
Exemplo n.º 19
0
 private void TextBoxMoneyToEmployee_Of_Material_PreviewTextInput(object sender, TextCompositionEventArgs e)
 {
     e.Handled = !TextBoxValidator.IsFloatTextAllowed(e.Text);
 }