protected virtual IMaskCharacterProvider CreateNumericCharacterTextBoxProvider(
     string mask,
     CultureInfo culture,
     NumericCharacterTextBoxProvider.RadNumericMaskFormatType radNumericMaskFormatType,
     RadMaskedEditBoxElement owner)
 {
     return((IMaskCharacterProvider) new NumericCharacterTextBoxProvider(mask, culture, radNumericMaskFormatType, owner));
 }
 public NumericMaskTextBoxProvider(string mask, CultureInfo culture, RadMaskedEditBoxElement owner)
 {
     this.owner       = owner;
     this.numericType = GetFormat(mask, culture);
     this.mask        = mask;
     this.culture     = culture;
     this.provider    = new NumericCharacterTextBoxProvider(mask, culture, this.numericType, owner);
     this.promptChar  = this.provider.PromptChar;
     this.textBoxItem = owner.TextBoxItem;
 }
 public NumericCharacterTextBoxProvider(
     string mask,
     CultureInfo culture,
     NumericCharacterTextBoxProvider.RadNumericMaskFormatType numericType,
     RadMaskedEditBoxElement owner)
 {
     this.owner       = owner;
     this.mask        = mask;
     this.culture     = culture;
     this.numericType = numericType;
     this.promptChar  = '0';
     this.textBoxItem = owner.TextBoxItem;
 }
 public NumericMaskTextBoxProvider(
     string mask,
     CultureInfo culture,
     RadMaskedEditBoxElement owner)
 {
     if (mask.ToLower() == "d")
     {
         mask += "0";
     }
     this.owner       = owner;
     this.numericType = NumericMaskTextBoxProvider.GetFormat(mask, culture);
     this.mask        = mask;
     this.culture     = culture;
     this.provider    = this.CreateNumericCharacterTextBoxProvider(mask, culture, this.numericType, owner);
     this.promptChar  = this.provider.PromptChar;
     this.textBoxItem = owner.TextBoxItem;
 }
Пример #5
0
        public static NumericCharacterTextBoxProvider.RadNumericMaskFormatType GetFormat(string formatString, CultureInfo culture)
        {
            // the default format would be decimal if the formatString is incorrect
            NumericCharacterTextBoxProvider.RadNumericMaskFormatType numericType = NumericCharacterTextBoxProvider.RadNumericMaskFormatType.None;

            if (Regex.IsMatch(formatString, "^[cCdDgGfFnNpP][0-9]{0,2}$"))
            {
                switch (formatString[0])
                {
                case 'c':
                case 'C':
                    numericType = NumericCharacterTextBoxProvider.RadNumericMaskFormatType.Currency;
                    break;

                case 'd':
                case 'D':
                    numericType = NumericCharacterTextBoxProvider.RadNumericMaskFormatType.Standard;
                    break;

                case 'g':
                case 'G':
                case 'f':
                case 'F':
                    numericType = NumericCharacterTextBoxProvider.RadNumericMaskFormatType.FixedPoint;
                    break;

                case 'n':
                case 'N':
                    numericType = NumericCharacterTextBoxProvider.RadNumericMaskFormatType.Decimal;
                    break;

                case 'p':
                case 'P':
                    numericType = NumericCharacterTextBoxProvider.RadNumericMaskFormatType.Percent;
                    break;

                default:
                    numericType = NumericCharacterTextBoxProvider.RadNumericMaskFormatType.Decimal;
                    break;
                }
            }

            return(numericType);
        }