示例#1
0
        ICollection IComponentDiscoveryService.GetComponentTypes(IDesignerHost designerHost, System.Type baseType)
        {
            Hashtable             hashtable    = new Hashtable();
            ToolboxItemCollection toolboxItems = ((IToolboxService)this).GetToolboxItems();

            if (toolboxItems != null)
            {
                System.Type type = typeof(IComponent);
                TypeDescriptionProviderService service  = null;
                TypeDescriptionProvider        provider = null;
                if (designerHost != null)
                {
                    service = designerHost.GetService(typeof(TypeDescriptionProviderService)) as TypeDescriptionProviderService;
                }
                foreach (ToolboxItem item in toolboxItems)
                {
                    System.Type c = item.GetType(designerHost);
                    if (((c != null) && type.IsAssignableFrom(c)) && ((baseType == null) || baseType.IsAssignableFrom(c)))
                    {
                        if (service != null)
                        {
                            provider = service.GetProvider(c);
                            if ((provider != null) && !provider.IsSupportedType(c))
                            {
                                continue;
                            }
                        }
                        hashtable[c] = c;
                    }
                }
            }
            return(hashtable.Values);
        }
示例#2
0
        void AddTargetFrameworkProvider(IComponent component)
        {
            TypeDescriptionProviderService typeDescriptionProviderService = GetService(typeof(TypeDescriptionProviderService)) as TypeDescriptionProviderService;

            if (typeDescriptionProviderService != null && component != null)
            {
                TypeDescriptor.AddProvider(typeDescriptionProviderService.GetProvider(component), component);
            }
        }
示例#3
0
        private void AddTargetFrameworkProvider(IComponent component)
        {
            TypeDescriptionProviderService service = base.GetService(typeof(TypeDescriptionProviderService)) as TypeDescriptionProviderService;

            if ((service != null) && (component != null))
            {
                TypeDescriptor.AddProvider(service.GetProvider(component), component);
            }
        }
示例#4
0
        private static TypeDescriptionProvider GetTargetFrameworkProvider(Type type)
        {
            TypeDescriptionProviderService service = TargetFrameworkUtil.TypeDescriptionProviderService;

            if (service != null)
            {
                return(service.GetProvider(type));
            }
            return(null);
        }
示例#5
0
        protected virtual Type GetType(string typeName)
        {
            Type runtimeType = this.GetRuntimeType(typeName);

            if (runtimeType != null)
            {
                TypeDescriptionProviderService service = this.GetService(typeof(TypeDescriptionProviderService)) as TypeDescriptionProviderService;
                if ((service != null) && !service.GetProvider(runtimeType).IsSupportedType(runtimeType))
                {
                    runtimeType = null;
                }
            }
            return(runtimeType);
        }
示例#6
0
            private TypeDescriptionProvider GetTargetFrameworkProviderForType(Type type)
            {
                if (m_manager == null)
                {
                    return(null);
                }

                TypeDescriptionProviderService service = m_manager.GetService(typeof(TypeDescriptionProviderService)) as TypeDescriptionProviderService;

                if (service == null)
                {
                    return(null);
                }

                return(service.GetProvider(type));
            }