/// <summary>
 /// Creates and sets new Validation Rule(inherited from <see cref="IValidationRule"/>).
 /// </summary>
 public void AssignValidationRule()
 {
     RangeValidationRule rule = new RangeValidationRule(NumericQuestion.Types.IntegerType, null, null);
     rule.RegexRule = new RegexValidationRule("");
     ValidationRule = rule;
 }
 private bool ValidatePassword()
 {
     if (_viewModel.IsEncryptionEnabled)
     {
         RangeValidationRule rule = new RangeValidationRule(NumericQuestion.Types.IntegerType, null, null);
         rule.RegexRule = new RegexValidationRule("");
         string newValue = Password.Text;
         Password.IsValid = true;
         Password.IsValid = rule.Validate(newValue);
         if (!Password.IsValid)
         {
             Password.ValidationContent = Languages.AppResources.validationRules_LengthEmptyMessage;
             return false;
         }
         else
         {
             return true;
         }
     }
     return true;
 }
        private void OnCustomValueChanged(object sender, RoutedEventArgs e)
        {
            if (((ValidationControl)sender).Name == "FontSize")
            {
                int minValue = 15;
                int maxValue = 35;
                RangeValidationRule rule = new RangeValidationRule(NumericQuestion.Types.IntegerType, minValue, maxValue);

                string newValue = ((ValidationControl)sender).Text;
                ((ValidationControl)sender).IsValid = true;
                ((ValidationControl)sender).IsValid = rule.Validate(newValue);
                if (((ValidationControl)sender).IsValid)
                {
                    OperationsOnSettings.Instance.FontSize = Convert.ToInt32(newValue);
                    _oldFontSize = OperationsOnSettings.Instance.FontSize;
                    LoadSettingsPageContent();
                }
                else
                {
                    ((ValidationControl)sender).ValidationContent = string.Format(Languages.AppResources.settingsPage_InvalidCustomValue, minValue.ToString(), maxValue.ToString());
                }
            }
        }