Exemple #1
0
        private void Repopulate(bool categorised)
        {
            IDesignerHost   host           = parentServices.GetService(typeof(IDesignerHost)) as IDesignerHost;
            IToolboxService toolboxService = parentServices.GetService(typeof(IToolboxService)) as IToolboxService;

            if (toolboxService == null || host == null)
            {
                return;
            }

            store.Clear();

            ToolboxItemCollection tools = toolboxService.GetToolboxItems(host);

            if (tools == null)
            {
                return;
            }

            ArrayList nodes = new ArrayList(tools.Count);

            CategoryNameCollection catNames = toolboxService.CategoryNames;

            foreach (string name in catNames)
            {
                tools = toolboxService.GetToolboxItems(name, host);
                foreach (ToolboxItem ti in tools)
                {
                    ToolboxItemToolboxNode node = new ToolboxItemToolboxNode(ti);
                    node.Category = name;
                    nodes.Add(node);
                }
            }

            store.SetNodes(nodes);
            EnsureState();
        }
Exemple #2
0
        private void Repopulate(bool categorised)
        {
            IDesignerHost host = parentServices.GetService (typeof (IDesignerHost)) as IDesignerHost;
            IToolboxService toolboxService = parentServices.GetService (typeof (IToolboxService)) as IToolboxService;
            if (toolboxService == null || host == null) return;

            store.Clear ();

            ToolboxItemCollection tools = toolboxService.GetToolboxItems (host);
            if (tools == null) return;

            ArrayList nodes = new ArrayList (tools.Count);

            CategoryNameCollection catNames = toolboxService.CategoryNames;

            foreach (string name in catNames) {
                tools = toolboxService.GetToolboxItems (name, host);
                foreach (ToolboxItem ti in tools) {
                    ToolboxItemToolboxNode node = new ToolboxItemToolboxNode (ti);
                    node.Category = name;
                    nodes.Add (node);
                }
            }

            store.SetNodes (nodes);
            EnsureState ();
        }