Esempio n. 1
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            string val = value as string;

            val = val.ToLowerInvariant();
            string[] options = val.Split('|');
            UiControlTypeSelectorMode mode = new UiControlTypeSelectorMode();
            foreach (string opt in options)
            {
                string option = opt.Trim();
                if (option == TypeIncludes.ConcreteTypes.ToString().ToLowerInvariant())
                {
                    mode = mode | UiControlTypeSelectorMode.ConcreteTypes;
                }
                else if (option == TypeIncludes.InterfaceTypes.ToString().ToLowerInvariant())
                {
                     mode = mode | UiControlTypeSelectorMode.InterfaceTypes;
                }
                else if (option == TypeIncludes.PrimitiveTypes.ToString().ToLowerInvariant())
                {
                     mode = mode | UiControlTypeSelectorMode.PrimitiveTypes;
                }
                else
                {
                    throw new FormatException(String.Format("{0} is not a valid TextSelector Mode value - use ConcreteTypes, InterfaceTypes, PrimitiveTypes", value));
                }
            }
            return mode;
        }
Esempio n. 2
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            string val = value as string;

            val = val.ToLowerInvariant();
            string[] options = val.Split('|');
            UiControlTypeSelectorMode mode = new UiControlTypeSelectorMode();

            foreach (string opt in options)
            {
                string option = opt.Trim();
                if (option == TypeIncludes.ConcreteTypes.ToString().ToLowerInvariant())
                {
                    mode = mode | UiControlTypeSelectorMode.ConcreteTypes;
                }
                else if (option == TypeIncludes.InterfaceTypes.ToString().ToLowerInvariant())
                {
                    mode = mode | UiControlTypeSelectorMode.InterfaceTypes;
                }
                else if (option == TypeIncludes.PrimitiveTypes.ToString().ToLowerInvariant())
                {
                    mode = mode | UiControlTypeSelectorMode.PrimitiveTypes;
                }
                else
                {
                    throw new FormatException(String.Format("{0} is not a valid TextSelector Mode value - use ConcreteTypes, InterfaceTypes, PrimitiveTypes", value));
                }
            }
            return(mode);
        }
Esempio n. 3
0
 private static bool IsSet(UiControlTypeSelectorMode flags, UiControlTypeSelectorMode compareFlag)
 {
     return ((flags & compareFlag) == compareFlag);
 }
Esempio n. 4
0
 private static bool IsSet(UiControlTypeSelectorMode flags, UiControlTypeSelectorMode compareFlag)
 {
     return((flags & compareFlag) == compareFlag);
 }