// context Menue Group private void addGroupToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode clickedNode = treeViewTrade.SelectedNode; EditGroup editDialog = new EditGroup("new", clickedNode.Name == "1"); if (editDialog.ShowDialog() == DialogResult.OK) { int maxId = buySellGroups.Max(x => x.id); BuySellGroup newGroup = new BuySellGroup(maxId + 1, editDialog.groupName, clickedNode.Parent.Name, 9999, editDialog.isBuy, editDialog.priceLevel); buySellGroups.Add(newGroup); ResortGroup(clickedNode); RebuildTree(); toolStripStatusLabel.Text = string.Format("Group {0} added", newGroup.name); statusStrip.Refresh(); isEdited = true; } }
private void editGroupToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode clickedNode = treeViewTrade.SelectedNode; BuySellGroup group = buySellGroups.Find(x => x.id == Convert.ToInt32(clickedNode.Name)); EditGroup editDialog = new EditGroup(group.name, group.isBuy, group.priceLevel); if (editDialog.ShowDialog() == DialogResult.OK) { if (editDialog.groupName != group.name || editDialog.priceLevel != group.priceLevel) { group.name = editDialog.groupName; group.priceLevel = editDialog.priceLevel; RebuildTree(); toolStripStatusLabel.Text = string.Format("Group {0} edited", group.name); statusStrip.Refresh(); isEdited = true; } } }