Ejemplo n.º 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);
        }