internal static IList<IComponent> GetAllComponents(IComponent component, IsValidComponentDelegate componentFilter)
 {
     List<IComponent> list = new List<IComponent>();
     while (component != null)
     {
         IList<IComponent> componentsInContainer = GetComponentsInContainer(component, componentFilter);
         list.AddRange(componentsInContainer);
         IDesignerHost service = (IDesignerHost) component.Site.GetService(typeof(IDesignerHost));
         ControlDesigner designer = service.GetDesigner(component) as ControlDesigner;
         component = null;
         if (((designer != null) && (designer.View != null)) && (designer.View.NamingContainerDesigner != null))
         {
             component = designer.View.NamingContainerDesigner.Component;
         }
     }
     return list;
 }
Пример #2
0
        internal static IList <IComponent> GetAllComponents(IComponent component, IsValidComponentDelegate componentFilter)
        {
            List <IComponent> list = new List <IComponent>();

            while (component != null)
            {
                IList <IComponent> componentsInContainer = GetComponentsInContainer(component, componentFilter);
                list.AddRange(componentsInContainer);
                IDesignerHost   service  = (IDesignerHost)component.Site.GetService(typeof(IDesignerHost));
                ControlDesigner designer = service.GetDesigner(component) as ControlDesigner;
                component = null;
                if (((designer != null) && (designer.View != null)) && (designer.View.NamingContainerDesigner != null))
                {
                    component = designer.View.NamingContainerDesigner.Component;
                }
            }
            return(list);
        }
 private static IList<IComponent> GetComponentsInContainer(IComponent component, IsValidComponentDelegate componentFilter)
 {
     List<IComponent> list = new List<IComponent>();
     if ((component.Site != null) && (component.Site.Container != null))
     {
         foreach (IComponent component2 in component.Site.Container.Components)
         {
             if (componentFilter(component2) && !Marshal.IsComObject(component2))
             {
                 PropertyDescriptor descriptor = TypeDescriptor.GetProperties(component2)["Modifiers"];
                 if (descriptor != null)
                 {
                     MemberAttributes attributes = (MemberAttributes) descriptor.GetValue(component2);
                     if ((attributes & MemberAttributes.AccessMask) == MemberAttributes.Private)
                     {
                         continue;
                     }
                 }
                 list.Add(component2);
             }
         }
     }
     return list;
 }
Пример #4
0
        private static IList <IComponent> GetComponentsInContainer(IComponent component, IsValidComponentDelegate componentFilter)
        {
            List <IComponent> list = new List <IComponent>();

            if ((component.Site != null) && (component.Site.Container != null))
            {
                foreach (IComponent component2 in component.Site.Container.Components)
                {
                    if (componentFilter(component2) && !Marshal.IsComObject(component2))
                    {
                        PropertyDescriptor descriptor = TypeDescriptor.GetProperties(component2)["Modifiers"];
                        if (descriptor != null)
                        {
                            MemberAttributes attributes = (MemberAttributes)descriptor.GetValue(component2);
                            if ((attributes & MemberAttributes.AccessMask) == MemberAttributes.Private)
                            {
                                continue;
                            }
                        }
                        list.Add(component2);
                    }
                }
            }
            return(list);
        }