private void buttonRename_Click(object sender, EventArgs e) { KeytypeDialog ktd = new KeytypeDialog(selectedType); DialogResult result = ktd.ShowDialog(); if (result == DialogResult.OK) { selectedType.Save(); foreach (TreeNode node in treeViewTypes.Nodes) { if ((KeyType)node.Tag == selectedType) { node.Text = selectedType.Name; } } labelTypeTitle.Text = "Key Type: " + selectedType.Name; } ktd.Dispose(); }
private void buttonCreateType_Click(object sender, EventArgs e) { KeytypeDialog ktd = new KeytypeDialog(); DialogResult result = ktd.ShowDialog(); if (result == DialogResult.OK) { KeyType type = ktd.keytype; type.Save(); objects.keytypes.Add(type); bool isOdd = treeViewTypes.Nodes.Count % 2 == 0; TreeNode newNode = treeViewTypes.Nodes.Add(type.Name); newNode.Tag = type; newNode.BackColor = isOdd ? lightBlue : Color.White; } ktd.Dispose(); }