//Event fired when Add is clicked on the Main Form public void AddPerson(object sender, EventArgs e) { using (newManageWindow = new ManagePerson(_addressBook)) { newManageWindow.ShowDialog(); if (!newManageWindow.Canceled) { _view.DisableFindAgainButton(); RefreshAddressBook(); } } }
//Event fired when Edit is clicked on the Main Form public void EditPerson(object sender, PersonInfoEventArgs e) { if (_addressBook.AddressBookList.Any()) { (string firstName, string lastName) = cleanUpName(e.PersonName); Person person = _addressBook.getPerson(firstName, lastName); using (newManageWindow = new ManagePerson(_addressBook, person)) { newManageWindow.ShowDialog(); if (!newManageWindow.Canceled) { _view.DisableFindAgainButton(); RefreshAddressBook(); } personIndex = findFocusIndex(person); setListFocus(personIndex); } } }