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; }
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); }
private static bool IsSet(UiControlTypeSelectorMode flags, UiControlTypeSelectorMode compareFlag) { return ((flags & compareFlag) == compareFlag); }
private static bool IsSet(UiControlTypeSelectorMode flags, UiControlTypeSelectorMode compareFlag) { return((flags & compareFlag) == compareFlag); }