public override object ConvertFrom( ITypeDescriptorContext context, CultureInfo culture, object value) { if (!(value is string)) { return(base.ConvertFrom(context, culture, value)); } string a = ((string)value).Trim(); if (!string.Equals(a, CommandBaseConverter.none) && context != null) { List <CommandBase> commandBaseList = CommandBaseConverter.DiscoverCommands(this.GetComponentsReferences(context)); if (commandBaseList != null && commandBaseList.Count > 0) { for (int index = 0; index < commandBaseList.Count; ++index) { string str = commandBaseList[index].ToString(); if (a.Equals(str)) { return((object)commandBaseList[index]); } } } } return(base.ConvertFrom(context, culture, value)); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (!(value is string)) { return(base.ConvertFrom(context, culture, value)); } string text1 = ((string)value).Trim(); if (!string.Equals(text1, CommandBaseConverter.none) && (context != null)) { List <CommandBase> sourceList = CommandBaseConverter.DiscoverCommands(base.GetComponentsReferences(context)); if (sourceList != null && sourceList.Count > 0) { for (int i = 0; i < sourceList.Count; i++) { string name = sourceList[i].ToString(); if (text1.Equals(name)) { return(sourceList[i]); } } } } return(base.ConvertFrom(context, culture, value)); }
public override TypeConverter.StandardValuesCollection GetStandardValuesCore( ITypeDescriptorContext context, TypeConverter.StandardValuesCollection collection) { List <CommandBase> commandBaseList = CommandBaseConverter.DiscoverCommands(collection); commandBaseList?.Insert(0, (CommandBase)null); return(new TypeConverter.StandardValuesCollection((ICollection)commandBaseList)); }
public override TypeConverter.StandardValuesCollection GetStandardValuesCore(ITypeDescriptorContext context, TypeConverter.StandardValuesCollection collection) { List <CommandBase> list = CommandBaseConverter.DiscoverCommands(collection); if (list != null) { list.Insert(0, null); } return(new TypeConverter.StandardValuesCollection(list)); }
public static List <CommandBase> DiscoverCommands( TypeConverter.StandardValuesCollection collection) { List <CommandBase> commandBaseList = CommandBaseConverter.DiscoverCommands(CommandBaseConverter.DiscoverCommandsSources(collection)); if (commandBaseList != null && commandBaseList.Count > 0) { return(commandBaseList); } return((List <CommandBase>)null); }
public static List <CommandBase> DiscoverCommands(List <IComponent> list) { List <CommandBase> destinationList = new List <CommandBase>(1); if (list != null) { for (int index = 0; index < list.Count; ++index) { List <CommandBase> sourceList = CommandBaseConverter.DiscoverCommands(list[index]); if (sourceList != null && sourceList.Count > 0) { CommandBaseConverter.TransferListUniquePart <CommandBase>(sourceList, destinationList); } } } if (destinationList.Count > 0) { return(destinationList); } return((List <CommandBase>)null); }
public static List <IComponent> DiscoverCommandsSources(IComponent source) { if (source == null) { return((List <IComponent>)null); } List <IComponent> destinationList = new List <IComponent>(1); if (CommandBaseConverter.DiscoverCommands(source) != null) { CommandBaseConverter.TransferListUniquePart <IComponent>(source, destinationList); } if (source is RadControl) { RootRadElement rootElement = (source as RadControl).RootElement; if (rootElement != null && rootElement.Children.Count > 0) { for (int index = 0; index < rootElement.Children.Count; ++index) { IComponent child = rootElement.Children[index] as IComponent; if (child != null && child is IItemsOwner) { List <IComponent> sourceList = CommandBaseConverter.DiscoverCommandsSources(child); if (destinationList != null) { CommandBaseConverter.TransferListUniquePart <IComponent>(sourceList, destinationList); } } } } } if (destinationList.Count > 0) { return(destinationList); } return((List <IComponent>)null); }