コード例 #1
0
        internal static AssemblyTreeNode AddAssy(Assembly assy, TypeLibrary typeLib)
        {
            // The assembly might have already been added (this can
            // happen when a previously converted [from com] assembly
            // is opened), if so,
            // find it and make sure the typeLib information is provided
            AssemblyTreeNode atNode = FindAssemblyNode(assy);

            if (atNode != null)
            {
                if (typeLib != null)
                {
                    atNode.TypeLib = typeLib;
                }
                return(atNode);
            }
            ICollection types = null;

            // Only get the types if the control tree is showing because
            // it can take a long time
            if (ComponentInspectorProperties.ShowControlPanel)
            {
                types = GetAssyTypes(assy);
            }
            AssemblyTreeNode node = new AssemblyTreeNode(assy, typeLib);

            if (_assyTree.InvokeRequired)
            {
                _assyTree.Invoke(new BrowserTreeNode.AddLogicalInvoker(_assyRootNode.AddLogicalNode),
                                 new Object[] { node });
                _controlTree.Invoke(new ControlTree.AddAssyInvoker(ControlTree.AddAssy),
                                    new Object[] { assy, types });
            }
            else
            {
                _assyRootNode.AddLogicalNode(node);
                ControlTree.AddAssy(assy, types);
            }
            return(node);
        }
コード例 #2
0
        internal static void Init()
        {
            _comTree                      = new BrowserTree();
            _comTree.Dock                 = DockStyle.Fill;
            _comTree.BorderStyle          = BorderStyle.None;
            _comTree.UseIntermediateNodes = true;

            // Sucks, see comment in BrowserTreeNode.PostConstructor
            _comTree.Font = new Font(_comTree.Font, FontStyle.Bold);
            _comTabPage   = new TabPage();
            _comTabPage.Controls.Add(_comTree);
            _comTabPage.Text        = "ActiveX/COM";
            _comTabPage.BorderStyle = BorderStyle.None;

            // Favorite/recently accessed typelibs
            _favTypeLibNode      = new BrowserTreeNode();
            _favTypeLibNode.Text = StringParser.Parse("${res:ComponentInspector.ComTreeNode.Text}");
            _favTypeLibNode.ChildrenAlreadyAdded = true;
            _favTypeLibNode.SetPresInfo(PresentationMap.COM_FOLDER_TYPELIB);
            _typeLibNode            = new ComTypeLibRootTreeNode();
            _typeLibNode.NodeOrder  = 1;
            _progIdNode             = new ComProgIdRootTreeNode();
            _progIdNode.NodeOrder   = 2;
            _classCatNode           = new ComCatRootTreeNode();
            _classCatNode.NodeOrder = 3;
            _classNode                           = new ComClassRootTreeNode();
            _classNode.NodeOrder                 = 4;
            _interfaceNode                       = new ComInterfaceRootTreeNode();
            _interfaceNode.NodeOrder             = 5;
            _appIdNode                           = new ComAppIdRootTreeNode();
            _appIdNode.NodeOrder                 = 6;
            _registeredNode                      = new BrowserTreeNode();
            _registeredNode.Text                 = StringParser.Parse("${res:ComponentInspector.Registry.Text}");
            _registeredNode.ChildrenAlreadyAdded = true;
            _registeredNode.SetPresInfo(PresentationMap.FOLDER_CLOSED);
            _comTree.AddNode(_favTypeLibNode);
            _comTree.AddNode(_registeredNode);
            _registeredNode.AddLogicalNode(_typeLibNode);
            _registeredNode.AddLogicalNode(_classNode);
            _registeredNode.AddLogicalNode(_classCatNode);
            _registeredNode.AddLogicalNode(_appIdNode);
            _registeredNode.AddLogicalNode(_interfaceNode);
            _registeredNode.AddLogicalNode(_progIdNode);
            _registeredNode.Expand();
            _typelibs = ComponentInspectorProperties.PreviouslyOpenedTypeLibraries;
        }