示例#1
0
 public void OnMethod(MethodTreeNode node)
 {
     Level = 3;
 }
示例#2
0
        void OnReportOpened(object sender, EventArgs e)
        {
            BeginUpdate();

            var report = serviceContainer.getService <IReportService>().Report;

            foreach (var assembly in report.Assemblies)
            {
                var asmNode = new AssemblyTreeNode(assembly);
                Nodes.Add(asmNode);

                foreach (var dType in assembly.Types)
                {
                    var namespaceNode = GetNamespaceNode(asmNode, dType);
                    var classNode     = new ClassTreeNode(dType);
                    namespaceNode.Nodes.Add(classNode);

                    var props = new Dictionary <string, PropertyTreeNode>();
                    foreach (var md in dType.Methods)
                    {
                        if (!Methods.IsSpecial(md.Flags))
                        {
                            AddMethodTreeNode(classNode, md);
                            continue;
                        }

                        //has special meaning
                        var mdSpecial = Methods.GetMdSpecial(md.Name);
                        if (mdSpecial == MdSpecial.Unknown)
                        {
                            AddMethodTreeNode(classNode, md);
                            continue;
                        }

                        var propName = Methods.GetMdSpecialName(md.Name);

                        PropertyTreeNode propertyNode;
                        if (!props.TryGetValue(propName, out propertyNode))
                        {
                            propertyNode    = new PropertyTreeNode(propName);
                            props[propName] = propertyNode;
                            classNode.Nodes.Add(propertyNode);
                        }

                        var mdNode = new MethodTreeNode(md)
                        {
                            //MethodName = mdSpecial.ToString().ToLowerInvariant()
                        };

                        switch (mdSpecial)
                        {
                        case MdSpecial.Get:
                            mdNode.ImageIndex         = ImageSelector.ForPropertyGet(md);
                            mdNode.SelectedImageIndex = ImageSelector.ForPropertyGet(md);
                            propertyNode.Getter       = mdNode;
                            break;

                        case MdSpecial.Remove:
                            mdNode.ImageIndex         = ImageSelector.ForEventRemove(md);
                            mdNode.SelectedImageIndex = ImageSelector.ForEventRemove(md);
                            propertyNode.Getter       = mdNode;
                            break;

                        case MdSpecial.Set:
                            mdNode.ImageIndex         = ImageSelector.ForPropertySet(md);
                            mdNode.SelectedImageIndex = ImageSelector.ForPropertySet(md);
                            propertyNode.Setter       = mdNode;
                            break;

                        case MdSpecial.Add:
                            mdNode.ImageIndex         = ImageSelector.ForEventAdd(md);
                            mdNode.SelectedImageIndex = ImageSelector.ForEventAdd(md);
                            propertyNode.Setter       = mdNode;
                            break;
                        }
                    }

                    foreach (var kv in props)
                    {
                        if (kv.Value.Getter != null)
                        {
                            kv.Value.Nodes.Add(kv.Value.Getter);
                        }
                        if (kv.Value.Setter != null)
                        {
                            kv.Value.Nodes.Add(kv.Value.Setter);
                        }
                    }
                }

                asmNode.UpdateCoverageInfo();
            }

            EndUpdate();
        }