Example #1
0
 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);
 }
Example #2
0
 private void createPerson_Click(object sender, EventArgs e)
 {
     var form = new PersonForm();
     var allPersons = personsList.Items.Cast<Person>().ToList();
     form.InitCombos(allPersons);
     form.PersonCreated += (o, args) =>
                               {
                                   var newPerson = new Person();
                                   newPerson.Merge(o as Person);
                                   AddPersonToLists(newPerson);
                                   PersonStorage.Instance.Save(newPerson);
                                   if (!createToPacket.Checked) return;
                                   if (_currentPacket == null) CreateNewPacket();
                                   if (_currentPacket == null) return;
                                   _currentPacket.AddPerson(newPerson);
                                   currentPacketList.Items.Add(newPerson);
                                   PacketStorage.Instance.Save(_currentPacket);
                                   PersonStorage.Instance.Save(newPerson);
                               };
     form.CreatePerson(_currentPacket);
     form.ShowDialog();
 }
Example #3
0
 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;
 }