コード例 #1
0
        internal static IDictionary <Type, DataControlFieldDesigner> GetCustomFieldDesigners(DesignerForm designerForm, DataBoundControl control)
        {
            Dictionary <Type, DataControlFieldDesigner> dictionary = new Dictionary <Type, DataControlFieldDesigner>();
            ITypeDiscoveryService service = (ITypeDiscoveryService)control.Site.GetService(typeof(ITypeDiscoveryService));

            if (service != null)
            {
                foreach (Type type in service.GetTypes(typeof(DataControlField), false))
                {
                    DesignerAttribute customAttribute = (DesignerAttribute)Attribute.GetCustomAttribute(type, typeof(DesignerAttribute));
                    if (customAttribute != null)
                    {
                        Type type2 = Type.GetType(customAttribute.DesignerTypeName, false, true);
                        if ((type2 != null) && type2.IsSubclassOf(typeof(DataControlFieldDesigner)))
                        {
                            try
                            {
                                DataControlFieldDesigner designer = (DataControlFieldDesigner)Activator.CreateInstance(type2);
                                if (designer.IsEnabled(control))
                                {
                                    designer.DesignerForm = designerForm;
                                    dictionary.Add(type, designer);
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                }
            }
            return(dictionary);
        }
 public DataControlFieldDesignerNode(DataControlFieldDesigner fieldDesigner, IDataSourceFieldSchema fieldSchema) : base((fieldSchema == null) ? fieldDesigner.DefaultNodeText : fieldSchema.Name, 15)
 {
     this._fieldSchema = fieldSchema;
     this._fieldDesigner = fieldDesigner;
 }
 public DataControlFieldDesignerNode(DataControlFieldDesigner fieldDesigner) : base(fieldDesigner.DefaultNodeText, 15)
 {
     this._fieldDesigner = fieldDesigner;
 }
 public DataControlFieldDesignerItem(DataControlFieldDesigner fieldDesigner, DataControlField runtimeField) : base(null, runtimeField, 15)
 {
     this._fieldDesigner = fieldDesigner;
     base.Text = this.GetDefaultNodeText();
 }
 public DataControlFieldDesignerControl(DataBoundControlDesigner controlDesigner, IServiceProvider serviceProvider, DataControlFieldDesigner designer, IDataSourceFieldSchema[] fieldSchemas, System.Type controlType) : base(fieldSchemas, controlType)
 {
     this._controlDesigner = controlDesigner;
     this._serviceProvider = serviceProvider;
     this._designer = designer;
     this.Initialize();
 }
 public DynamicDataFieldControl(DataControlFieldDesigner dynamicFieldDesigner, IDataSourceFieldSchema[] fieldSchemas, System.Type controlType) : base(fieldSchemas, controlType)
 {
     this._designer = dynamicFieldDesigner;
 }