private async Task AddContact() { var viewModel = new ContactDetailViewModel( new ContactViewModel(), _contactStore, _pageService); viewModel.ContactAdded += (source, contact) => { Contacts.Add(new ContactViewModel(contact)); }; await _pageService.PushAsync(new ContactDetailPage(viewModel)); }
private async Task SelectContact(ContactViewModel contact) { if (contact == null) { return; } SelectedContact = null; var viewModel = new ContactDetailViewModel(contact, _contactStore, _pageService); viewModel.ContactUpdated += (source, updatedContact) => { contact.Id = updatedContact.Id; contact.FirstName = updatedContact.FirstName; contact.LastName = updatedContact.LastName; contact.Phone = updatedContact.Phone; contact.Email = updatedContact.Email; contact.IsBlocked = updatedContact.IsBlocked; }; await _pageService.PushAsync(new ContactDetailPage(viewModel)); }
private void OnContactAdded(ContactDetailViewModel source, Contact contact) { Contacts.Add(new ContactViewModel(contact)); }