예제 #1
0
 private void LoadToolboxItems(ToolBoxList toolbox, References references)
 {
     toolbox.SuspendLayout();
     foreach (Type type in containers)
     {
         ToolboxItem tool = new ToolboxItem(type);
         toolbox.AddToolboxItem(tool, "Containers");
     }
     foreach (Type type in commonControls)
     {
         ToolboxItem tool = new ToolboxItem(type);
         toolbox.AddToolboxItem(tool, "Common Controls");
     }
     foreach (Type type in menusToolbars)
     {
         ToolboxItem tool = new ToolboxItem(type);
         toolbox.AddToolboxItem(tool, "Menus and Toolbars");
     }
     foreach (Type type in commonComponents)
     {
         ToolboxItem tool = new ToolboxItem(type);
         toolbox.AddToolboxItem(tool, "Common Components");
     }
     foreach (Assembly assembly in references.Assemblies)
     {
         LoadAssemblyToolboxItems(toolbox, assembly);
     }
     toolbox.ResumeLayout();
 }
예제 #2
0
        public ToolboxFiller(References references, ToolBoxList toolbox)
        {
            if (toolbox == null)
            {
                throw new ArgumentNullException("toolbox");
            }
            if (references == null)
            {
                throw new ArgumentNullException("references");
            }

            _references = references;
            _references.ReferenceAdded   += OnReferenceAdded;
            _references.ReferenceRemoved += OnReferenceRemoved;
            _toolbox = toolbox;
            LoadToolboxItems(toolbox, references);
        }
예제 #3
0
 private void LoadAssemblyToolboxItems(ToolBoxList toolbox, Assembly assembly)
 {
     _toolbox.SuspendLayout();
     foreach (Type type in assembly.GetTypes())
     {
         if (IsValidToolType(type) && HasEmptyPublicCtor(type))
         {
             ToolboxItem tool = new ToolboxItem(type);
             // If the assembly is not in the GAC assume
             // an assembly with custom controls
             //
             if (assembly.GlobalAssemblyCache)
             {
                 toolbox.AddToolboxItem(tool, "All");
             }
             else
             {
                 toolbox.AddToolboxItem(tool, "Custom Components");
             }
         }
     }
     _toolbox.ResumeLayout();
 }