private void newXTriggerButton_Click(object sender, EventArgs e) { XTriggerViewer xtv = new XTriggerViewer(); if (xtv.ShowDialog() == DialogResult.OK) { if (displayedElement.xtriggers == null) { displayedElement.xtriggers = new Dictionary <string, List <XTrigger> >(); } xtriggersListView.Items.Add(xtv.catalyst); displayedElement.xtriggers[xtv.catalyst] = xtv.displayedXTriggers; } }
private void xtriggersListView_DoubleClick(object sender, EventArgs e) { if (xtriggersListView.SelectedItems.Count != 1) { return; } string id = xtriggersListView.SelectedItems[0].Text; List <XTrigger> xTriggers = new List <XTrigger>(); if (xtriggersListView.SelectedItems[0].BackColor == Utilities.DictionaryExtendStyle.BackColor) { xTriggers = displayedElement.xtriggers_extend[id]; } else if (xtriggersListView.SelectedItems[0].BackColor == Utilities.DictionaryRemoveStyle.BackColor) { // There isn't a List<XTrigger> here, so display nothing } else { xTriggers = displayedElement.xtriggers[id]; } XTriggerViewer xtv = new XTriggerViewer(id, xTriggers, editing, xtriggersListView.SelectedItems[0].BackColor == Utilities.DictionaryRemoveStyle.BackColor); if (xtv.ShowDialog() == DialogResult.OK) { if (xtv.catalyst != xtriggersListView.SelectedItems[0].Text) { displayedElement.xtriggers.Remove(xtriggersListView.SelectedItems[0].Text); xtriggersListView.SelectedItems[0].Text = xtv.catalyst; displayedElement.xtriggers[xtv.catalyst] = xtv.displayedXTriggers; } else { displayedElement.xtriggers[xtv.catalyst] = xtv.displayedXTriggers; } } }