Exemplo n.º 1
0
        void ShowPersonViewController()
        {
            ABPerson[] people = addressBook.GetPeopleWithName("Appleseed");

            if (people != null && people.Length > 0)
            {
                ABPerson person = people [0];
                var      pvc    = new ABPersonViewController()
                {
                    DisplayedPerson = person,
                    AllowsEditing   = true
                };
                pvc.PerformDefaultAction += HandlePerformDefaultAction;

                NavigationController.PushViewController(pvc, true);
            }
            else
            {
                var alert = UIAlertController.Create("Error", "Could not find Appleseed in the Contacts application", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Default, null));
                PresentViewController(alert, true, null);
            }
        }
Exemplo n.º 2
0
        static Task <List <Contact> > DoReadContacts(ContactSearchParams searchParams)
        {
            var people = searchParams.NameKeywords.HasValue() ? Addressbook.GetPeopleWithName(searchParams.NameKeywords) : Addressbook.GetPeople();

            return(Task.FromResult(people.Select(x => Extract(x, searchParams)).ToList()));
        }