private void editTemplate_Click(object sender, EventArgs e) { var form = new PersonForm { AutoSavePerson = false}; var person = new Person(); person.Merge(linkedPacket.TemplatePerson, true); var allPersons = PersonStorage.Instance.LoadAll(); form.InitCombos(allPersons); form.EditPerson(person); if (form.ShowDialog() != DialogResult.OK) return; linkedPacket.TemplatePerson.Merge(person); }
private void personsList_DoubleClick(object sender, EventArgs e) { if (personsList.SelectedItem == null) return; var form = new PersonForm(); var person = personsList.SelectedItem as Person; form.InitCombos(_notFilteredPersons); form.EditPerson(person, _currentPacket); if (form.ShowDialog() != DialogResult.OK) return; var index = personsList.SelectedIndex; personsList.Items.RemoveAt(index); if (person != null) personsList.Items.Insert(index, person); personsList.SelectedIndex = index; }