void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { copyLabel.Text = ""; string item = e.Item.Text; if (currentMap.ContainsKey(item)) { richTextBox1.Text = currentMap[item].Val; currTemplateEntry = currentMap[item]; } }
void listView1_AfterLabelEdit(object sender, LabelEditEventArgs e) { // ensure the user didn't press the rename button and not rename it. if (e.Label != null && e.Label != "") { if (currentMap.ContainsKey(e.Label)) { keyBeingEdited = ""; e.CancelEdit = true; return; } Template.Entry old = currentMap[keyBeingEdited]; Template.Entry entry = new Template.Entry(old.Key, old.Val); currentMap.Add(e.Label, entry); currentMap.Remove(keyBeingEdited); } keyBeingEdited = ""; }