示例#1
0
 /// <summary>
 /// Check if the string is an email.
 /// </summary>
 /// <param name="e"></param>
 public static void IsEmail(ValidatorEventArgs e) => e.Status = IsEmail(e.Value as string) ? ValidationStatus.Success : ValidationStatus.Error;
示例#2
0
 /// <summary>
 /// Empty validator.
 /// </summary>
 /// <param name="e"></param>
 public static void None(ValidatorEventArgs e) => e.Status = ValidationStatus.None;
示例#3
0
        /// <summary>
        /// Checks if the selection based input has a valid value selected. Valid values are
        /// anything except for <c>null</c>, <c>string.Empty</c>, or <c>0</c>.
        /// </summary>
        /// <param name="e"></param>
        public static void IsSelected(ValidatorEventArgs e)
        {
            var value = e.Value?.ToString();

            e.Status = string.IsNullOrEmpty(value) || value == "0" ? ValidationStatus.Error : ValidationStatus.Success;
        }
示例#4
0
 /// <summary>
 /// Check if the string contains only letters, numbers and underscore.
 /// </summary>
 /// <param name="e"></param>
 public static void IsAlphanumericWithUnderscore(ValidatorEventArgs e) => e.Status = IsAlphanumericWithUnderscore(e.Value as string) ? ValidationStatus.Success : ValidationStatus.Error;
示例#5
0
        /// <summary>
        /// Checks if the boolean based input is checked.
        /// </summary>
        /// <param name="e"></param>
        public static void IsChecked(ValidatorEventArgs e)
        {
            Converters.TryChangeType <bool>(e.Value, out var result);

            e.Status = result ? ValidationStatus.Success : ValidationStatus.Error;
        }