/// <summary> /// 查找下一个 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tbNext_Click(object sender, System.EventArgs e) { //指示查询 名称还是tag 默认查名称 bool TextOrTag = false; //查询的字符串 string strSearch = ""; if (this.rbTag.Checked) { TextOrTag = true; } if (comSearchText.DropDownStyle == System.Windows.Forms.ComboBoxStyle.Simple) { strSearch = comSearchText.Text; } else { #region 拉框选择 if (this.rbText.Checked) { strSearch = comSearchText.Text; } else { if (comSearchText.Tag != null) { strSearch = comSearchText.Tag.ToString(); } else { strSearch = ""; } } #endregion } this.treeView.SelectedNode = fun.FindTreeNodeByDepth(treeView.Nodes, strSearch, TextOrTag, cbExact.Checked, this.cbUper.Checked); if (fun.CurrentNode >= treeView.GetNodeCount(true)) { if (fun.LaserNode == 0 && treeView.SelectedNode == null) { MessageBox.Show("查找不到 (" + comSearchText.Text + ")"); } else if (fun.LaserNode != 0 && treeView.SelectedNode == null) { MessageBox.Show("查找回到起始点"); fun.CurrentNode = 0; fun.LaserNode = 0; } } fun.LaserNode = fun.CurrentNode; fun.CurrentNode = 0; }
private void TreeBasedSettingsDialog_Load(object sender, System.EventArgs e) { foreach (SettingsPage page in SettingsPages) { AddBranchToTree(treeView1.Nodes, page.Key); } if (treeView1.VisibleCount >= treeView1.GetNodeCount(true)) { treeView1.ExpandAll(); } SelectInitialPage(); treeView1.Select(); }
/// <summary> /// Updates the text associated with each item of the check list. /// </summary> public void UpdateText() { if (checkedItems.Count == 0) { Text = string.Empty; } else { if (checkedItems.Count == checkedTreeView.GetNodeCount(true) && CheckAllText != null) { Text = CheckAllText; } else { var selNodes = checkedItems.FindAll(n => !string.IsNullOrEmpty(n.Name)).ConvertAll <string>(t => (string)t.Name); selNodes.Sort(); Text = string.Join(", ", selNodes.ToArray()); } } }
public void ToggleShowSelectedNodes(bool showSelectedNodes, TreeView root = null) { Plugin.OnlyShowFrequentlyUsedNodes = showSelectedNodes; Settings.Default.OnlyShowFrequentlyUsedNodes = Plugin.OnlyShowFrequentlyUsedNodes; Plugin.SetFrequentlyUsedNodeGroups(); if (root == null) { root = this.treeView; } root.BeginUpdate(); root.Nodes.Clear(); IList<NodeGroup> nodeGroups = Plugin.OnlyShowFrequentlyUsedNodes ? Plugin.FrequentlyUsedNodeGroups : Plugin.NodeGroups; foreach(NodeGroup group in nodeGroups) { group.Register(root.Nodes); } if (root.GetNodeCount(false) > 0) { UIUtilities.SortTreeview(root.Nodes); root.SelectedNode = this.treeView.Nodes[0]; } root.EndUpdate(); }
public static void calculateO2TraceBlocksIntoTreeView(Dictionary<String, O2TraceBlock_OunceV6> dO2TraceBlock, ref TreeView tvTargetTreeView) { DI.log.info("incalculateO2TraceBlocksIntoTreeView: {0}", dO2TraceBlock.Keys.Count); O2Timer tTimer = new O2Timer("Calculating Raw Data TreeView").start(); tvTargetTreeView = new TreeView(); var itemsProcessed = 0; var itemsToProcess = dO2TraceBlock.Keys.Count; var updateInterval = 1000; foreach (var sSignature in dO2TraceBlock.Keys) { if (itemsProcessed++ % updateInterval == 0) DI.log.info("[{0}/{1}]", itemsProcessed, itemsToProcess); O2TraceBlock_OunceV6 otdO2TraceBlockOunceV6 = dO2TraceBlock[sSignature]; //String sRootNodeText = String.Format("{0} {1} {2}", otdO2TraceBlockOunceV6.sSignature, System.IO.Path.GetFileName(otdO2TraceBlockOunceV6.sFile),otdO2TraceBlockOunceV6.sLineNumber); String sRootNodeText = String.Format("{0} {1} {2}", otdO2TraceBlockOunceV6.sSignature, otdO2TraceBlockOunceV6.sFile, otdO2TraceBlockOunceV6.sLineNumber); TreeNode tnRootNode = O2Forms.newTreeNode(sRootNodeText, sRootNodeText, 0, otdO2TraceBlockOunceV6); // handle Sinks TreeNode tnSinks = O2Forms.newTreeNode("Sinks", "Sinks", 0, null); foreach (AssessmentAssessmentFileFinding fFinding in otdO2TraceBlockOunceV6.dSinks.Keys) { String sSink = getUniqueSignature(fFinding, TraceType.Known_Sink, otdO2TraceBlockOunceV6.dSinks[fFinding], true); // analysis.Analysis.getSink(fFinding, otdO2TraceBlockOunceV6.dSinks[fFinding]); if (!string.IsNullOrEmpty(sSink) || sSink != sRootNodeText) { TreeNode tnSink = O2Forms.newTreeNode(sSink, sSink, 0, null); tnSinks.Nodes.Add(tnSink); } } tnRootNode.Nodes.Add(tnSinks); TreeNode tnSources = O2Forms.newTreeNode("Sources", "Sources", 0, null); foreach (AssessmentAssessmentFileFinding fFinding in otdO2TraceBlockOunceV6.dSources.Keys) { String sSource = getUniqueSignature(fFinding, TraceType.Source, otdO2TraceBlockOunceV6.dSources[fFinding], true); if (sSource == "" || sSource == null || sSource != sRootNodeText) { TreeNode tnSource = O2Forms.newTreeNode(sSource, sSource, 0, null); tnSources.Nodes.Add(tnSource); } } tnRootNode.Nodes.Add(tnSources); tvTargetTreeView.Nodes.Add(tnRootNode); } DI.log.info("[{0}/{1}]", itemsProcessed, itemsToProcess); //tvTargetTreeView.Sort(); // removed for performance reasons //tvAllTraces.Nodes.AddRange(tvRawData.Nodes); //tvAllTraces = tvRawData; tTimer.stop(); DI.log.info("Tree View with Raw Data Calculated: It has {0} ({1}) Nodes (SubNodes)", tvTargetTreeView.GetNodeCount(false), tvTargetTreeView.GetNodeCount(true)); }