Beispiel #1
0
        private async void listContacts_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            if (e.SelectedItem == null)
            {
                return;
            }

            var contactSelected = e.SelectedItem as UserContact;
            var page            = new ModifyUserContact(contactSelected);
            await Navigation.PushAsync(new NavigationPage(page));

            listContacts.SelectedItem = null;
        }
Beispiel #2
0
        private async void AddButton_ClickedAsync(object sender, EventArgs e)
        {
            var page = new ModifyUserContact();

            page.UserContactSaved += (source, contact) =>
            {
                if (contact.Id == 0)
                {
                    var newUserId = _contactsService.AddContact(contact);
                }
                else
                {
                    _contactsService.UpdateContact(contact);
                }
                PopulateList();
            };
            await Navigation.PushAsync(new NavigationPage(page));
        }