/// <summary> /// Load code coverage data. /// </summary> /// <param name="path">Path to the coverage data.</param> /// <param name="newPathPrefix">New path prefix for files.</param> public void LoadCoverageData(string path, string newPathPrefix) { // Clear any existing values _grdCoverage.Nodes.Clear(); SelectedFile = null; _lblFile.Text = null; _txtSource.Text = null; // Load the coverage data CoverageDataPath = path; CoverageData = XDocument.Load(path); IEnumerable <CoverageItem> data = CoverageItem.Parse(CoverageData, newPathPrefix); Highlighting = new Dictionary <string, List <CoverageItem> >(); // Populate the grid foreach (CoverageItem assemblyItem in data) { TreeGridNode assemblyNode = CreateCoverageNode(null, assemblyItem); foreach (CoverageItem namespaceItem in assemblyItem.Children) { TreeGridNode namespaceNode = CreateCoverageNode(assemblyNode, namespaceItem); foreach (CoverageItem typeItem in namespaceItem.Children) { TreeGridNode typeNode = CreateCoverageNode(namespaceNode, typeItem); foreach (CoverageItem methodItem in typeItem.Children) { CreateCoverageNode(typeNode, methodItem); foreach (CoverageItem blockItem in methodItem.Children) { List <CoverageItem> intervals = null; if (!Highlighting.TryGetValue(blockItem.File, out intervals)) { intervals = new List <CoverageItem>(); Highlighting[blockItem.File] = intervals; } intervals.Add(blockItem); } } typeNode.Collapse(); } } } // Sort the highlights (see HighlightComparer for more details) foreach (List <CoverageItem> list in Highlighting.Values) { list.Sort(CoverageItem.HighlightComparer); } }
private void treeGridView1_DoubleClick(object sender, EventArgs e) { if (treeGridView1.SelectedCells.Count > 0) { int index = treeGridView1.SelectedCells[0].RowIndex; TreeGridNode node = treeGridView1.Rows[index] as TreeGridNode; if (node.Nodes.Count > 0 && false == node.IsExpanded) node.Expand(); else { if (node.Nodes.Count > 0 && true == node.IsExpanded) node.Collapse(); } } }
private void PopulateTreeGridNode(TreeGridNode rootNode, ProxyTreeGridRenderer NodeDetails) { TreeGridNode node = new TreeGridNode(); rootNode.Nodes.Add(node); PopulateNode(node, NodeDetails); node.ImageIndex = 0; node.Collapse(); if (NodeDetails.HasSubNode || NodeDetails.ObjectId != 0) { TreeGridNode treenodeDummyChildNode = new TreeGridNode(); node.Nodes.Add(treenodeDummyChildNode); treenodeDummyChildNode.Cells[0].Value = BusinessConstants.DB4OBJECTS_DUMMY; if (NodeDetails.HasSubNode && NodeDetails.ObjectId == 0) node.Tag = NodeDetails.SubObject; } }
public void ExpandAll(bool tag = true) { //关闭全部 for (int i = 0; i < this.Nodes.Count; i++) { TreeGridNode node = this.Nodes[i]; if (node != null) { if (tag) { node.Expand(); } else { node.Collapse(); } } } }
private void PopulateTreeGridNode(TreeGridNode rootNode, ProxyTreeGridRenderer NodeDetails) { TreeGridNode node = new TreeGridNode(); rootNode.Nodes.Add(node); PopulateNode(node, NodeDetails); node.ImageIndex = 0; node.Collapse(); if (NodeDetails.HasSubNode || NodeDetails.ObjectId != 0) { TreeGridNode treenodeDummyChildNode = new TreeGridNode(); node.Nodes.Add(treenodeDummyChildNode); treenodeDummyChildNode.Cells[0].Value = BusinessConstants.DB4OBJECTS_DUMMY; if (NodeDetails.HasSubNode && NodeDetails.ObjectId == 0) { node.Tag = NodeDetails.SubObject; } } }