private void mainUpdateTimer_Tick(object sender, EventArgs e) { mainUpdateTimer.Enabled = false; try { bool refreshCount = false; foreach (TreeNode tnCateg in searchTreeView.Nodes) { S6xNavInfo niMFHeaderCateg = new S6xNavInfo(elemsTreeView.Nodes[tnCateg.Name]); if (!niMFHeaderCateg.isValid) { tnCateg.Nodes.Clear(); continue; } List <TreeNode> lsRemoval = new List <TreeNode>(); foreach (TreeNode tnNode in tnCateg.Nodes) { TreeNode tnMainNode = niMFHeaderCateg.FindElement(tnNode.Name); if (tnMainNode == null) { lsRemoval.Add(tnNode); continue; } if (tnMainNode.Text != tnNode.Text) { tnNode.Text = tnMainNode.Text; } if (tnMainNode.ToolTipText != tnNode.ToolTipText) { tnNode.ToolTipText = tnMainNode.ToolTipText; } if (tnMainNode.StateImageKey != tnNode.StateImageKey) { tnNode.StateImageKey = tnMainNode.StateImageKey; } } foreach (TreeNode tnNode in lsRemoval) { tnCateg.Nodes.Remove(tnNode); } refreshCount |= lsRemoval.Count > 0; } if (refreshCount) { searchTreeViewCount(); } mainUpdateTimer.Enabled = true; } catch { } }
public TreeNode FindElement(string nodeName) { if (DirectNodes.ContainsKey(nodeName)) { return(DirectNodes[nodeName]); } foreach (TreeNode tnCategoryNode in DirectCategoryNodes) { S6xNavInfo niCateg = new S6xNavInfo(tnCategoryNode); TreeNode tnResult = niCateg.FindElement(nodeName); if (tnResult != null) { return(tnResult); } } return(null); }
private void searchTreeView_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node.Parent == null) { return; } S6xNavInfo niMFHeaderCateg = new S6xNavInfo(elemsTreeView.Nodes[e.Node.Parent.Name]); if (!niMFHeaderCateg.isValid) { return; } TreeNode tnMFNode = niMFHeaderCateg.FindElement(e.Node.Name); if (tnMFNode == null) { return; } try { elemsTreeView.SelectedNode = tnMFNode; } catch { } tnMFNode = null; niMFHeaderCateg = null; }
private void Search(string Mode) { if (sadS6x == null) { return; } if (elemsTreeView == null) { return; } List <string[]> results = null; switch (Mode) { case "ARGSROUTINES": results = SearchArgsRoutines(); break; case "ADVROUTINES": results = SearchAdvancedRoutines(); break; default: if (searchTextBox.Text == string.Empty) { return; } results = SearchText(searchTextBox.Text.ToLower()); break; } mainUpdateTimer.Enabled = false; searchTreeView.BeginUpdate(); searchTreeViewInit(); foreach (string[] result in results) { S6xNavInfo niMFHeaderCateg = new S6xNavInfo(elemsTreeView.Nodes[result[0]]); if (!niMFHeaderCateg.isValid) { continue; } TreeNode parentNode = searchTreeView.Nodes[niMFHeaderCateg.HeaderCategoryName]; if (parentNode == null) { continue; } TreeNode tnMFNode = niMFHeaderCateg.FindElement(result[1]); if (tnMFNode == null) { continue; } if (parentNode.Nodes.ContainsKey(result[1])) { continue; } TreeNode tnNode = new TreeNode(); tnNode.Name = tnMFNode.Name; tnNode.Text = tnMFNode.Text; tnNode.ToolTipText = tnMFNode.ToolTipText; tnNode.StateImageKey = tnMFNode.StateImageKey; parentNode.Nodes.Add(tnNode); } searchTreeViewCount(); searchTreeView.EndUpdate(); mainUpdateTimer.Enabled = true; }
private void calibChart_MouseClick(object sender, MouseEventArgs e) { Chart cChart = (Chart)sender; Axis xAxis = cChart.ChartAreas[0].AxisX; double pPos = (int)xAxis.PixelPositionToValue(e.Location.X); foreach (CustomLabel cLabel in xAxis.CustomLabels) { if (pPos >= cLabel.FromPosition && pPos <= cLabel.ToPosition) { if (cLabel.Tag == null) { return; } if (cLabel.Tag.GetType() == typeof(S6xTable)) { try { S6xTable s6xTable = (S6xTable)cLabel.Tag; mainToolTip.SetToolTip((Control)sender, s6xTable.Label + "\r\n" + s6xTable.UniqueAddressHex + "\r\n" + s6xTable.ShortLabel + "\r\n\r\n" + s6xTable.Comments); if (cChart == calibCurrentChart) { S6xNavInfo niMFHeaderCateg = new S6xNavInfo(elemsTreeView.Nodes[S6xNav.getHeaderCategName(S6xNavHeaderCategory.TABLES)]); if (niMFHeaderCateg.isValid) { TreeNode tnMFNode = niMFHeaderCateg.FindElement(s6xTable.UniqueAddress); if (tnMFNode != null) { elemsTreeView.SelectedNode = tnMFNode; } tnMFNode = null; } niMFHeaderCateg = null; } } catch { } } else if (cLabel.Tag.GetType() == typeof(S6xFunction)) { try { S6xFunction s6xFunction = (S6xFunction)cLabel.Tag; mainToolTip.SetToolTip((Control)sender, s6xFunction.Label + "\r\n" + s6xFunction.UniqueAddressHex + "\r\n" + s6xFunction.ShortLabel + "\r\n\r\n" + s6xFunction.Comments); if (cChart == calibCurrentChart) { S6xNavInfo niMFHeaderCateg = new S6xNavInfo(elemsTreeView.Nodes[S6xNav.getHeaderCategName(S6xNavHeaderCategory.FUNCTIONS)]); if (niMFHeaderCateg.isValid) { TreeNode tnMFNode = niMFHeaderCateg.FindElement(s6xFunction.UniqueAddress); if (tnMFNode != null) { elemsTreeView.SelectedNode = tnMFNode; } tnMFNode = null; } niMFHeaderCateg = null; } } catch { } } return; } } }