Exemplo n.º 1
0
        private SharpTreeNode BuildTreeRoot()
        {
            var root = new SharpTreeNode();

            var list = new List <CallNodeModel>();

            foreach (var thread in Frame.Threads)
            {
                int key  = GetNodeKey(thread.NameId, 0);
                var node = new CallNodeModel(this, Log.GetNodeStats(thread.NameId), thread, key);
                node.IsExpanded = isExpanded[key];
                list.Add(node);
            }

            list = list.OrderBy(n => n.Name).ToList();

            list.Sort((CallNodeModel a, CallNodeModel b) => {
                if (a.InclTime == b.InclTime)
                {
                    return(0);
                }
                return(a.InclTime < b.InclTime ? 1 : -1);
            });

            root.Children.AddRange(list);

            return(root);
        }
Exemplo n.º 2
0
        internal IEnumerable <CallNodeModel> GetChildNodeList(CallNodeModel parent)
        {
            var nodes = new List <CallNodeModel>();

            foreach (var index in Frame.GetChildNodesIndexs(parent.CallRecordIndex))
            {
                int nameId = Frame.Calls[index].ppid;
                int key    = GetNodeKey(nameId, parent.NodeKey);

                var child = new CallNodeModel(this, Log.GetNodeStats(nameId), Frame.Calls[index], index)
                {
                    LazyLoading = Frame.NodeHasChildren(index),
                    NodeKey     = key,
                };

                if (isExpanded[key])
                {
                    child.IsExpanded = true;
                }
                if (key == selectedNodeKey)
                {
                    SelectedNode = child;
                }

                nodes.Add(child);
            }

            return(nodes.OrderByDescending(n => n.InclTime));
        }