示例#1
0
        async private void OnAdd(object sender, EventArgs e)
        {
            string date     = DateTime.Today.ToString("dd.MM.yyyy");
            string sortdate = DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss");

            var page = new DetailsContact(new Contacts {
                FirstName = "Contact", LastName = "New", Date = date, SortDate = sortdate
            });

            page.ContactAdded += (source, cont) =>
            {
                _cont.Add(cont);
            };

            await Navigation.PushAsync(page);
        }
示例#2
0
        async void Selected(object sender, SelectedItemChangedEventArgs e)
        {
            if (listView.SelectedItem == null)
            {
                return;
            }

            var selectedCont = e.SelectedItem as Contacts;

            listView.SelectedItem = null;

            var page = new DetailsContact(selectedCont);

            page.ContactUpdated += (source, cont) =>
            {
                selectedCont.Id        = cont.Id;
                selectedCont.FirstName = cont.FirstName;
                selectedCont.LastName  = cont.LastName;
                selectedCont.Phone     = cont.Phone;
                selectedCont.Email     = cont.Email;
            };

            await Navigation.PushAsync(page);
        }