private string GetAString(string whatToAskFor) { string result = ""; StringiDalog dialog = new StringiDalog(); dialog.WhatText = whatToAskFor; dialog.ShowDialog(); if (dialog.Accept) { result = dialog.YourString; } return(result); }
internal void Find() { StringiDalog dialog = new StringiDalog(); dialog.WhatText = "A country abbreviation"; dialog.ShowDialog(); if (dialog.Accept) { string abbreviation = dialog.YourString; var foundCountry = _countryRepository.GetByAbreviation(abbreviation); if (foundCountry != null) { CurrentCountry = foundCountry; CountryView view = new CountryView(CurrentCountry); view.Show(); } else { FilmMessageBox box = new FilmMessageBox("No known country has abbreviation " + abbreviation); box.Show(); } } }
private Person PersonToLookup() { Person result = null; StringiDalog dialog = new StringiDalog(); dialog.WhatText = "A partial Last Name"; dialog.ShowDialog(); if (dialog.Accept) { string lastName = dialog.YourString; PersonRepository personRepo = _factory.CreatePersonRepository(); List <Person> candidates = personRepo.ListByLastName(lastName) as List <Person>; switch (candidates.Count) { case 0: FilmMessageBox box = new FilmMessageBox("No known person has a last name containing " + lastName); box.Show(); break; case 1: result = candidates[0]; break; default: List <string> nameList = NameList(candidates); StringChooser chooser = new StringChooser(nameList); chooser.ShowDialog(); if (chooser.Accepted) { string fullName = chooser.ChosenString; result = personRepo.GetByFullName(fullName); } break; } } return(result); }