public AddressBookViewModel( AddressBook addressBook, PersonSelection personSelection, Func<Person, PersonViewModel> makePersonViewModel) { _addressBook = addressBook; _personSelection = personSelection; _makePersonViewModel = makePersonViewModel; }
public Container() { var addressBook = new AddressBook(); var personSelection = new Main.PersonSelection(); Func<Person, Main.PersonViewModel> makePersonViewModel = person => new Main.PersonViewModel(person); var addressBookViewModel = new Main.AddressBookViewModel(addressBook, personSelection, makePersonViewModel); Func<Detail.PersonViewModel> makePersonDetail = delegate { if (personSelection.SelectedPerson == null) return null; return new Detail.PersonViewModel(personSelection.SelectedPerson); }; _mainScreen = new MainScreen(addressBookViewModel, makePersonDetail); }