Beispiel #1
0
        private async void LstView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var selected = (Contact)e.SelectedItem;
            var page     = new ContactForm(selected);

            page.SaveBtn.Clicked += async(s, x) =>
            {
                selected.FirstName = page.FirstEntry.Text.ToString();
                selected.LastName  = page.LastEntry.Text.ToString();

                var select = JsonConvert.SerializeObject(selected);
                await _client.PutAsync(url + "/" + selected.Id, new StringContent(select, Encoding.UTF8, sContentType));

                await Navigation.PopAsync();
            };
            await Navigation.PushAsync(page);
        }
Beispiel #2
0
        private async void ToolbarItem_Clicked(object sender, EventArgs e)
        {
            var page = new ContactForm();

            page.SaveBtn.Clicked += async(s, x) =>
            {
                var contact = new Contact
                {
                    FirstName = page.FirstEntry.Text.ToString(),
                    LastName  = page.LastEntry.Text.ToString()
                };


                var select = JsonConvert.SerializeObject(contact);
                await _client.PostAsync(url, new StringContent(select, Encoding.UTF8, sContentType));

                await Navigation.PopAsync();
            };
            await Navigation.PushAsync(page);
        }