public void FindText(object sender, SelectedIndexEventArgs e) { int startSearchIndex = e.Index; string textToFind = _view.InputFindText; _addressBook.searchForText(textToFind, startSearchIndex); _view.CloseView(); }
//Event fired when Find Again is selected from the search menu private void FindPersonAgain(object sender, SelectedIndexEventArgs e) { int index = e.Index; string textToFind = _addressBook.FoundText; _addressBook.searchForText(textToFind, index); if (_addressBook.PersonToFind != null) { int newIndex = findFocusIndex(_addressBook.PersonToFind); setListFocus(newIndex); _addressBook.PersonToFind = null; _view.EnableFindAgainButton(); } else { MessageBox.Show("No person could be found with information including that text"); _view.DisableFindAgainButton(); } }
//Event fired when Find is selected from the search menu private void FindPerson(object sender, SelectedIndexEventArgs e) { newFindTextWindow = new FindTextForm(_addressBook, e.Index); newFindTextWindow.ShowDialog(); if (!newFindTextWindow.ViewClosed) { if (_addressBook.PersonToFind != null) { int index = findFocusIndex(_addressBook.PersonToFind); setListFocus(index); _addressBook.PersonToFind = null; _view.EnableFindAgainButton(); } else { MessageBox.Show("No person could be found with information including that text"); _view.DisableFindAgainButton(); } } }