Exemplo n.º 1
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is string)
     {
         int num = 0;
         if (DocUtil.StringToDXFCode((string)value, ref num))
         {
             return(value);
         }
     }
     if (value is int)
     {
         return(DocUtil.DXFCodeToString((int)value));
     }
     return(MSCFeatureClass.GetTypeCodeString(MSCFeatureClass.fcTypeCode.fcTypePoint));
 }
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            int num = 0;

            try
            {
                if (((string)value).Length > 0 && !DocUtil.StringToDXFCode((string)value, ref num))
                {
                    num = int.Parse((string)value);
                }
            }
            catch (SystemException ex)
            {
                ValidationResult result = new ValidationResult(false, AfaStrings.IllegalCharactersOr + ex.Message);
                return(result);
            }
            if (num < this.Min || num > this.Max)
            {
                return(new ValidationResult(false, AfaStrings.InvalidDXFCode));
            }
            return(new ValidationResult(true, null));
        }