/// <summary> /// InvalidOperationException if list is read-only /// </summary> public void Save() { if (ReadOnly) { throw new InvalidOperationException("this list is read-only"); } context.UpdateOrCreateTraitValueMap(valueMap, traitValueMapId); }
private void buttonCopy_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex < 0) { MessageBox.Show("Please select a preset from which to copy initial values."); } else { FormEditValuePresetsNewNameDialog ui = new FormEditValuePresetsNewNameDialog(this, context); if (ui.ShowDialogCenteredOnForm(this) == System.Windows.Forms.DialogResult.OK) { if (!string.IsNullOrEmpty(ui.Result)) { TraitValueMap map = new TraitValueMap(context, listBox1.SelectedItem.ToString()); context.UpdateOrCreateTraitValueMap(map.ValueMap, ui.Result); } listBox1.SelectedIndex = -1; RebuildAllPresetsList(); } } }