Example #1
0
        private void RefreshNode(ComTypeTreeNode node)
        {
            SetImageIndex(node);

            if (node is ComTypeLibraryTreeNode)
            {
                ComTypeLibraryTreeNode comTypeLibraryTreeNode = (ComTypeLibraryTreeNode)node;
                ComTypeLibrary         comTypeLibrary         = comTypeLibraryTreeNode.ComTypeLibrary;

                foreach (ComTypeInfo comTypeInfo in comTypeLibrary.ComTypeInfos)
                {
                    if (comTypeInfo.IsHidden)
                    {
                        continue;
                    }

                    ComTypeInfoTreeNode comTypeInfoTreeNode = new ComTypeInfoTreeNode(comTypeInfo);
                    comTypeLibraryTreeNode.Nodes.Add(comTypeInfoTreeNode);
                    RefreshNode(comTypeInfoTreeNode);
                }
            }
            else if (node is ComTypeInfoTreeNode)
            {
                ComTypeInfoTreeNode comTypeInfoTreeNode = (ComTypeInfoTreeNode)node;
                ComTypeInfo         comTypeInfo         = comTypeInfoTreeNode.ComTypeInfo;

                foreach (ComImplementedTypeInfo comImplementedTypeInfo in comTypeInfo.ImplementedTypes)
                {
                    ComTypeInfoTreeNode impComTypeInfoTreeNode = new ComTypeInfoTreeNode(comImplementedTypeInfo.ComTypeInfo);
                    comTypeInfoTreeNode.Nodes.Add(impComTypeInfoTreeNode);
                    RefreshNode(impComTypeInfoTreeNode);
                }
            }
        }
Example #2
0
        public void RefreshNodes()
        {
            Cursor.Current = Cursors.WaitCursor;

            if (String.IsNullOrWhiteSpace(Filter))
            {
                List <ComTypeTreeNode> nodes = new List <ComTypeTreeNode>();

                try
                {
                    foreach (ComTypeLibrary comTypeLibrary in ComTypeManager.Instance.ComTypeLibraries)
                    {
                        ComTypeLibraryTreeNode comTypeLibraryTreeNode = new ComTypeLibraryTreeNode(comTypeLibrary);
                        nodes.Add(comTypeLibraryTreeNode);
                        RefreshNode(comTypeLibraryTreeNode);
                    }
                }
                catch
                {
                    GlobalExceptionHandler.HandleException();
                }

                Nodes.Clear();
                Nodes.AddRange(nodes.ToArray());
            }
            else
            {
                RefreshNodesFiltered();
            }

            Cursor.Current = Cursors.Default;
        }
Example #3
0
        public void ScanForNodeAndSelect(ComTypeLibrary comTypeLibrary, TreeNodeCollection nodes)
        {
            if (comTypeLibrary == null)
            {
                return;
            }
            if (nodes == null)
            {
                return;
            }
            if (_scanComplete == true)
            {
                return;
            }

            foreach (TreeNode node in nodes)
            {
                ComTypeLibraryTreeNode comTypeLibraryTreeNode = node as ComTypeLibraryTreeNode;

                if (comTypeLibraryTreeNode != null)
                {
                    if (comTypeLibraryTreeNode.ComTypeLibrary.Name.Equals(comTypeLibrary.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        _scanComplete = true;
                        node.TreeView.SelectedNode = node;
                        node.EnsureVisible();
                        return;
                    }
                }
            }
        }
Example #4
0
        private void SetImageIndex(ComTypeTreeNode comTypeTreeNode)
        {
            ComTypeLibraryTreeNode  comTypeLibraryTreeNode  = comTypeTreeNode as ComTypeLibraryTreeNode;
            ComTypeInfoTreeNode     comTypeInfoTreeNode     = comTypeTreeNode as ComTypeInfoTreeNode;
            ComFunctionInfoTreeNode comFunctionInfoTreeNode = comTypeTreeNode as ComFunctionInfoTreeNode;
            ComPropertyInfoTreeNode comPropertyInfoTreeNode = comTypeTreeNode as ComPropertyInfoTreeNode;
            ComVariableInfoTreeNode comVariableInfoTreeNode = comTypeTreeNode as ComVariableInfoTreeNode;

            if (comTypeLibraryTreeNode != null)
            {
                comTypeTreeNode.ImageIndex = ComTypeNodeNamespaceImageIndex;
            }
            else if (comTypeInfoTreeNode != null)
            {
                ComTypeInfo comTypeInfo = comTypeInfoTreeNode.ComTypeInfo;

                if (comTypeInfo.IsCoClass)
                {
                    comTypeTreeNode.ImageIndex = ComTypeNodeClassImageIndex;
                }
                else if (comTypeInfo.IsDispatch)
                {
                    comTypeTreeNode.ImageIndex = ComTypeNodeInterfaceImageIndex;
                }
                else if (comTypeInfo.IsInterface)
                {
                    comTypeTreeNode.ImageIndex = ComTypeNodeInterfaceImageIndex;
                }
                else if (comTypeInfo.IsEnum)
                {
                    comTypeTreeNode.ImageIndex = ComTypeNodeEnumImageIndex;
                }
                else if (comTypeInfo.IsAlias)
                {
                    comTypeTreeNode.ImageIndex = ComTypeNodeAliasImageIndex;
                }
                else if (comTypeInfo.IsRecord)
                {
                    comTypeTreeNode.ImageIndex = ComTypeNodeStructureImageIndex;
                }
            }
            else if (comFunctionInfoTreeNode != null)
            {
                comTypeTreeNode.ImageIndex = ComTypeNodeMethodImageIndex;
            }
            else if (comPropertyInfoTreeNode != null)
            {
                comTypeTreeNode.ImageIndex = ComTypeNodePropertyImageIndex;
            }
            else if (comVariableInfoTreeNode != null)
            {
                comVariableInfoTreeNode.ImageIndex = ComTypeNodeConstantImageIndex;
            }

            comTypeTreeNode.SelectedImageIndex = comTypeTreeNode.ImageIndex;
        }
Example #5
0
        private void comTypeTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            _navigationController.Remove(comTypeListView.Items.OfType <ListViewItem>().ToArray());
            _navigationController.CurrentItem = e.Node;

            ComTypeLibraryTreeNode  comTypeLibraryTreeNode  = e.Node as ComTypeLibraryTreeNode;
            ComTypeInfoTreeNode     comTypeInfoTreeNode     = e.Node as ComTypeInfoTreeNode;
            ComFunctionInfoTreeNode comFunctionInfoTreeNode = e.Node as ComFunctionInfoTreeNode;
            ComPropertyInfoTreeNode comPropertyInfoTreeNode = e.Node as ComPropertyInfoTreeNode;
            ComVariableInfoTreeNode comVariableInfoTreeNode = e.Node as ComVariableInfoTreeNode;

            comTypeListView.SelectedComTypeInfo = null;

            if (comTypeLibraryTreeNode != null)
            {
                typeInfoRichTextBox.DescribeComTypeLibrary(comTypeLibraryTreeNode.ComTypeLibrary);
            }
            else if (comTypeInfoTreeNode != null)
            {
                ComTypeInfo comTypeInfo = comTypeInfoTreeNode.ComTypeInfo;
                comTypeListView.SelectedComTypeInfo = comTypeInfo;
                typeInfoRichTextBox.DescribeComTypeInfo(comTypeInfo);
            }
            else if (comFunctionInfoTreeNode != null)
            {
                typeInfoRichTextBox.DescribeComFunctionInfo(comFunctionInfoTreeNode.ComFunctionInfo);
            }
            else if (comPropertyInfoTreeNode != null)
            {
                typeInfoRichTextBox.DescribeComPropertyInfo(comPropertyInfoTreeNode.ComPropertyInfo);
            }
            else if (comVariableInfoTreeNode != null)
            {
                typeInfoRichTextBox.DescribeComVariableInfo(comVariableInfoTreeNode.ComVariableInfo);
            }
        }