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 <IComponent> sourceList = CommandBaseConverter.DiscoverCommandsContexts(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 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 <IComponent> componentList = CommandBaseConverter.DiscoverCommandsContexts(this.GetComponentsReferences(context)); if (componentList != null && componentList.Count > 0) { for (int index = 0; index < componentList.Count; ++index) { string str = componentList[index].ToString(); if (a.Equals(str)) { return((object)componentList[index]); } } } } return(base.ConvertFrom(context, culture, value)); }
public override TypeConverter.StandardValuesCollection GetStandardValuesCore(ITypeDescriptorContext context, TypeConverter.StandardValuesCollection collection) { List <IComponent> list = CommandBaseConverter.DiscoverCommandsContexts(collection); if (context != null && list != null && (context.GetService(typeof(IDesignerHost)) != null)) { for (int i = (list.Count - 1); i >= 0; i--) { if (list[i].Site == null) { list.RemoveAt(i); } } list.Insert(0, null); } return(new TypeConverter.StandardValuesCollection(list)); }
public static List <IComponent> DiscoverCommandsContexts(List <IComponent> list) { List <IComponent> destinationList = new List <IComponent>(1); for (int index = 0; index < list.Count; ++index) { List <IComponent> sourceList = CommandBaseConverter.DiscoverCommandsContexts(list[index]); if (sourceList != null && sourceList.Count > 0) { CommandBaseConverter.TransferListUniquePart <IComponent>(sourceList, destinationList); } } if (destinationList.Count > 0) { return(destinationList); } return((List <IComponent>)null); }
public override TypeConverter.StandardValuesCollection GetStandardValuesCore( ITypeDescriptorContext context, TypeConverter.StandardValuesCollection collection) { List <IComponent> componentList = CommandBaseConverter.DiscoverCommandsContexts(collection); if (context != null && componentList != null && context.GetService(typeof(IDesignerHost)) != null) { for (int index = componentList.Count - 1; index >= 0; --index) { if (componentList[index].Site == null) { componentList.RemoveAt(index); } } componentList.Insert(0, (IComponent)null); } return(new TypeConverter.StandardValuesCollection((ICollection)componentList)); }
public static List <IComponent> DiscoverCommandsContexts( TypeConverter.StandardValuesCollection collection) { List <IComponent> list = new List <IComponent>(1); List <IComponent> componentList1 = new List <IComponent>(1); for (int index = 0; index < collection.Count; ++index) { IComponent component = collection[index] as IComponent; if (component != null) { list.Add(component); } } List <IComponent> componentList2 = CommandBaseConverter.DiscoverCommandsContexts(list); if (componentList2 != null && componentList2.Count > 0) { return(componentList2); } return((List <IComponent>)null); }
public static List <IComponent> DiscoverCommandsContexts(IComponent source) { if (source == null) { return((List <IComponent>)null); } List <IComponent> destinationList = new List <IComponent>(1); if (typeof(RadControl).IsAssignableFrom(source.GetType()) || typeof(RadItem).IsAssignableFrom(source.GetType())) { CommandBaseConverter.TransferListUniquePart <IComponent>(source, destinationList); } if (source is RadControl) { RootRadElement rootElement = (source as RadControl).RootElement; if (rootElement != null && rootElement.Children.Count > 0) { foreach (RadElement child in rootElement.Children) { IComponent source1 = child as IComponent; if (source1 != null && child is IItemsOwner) { List <IComponent> sourceList = CommandBaseConverter.DiscoverCommandsContexts(source1); if (destinationList != null) { CommandBaseConverter.TransferListUniquePart <IComponent>(sourceList, destinationList); } } } } } if (destinationList.Count > 0) { return(destinationList); } return((List <IComponent>)null); }