private void openToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult dr = ofdConcentra.ShowDialog(); if (dr != DialogResult.Abort || dr != DialogResult.Cancel) { ReadConcentraFileV2(ofdConcentra.FileName); } foreach (LFNode l in lfList) { for (int i = 0; i < lfList.Count(); i++) { if (l.PID == lfList[i].ID) { lfList[i].Children.Add(l.ID); // lfDict[lfList[i].ID].Children.Add(l.ID); } } } LFTreeNode tn = new LFTreeNode(lfDict["root"]); foreach (string s in lfDict["root"].Children) { LoadTreeView(tn, lfDict[s]); } tvLogicFlow.Nodes.Add(tn); }
private void UpdateIDs(LFTreeNode lfTN) { lfTN.LogicFlow.ID = "root"; int counter = 1; foreach (LFTreeNode child in lfTN.Nodes) { string id = counter.ToString(); UpdateIDs(child, counter, id); counter++; } }
private void UpdateIDs(LFTreeNode lfTN, int c, string id) { lfTN.LogicFlow.ID = id; int counter = 1; foreach (LFTreeNode child in lfTN.Nodes) { StringBuilder sb = new StringBuilder(); sb.Append(id + "." + counter.ToString()); UpdateIDs(child, counter, sb.ToString()); counter++; } }
private void LoadTreeView(LFTreeNode parent, LFNode child) { LFTreeNode newNode = new LFTreeNode(child); newNode.Tag = child; parent.Nodes.Add(newNode); foreach (string s in child.Children) { if (child.Children.Count != 0) { LoadTreeView(newNode, lfDict[s]); } } }
private void tvLogicFlow_AfterSelect(object sender, TreeViewEventArgs e) { foreach (LFTreeNode N in tvLogicFlow.Nodes) { UpdateIDs(N); } LFTreeNode selected = (LFTreeNode)e.Node; txtContent.Text = selected.LogicFlow.Text; textBox2.Text = selected.LogicFlow.ID; lblCurrentNodeValue.Text = selected.LogicFlow.ID; txtSCB.Text = selected.LogicFlow.ShowCheckBox; txtEL2Code.Text = selected.LogicFlow.EndLevel2Code; }
private void tvLogicFlow_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.X && e.Modifiers == Keys.Control) { clipboard = ((LFTreeNode)tvLogicFlow.SelectedNode); if (clipboard.LogicFlow.ID == "root") { MessageBox.Show("Can not cut the root node."); return; } tvLogicFlow.SelectedNode.Remove(); } if (e.KeyCode == Keys.V && e.Modifiers == Keys.Control) { tvLogicFlow.SelectedNode.Nodes.Insert(0, (LFTreeNode)clipboard); clipboard = null; } if (e.KeyCode == Keys.Insert) { tvLogicFlow.SelectedNode.Nodes.Insert(0, new LFTreeNode(new LFNode())); tvLogicFlow.SelectedNode.Nodes[0].BackColor = Color.Red; } }
private void tvLogicFlow_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.X && e.Modifiers == Keys.Control) { clipboard = ((LFTreeNode)tvLogicFlow.SelectedNode); if (clipboard.LogicFlow.ID == "root") { MessageBox.Show("Can not cut the root node."); return; } tvLogicFlow.SelectedNode.Remove(); } if (e.KeyCode == Keys.V && e.Modifiers == Keys.Control) { tvLogicFlow.SelectedNode.Nodes.Insert(0,(LFTreeNode)clipboard); clipboard = null; } if (e.KeyCode == Keys.Insert) { tvLogicFlow.SelectedNode.Nodes.Insert(0, new LFTreeNode(new LFNode())); tvLogicFlow.SelectedNode.Nodes[0].BackColor = Color.Red; } }