Ejemplo n.º 1
0
        private async Task <Contact[]> PickContactsAsync(bool multiple, CancellationToken token)
        {
            var window     = UIApplication.SharedApplication.KeyWindow;
            var controller = window.RootViewController;

            if (controller == null)
            {
                throw new InvalidOperationException(
                          $"The root view controller is not yet set, " +
                          $"API was called too early in the application lifecycle.");
            }

            var completionSource = new TaskCompletionSource <CNContact[]>();

            using var picker = new CNContactPickerViewController
                  {
                      Delegate = multiple ?
                                 (ICNContactPickerDelegate) new MultipleContactPickerDelegate(completionSource) :
                                 (ICNContactPickerDelegate) new SingleContactPickerDelegate(completionSource),
                  };

            await controller.PresentViewControllerAsync(picker, true);

            var cnContacts = await completionSource.Task;

            if (token.IsCancellationRequested)
            {
                return(Array.Empty <Contact>());
            }

            return(cnContacts
                   .Where(contact => contact != null)
                   .Select(contact => CNContactToContact(contact))
                   .ToArray());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Event for adding a contact from the contact book
        /// </summary>
        private void AddRecipientFromContactButton_TouchUpInside(object sender, EventArgs e)
        {
            _isComeFromContact = true;

            if (contactPickerView == null)
            {
                contactPickerView = new CNContactPickerViewController();
                contactPickerView.DisplayedPropertyKeys          = new NSString[] { CNContactKey.EmailAddresses };
                contactPickerView.PredicateForEnablingContact    = NSPredicate.FromFormat("emailAddresses.@count > 0");
                contactPickerView.PredicateForSelectionOfContact = NSPredicate.FromFormat("emailAddresses.@count == 1");

                var contactPickerDelegate = new ContactPickerDelegate();
                contactPickerView.Delegate = contactPickerDelegate;
                contactPickerDelegate.SelectionCanceled       += () => { };
                contactPickerDelegate.ContactPropertySelected += (property) => { };


                contactPickerDelegate.ContactsSelected += (CNContactPickerViewController picker, CNContact[] contacts) =>
                {
                    foreach (var contact in contacts)
                    {
                        if (App.Locator.Alert.LsRecipients.Any((arg) => arg.Email.ToLower() == contact.EmailAddresses[0].Value.ToString().Trim().ToLower()))
                        {
                            continue;
                        }
                        var recipient = new AlertRecipientDTO();
                        recipient.DisplayName = string.Format("{0} {1}", contact.GivenName, contact.FamilyName);
                        recipient.Email       = contact.EmailAddresses[0].Value.ToString().Trim();
                        AddRecipientToRecipientContainer(recipient);
                    }
                };
            }

            PresentViewController(contactPickerView, true, null);
        }
Ejemplo n.º 3
0
        static Task <Contact> PlatformPickContactAsync()
        {
            var uiView = Platform.GetCurrentViewController();

            if (uiView == null)
            {
                throw new ArgumentNullException($"The View Controller can't be null.");
            }

            var source = new TaskCompletionSource <Contact>();

            var picker = new CNContactPickerViewController
            {
                Delegate = new ContactPickerDelegate(phoneContact =>
                {
                    try
                    {
                        source?.TrySetResult(ConvertContact(phoneContact));
                    }
                    catch (Exception ex)
                    {
                        source?.TrySetException(ex);
                    }
                })
            };

            uiView.PresentViewController(picker, true, null);

            return(source.Task);
        }
Ejemplo n.º 4
0
        public override void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty)
        {
            if (contactProperty != null)
            {
                var sections = new List <Section>();
                var section  = new Section {
                    Items = new List <string>()
                };

                var nameKey = contactProperty.GetNameMatchingKey();
                if (!string.IsNullOrEmpty(nameKey))
                {
                    section.Items.Add($"Contact: {contactProperty.Contact.GetFormattedName()}");
                    section.Items.Add($"Key: {nameKey}");
                }

                var localizedLabel = contactProperty.GetNameMatchingLocalizedLabel();
                if (!string.IsNullOrEmpty(localizedLabel))
                {
                    section.Items.Add($"Label: {localizedLabel}");
                }

                var value = contactProperty.GetNameMatchingValue();
                if (!string.IsNullOrEmpty(value))
                {
                    section.Items.Add($"Value: {value}");
                }

                sections.Add(section);
                callback(sections);
            }
        }
Ejemplo n.º 5
0
        public void DidSelectContact(CNContactPickerViewController picker, CNContact contact)
        {
            string contactName = contact.GivenName;
            string message     = $"Picked -> {contactName}";

            Console.WriteLine(message);
        }
Ejemplo n.º 6
0
        private void SelectContactButton_TouchUpInside(object sender, EventArgs e)
        {
            // Create a new picker
            var picker = new CNContactPickerViewController();

            // A contact has many properties (email, phone numbers, birthday)
            // and you must specify which properties you want to fetch,
            // in this case PhoneNumbers
            picker.DisplayedPropertyKeys          = new NSString[] { CNContactKey.PhoneNumbers };
            picker.PredicateForEnablingContact    = NSPredicate.FromValue(true);
            picker.PredicateForSelectionOfContact = NSPredicate.FromValue(true);

            // Respond to selection
            var pickerDelegate = new ContactPickerDelegate();

            picker.Delegate = pickerDelegate;

            // If the user cancels the contact selection,
            // show an empty string
            pickerDelegate.SelectionCanceled += () => {
                this.SelectedContactField.Text = "";
            };

            // If the user selects a contact,
            // show the full name
            pickerDelegate.ContactSelected += (contact) => {
                this.SelectedContactField.Text = $"{contact.GivenName} {contact.FamilyName}";

                // If the contact has phone numbers
                if (contact.PhoneNumbers != null)
                {
                    // Query for mobile only
                    // Each PhoneNumber has a label with a description
                    // and a Value with the actual phone number
                    // exposed by the StringValue property
                    var mobilePhone = contact.PhoneNumbers.
                                      Where(p => p.Label.Contains("Mobile")).
                                      Select(p => p.Value.StringValue);

                    // If at least one mobile phone number
                    if (mobilePhone != null)
                    {
                        // Generate a new data source
                        var tblSource = new TableSource(mobilePhone.ToArray(), this);
                        // and perform data-binding
                        this.TableView.Source = tblSource;
                    }
                }
            };

            pickerDelegate.ContactPropertySelected += (property) => {
                this.SelectedContactField.Text = property.Value.ToString();
            };

            // Display picker
            PresentViewController(picker, true, null);
        }
Ejemplo n.º 7
0
        public void DidSelectContact(CNContactPickerViewController picker, CNContact contact)
        {
            var name = contact?.GetFormattedName();

            if (!string.IsNullOrEmpty(name))
            {
                this.message = $"{name} was selected.";
            }
        }
Ejemplo n.º 8
0
        public override void DidSelectContacts(CNContactPickerViewController picker, CNContact[] contacts)
        {
            foreach (var contact in contacts)
            {
                Console.WriteLine("Selected: {0}", contact);
            }

            // Raise the contact selected event
            RaiseContactsSelected(picker, contacts);
        }
Ejemplo n.º 9
0
        private void HandleContactsWithPhoneNumbers()
        {
            var picker = new CNContactPickerViewController {
                Delegate = this
            };

            // Only show contacts with email addresses.
            picker.PredicateForSelectionOfProperty = NSPredicate.FromFormat("key == 'phoneNumbers'");
            base.NavigationController.PresentViewController(picker, true, null);
        }
Ejemplo n.º 10
0
        public CNContactPickerViewController GetPicker()
        {
            var picker = new CNContactPickerViewController();

            picker.DisplayedPropertyKeys       = new NSString[] { CNContactKey.GivenName, CNContactKey.FamilyName };
            picker.PredicateForEnablingContact = NSPredicate.FromFormat("emailAddresses.@count > 0");

            // Respond to selection
            picker.Delegate = new ContactPickerDelegate(this);
            return(picker);
        }
Ejemplo n.º 11
0
        private CNContactPickerViewController CreatePicker()
        {
            var controller = new CNContactPickerViewController();

            if (this.Mode == PredicatePickerMode.SelectContacts)
            {
                controller.Delegate = this;
            }

            return(controller);
        }
        public CNContactPickerViewController GetPicker()
        {
            var picker = new CNContactPickerViewController();

            picker.DisplayedPropertyKeys = new NSString[] {CNContactKey.GivenName, CNContactKey.FamilyName};
            picker.PredicateForEnablingContact = NSPredicate.FromFormat("emailAddresses.@count > 0");

            // Respond to selection
            picker.Delegate = new ContactPickerDelegate(this);
            return picker;
        }
Ejemplo n.º 13
0
 public void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty)
 {
     if (contactProperty != null)
     {
         var value = contactProperty.GetNameMatchingValue();
         var key   = contactProperty.GetNameMatchingKey();
         if (!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(key))
         {
             this.message = $"{contactProperty.Contact.GetFormattedName()}'s {key} ({value}) was selected.";
         }
     }
 }
Ejemplo n.º 14
0
            public override void DidSelectContacts(CNContactPickerViewController picker, CNContact[] contacts)
            {
                var numbers = contacts.Select(x => x.PhoneNumbers.First()).ToList();

                if (numbers.Count == 1)
                {
                    SelectedNumber(numbers[0]);
                }
                if (numbers.Count > 1)
                {
                    ShowChooseNumberPopup(numbers, picker);
                    return;
                }
            }
Ejemplo n.º 15
0
        void ShowPeoplePickerController()
        {
            var picker = new CNContactPickerViewController();

            picker.Delegate = this;

            picker.PredicateForEnablingContact     = NSPredicate.FromValue(true);          // Enable selection for any person
            picker.PredicateForSelectionOfContact  = NSPredicate.FromValue(false);         // Don't select the person. Let me browse his properties
            picker.PredicateForSelectionOfProperty = NSPredicate.FromValue(true);          // Invoke call back when user tap on any property

            NSString[] propertiesArray = { CNContactKey.EmailAddresses, CNContactKey.PhoneNumbers, (CNContactKey.NonGregorianBirthday) };
            picker.DisplayedPropertyKeys = propertiesArray;

            PresentViewController(picker, true, null);
        }
        public override void DidSelectContact(CNContactPickerViewController picker, CNContact contact)
        {
            if (contact != null)
            {
                var sections = new List <Section>
                {
                    new Section {
                        Items = new List <string> {
                            contact.GetFormattedName()
                        }
                    }
                };

                this.callback(sections);
            }
        }
 public override void DidSelectContacts(CNContactPickerViewController picker, CNContact[] contacts)
 {
     if (contacts != null && contacts.Any())
     {
         var section = new Section {
             Items = new List <string>()
         };
         foreach (var contact in contacts)
         {
             section.Items.Add(contact.GetFormattedName());
         }
         callback(new List <Section> {
             section
         });
     }
 }
Ejemplo n.º 18
0
        public Task <Phone> SelectPhone()
        {
            var tcs = new TaskCompletionSource <Phone>();

            Task.Run(async() =>
            {
                var hasPermission = await PermissionsService.CheckPermission(Permission.Contacts, true, _permissionMessage);
                if (!hasPermission)
                {
                    tcs.TrySetCanceled();
                    return;
                }

                var picker = new CNContactPickerViewController
                {
                    DisplayedPropertyKeys          = new NSString[] { CNContactKey.PhoneNumbers },
                    PredicateForEnablingContact    = NSPredicate.FromFormat("phoneNumbers.@count > 0"),
                    PredicateForSelectionOfContact = NSPredicate.FromFormat("phoneNumbers.@count == 1")
                };

                var pickerDelegate = new ContactPickerDelegate();
                picker.Delegate    = pickerDelegate;

                pickerDelegate.SelectionCanceled       = () => tcs.TrySetCanceled();
                pickerDelegate.ContactPropertySelected = (prop) =>
                {
                    var phone = (prop?.Value as CNPhoneNumber)?.StringValue;
                    tcs.TrySetResult((prop == null) ? null : new Phone {
                        FullValue = phone
                    });
                };
                pickerDelegate.ContactSelected = (contact) =>
                {
                    var phone = contact.PhoneNumbers?.FirstOrDefault()?.Value?.StringValue;
                    tcs.TrySetResult((phone == null) ? null : new Phone {
                        FullValue = phone
                    });
                };

                Mvx.Resolve <IMvxMainThreadDispatcher>().RequestMainThreadAction(() =>
                {
                    GetPresentedViewController().PresentViewController(picker, true, null);
                });
            });

            return(tcs.Task);
        }
Ejemplo n.º 19
0
        public bool SendSmsToNumbers(List <string> numbers, string message)
        {
            try
            {
                var contactPickerController = new CNContactPickerViewController();
                contactPickerController.PredicateForEnablingContact = NSPredicate.FromValue(true);
                UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(contactPickerController, true, null);
                // Respond to selection

                var smsController = new MFMessageComposeViewController {
                    Body = message
                };


                smsController.Finished += (sender, e) =>
                {
                    NSRunLoop.Main.BeginInvokeOnMainThread(() =>
                    {
                        e.Controller.DismissViewController(true, null);
                    });
                };
                var pickerDelegate = new ContactPickerDelegate();
                pickerDelegate.SelectContacts += ((string[] contactsArr) =>
                {
                    //contacts = contactsArr;


                    UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(smsController, true, new Action(()
                                                                                                                                       =>
                    {
                        ;
                    })
                                                                                                       );
                });
                contactPickerController.Delegate = pickerDelegate;
                UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(contactPickerController, true, null);
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
        }
Ejemplo n.º 20
0
        public Task <Contact> SelectContact()
        {
            var tcs = new TaskCompletionSource <Contact>();

            Task.Run(async() =>
            {
                var hasPermission = await PermissionsService.CheckPermission(Permission.Contacts, true, _permissionMessage);
                if (!hasPermission)
                {
                    tcs.TrySetCanceled();
                    return;
                }

                var picker = new CNContactPickerViewController();

                var pickerDelegate = new ContactPickerDelegate();
                picker.Delegate    = pickerDelegate;

                pickerDelegate.SelectionCanceled       = () => tcs.TrySetCanceled();
                pickerDelegate.ContactPropertySelected = (prop) => pickerDelegate.ContactSelected?.Invoke(prop.Contact);
                pickerDelegate.ContactSelected         = (contact) =>
                {
                    tcs.TrySetResult(new Contact
                    {
                        FirstName  = contact.GivenName,
                        LastName   = contact.FamilyName,
                        MiddleName = contact.MiddleName,
                        Phones     = contact.PhoneNumbers?.Select(x => new Phone {
                            FullValue = x.Value.StringValue
                        }).ToList(),
                        Emails = contact.EmailAddresses?.Select(x => new Email {
                            FullValue = x.Value
                        }).ToList()
                    });
                };

                Mvx.Resolve <IMvxMainThreadDispatcher>().RequestMainThreadAction(() =>
                {
                    GetPresentedViewController().PresentViewController(picker, true, null);
                });
            });

            return(tcs.Task);
        }
Ejemplo n.º 21
0
        partial void ShowPicker(NSObject sender)
        {
            this.UpdateInterface(true);
            switch (this.Mode)
            {
            case PickerMode.SingleContact:
                this.contactDelegate = new SingleContactPickerDelegate(this.Update);
                var picker = new CNContactPickerViewController {
                    Delegate = this.contactDelegate
                };
                base.PresentViewController(picker, true, null);
                break;

            case PickerMode.MultupleContacts:
                this.contactDelegate = new MultipleContactPickerDelegate(this.Update);
                var contactsPicker = new CNContactPickerViewController {
                    Delegate = this.contactDelegate
                };
                base.PresentViewController(contactsPicker, true, null);
                break;

            case PickerMode.SingleProperty:
                this.contactDelegate = new SinglePropertyPickerDelegate(this.Update);
                var propertyPicker = new CNContactPickerViewController {
                    Delegate = this.contactDelegate
                };
                propertyPicker.DisplayedPropertyKeys = new NSString[] { CNContactKey.GivenName,
                                                                        CNContactKey.FamilyName,
                                                                        CNContactKey.EmailAddresses,
                                                                        CNContactKey.PhoneNumbers,
                                                                        CNContactKey.PostalAddresses };
                base.PresentViewController(propertyPicker, true, null);
                break;

            case PickerMode.MultipleProperties:
                this.contactDelegate = new MultiplePropertyPickerDelegate(this.Update);
                var propertiesPicker = new CNContactPickerViewController {
                    Delegate = this.contactDelegate
                };
                propertiesPicker.PredicateForSelectionOfProperty = NSPredicate.FromFormat("key == 'emailAddresses'");
                base.PresentViewController(propertiesPicker, true, null);
                break;
            }
        }
Ejemplo n.º 22
0
        private void HandleAllContacts()
        {
            var picker = new CNContactPickerViewController {
                Delegate = this
            };

            /*
             *  Only show the given and family names, email addresses, phone numbers,
             *  and postal addresses of a contact.
             */
            picker.DisplayedPropertyKeys = new NSString[]
            {
                CNContactKey.GivenName,
                CNContactKey.FamilyName,
                CNContactKey.EmailAddresses,
                CNContactKey.PhoneNumbers,
                CNContactKey.PostalAddresses
            };
            base.NavigationController.PresentViewController(picker, true, null);
        }
Ejemplo n.º 23
0
        public Task <ContactInfo> GetSelectedContactInfo()
        {
            var picker = new CNContactPickerViewController()
            {
                DisplayedPropertyKeys = new NSString[] { CNContactKey.GivenName, CNContactKey.FamilyName }
            };

            // Set up Contact Picker Delegate, TaskCompletionSource wrapper.
            var tcs            = new TaskCompletionSource <ContactInfo>();
            var pickerDelegate = new ContactPickerDelegate();

            picker.Delegate = pickerDelegate;

            pickerDelegate.ContactSelected += (contact) =>
            {
                tcs.TrySetResult(new ContactInfo {
                    Id = contact.Identifier, FamilyName = contact.FamilyName, AdditionalName = contact.MiddleName, GivenName = contact.GivenName
                });
            };

            pickerDelegate.SelectionCanceled += () =>
            {
                tcs.TrySetResult(null);
            };

            // Display as modal dialog on current ViewController
            UIWindow         window         = UIApplication.SharedApplication.KeyWindow;
            UIViewController viewController = window.RootViewController;

            if (viewController == null)
            {
                while (viewController.PresentedViewController != null)
                {
                    viewController = viewController.PresentedViewController;
                }
            }

            viewController.PresentViewController(picker, true, null);

            return(tcs.Task);
        }
Ejemplo n.º 24
0
        public override void DidSelectContactProperties(CNContactPickerViewController picker, CNContactProperty[] contactProperties)
        {
            if (contactProperties != null && contactProperties.Any())
            {
                var sections = new List <Section>();
                foreach (var contactProperty in contactProperties)
                {
                    var section = new Section {
                        Items = new List <string>()
                    };

                    var nameKey = contactProperty.GetNameMatchingKey();
                    if (!string.IsNullOrEmpty(nameKey))
                    {
                        section.Items.Add($"Contact: {contactProperty.Contact.GetFormattedName()}");
                        section.Items.Add($"Key: {nameKey}");
                    }

                    // Attempt to fetch the localized label of the property.
                    var localizedLabel = contactProperty.GetNameMatchingLocalizedLabel();
                    if (!string.IsNullOrEmpty(localizedLabel))
                    {
                        section.Items.Add($"Label : {localizedLabel}");
                    }

                    // Attempt to fetch the value of the property.
                    var value = contactProperty.GetNameMatchingValue();
                    if (!string.IsNullOrEmpty(value))
                    {
                        section.Items.Add($"Value: {value}");
                    }

                    sections.Add(section);
                }

                this.callback(sections);
            }
        }
Ejemplo n.º 25
0
        public void ContactPickerDidSelectContact(CNContactPickerViewController picker, CNContact contact)
        {
            if (contact == null)
            {
                InvokeCallback("Received a null contact data.", null);
                DismissPicker();
                return;
            }

            try
            {
                InvokeCallback(null, contact.ToContact());
            }
            catch (Exception e)
            {
                InvokeCallback(e.Message, null);
                Debug.Log(e.StackTrace);
            }
            finally
            {
                DismissPicker();
            }
        }
Ejemplo n.º 26
0
        public Task<ContactInfo> GetSelectedContactInfo()
        {
            var picker = new CNContactPickerViewController()
            {
                DisplayedPropertyKeys = new NSString[] { CNContactKey.GivenName, CNContactKey.FamilyName }
            };
            
            // Set up Contact Picker Delegate, TaskCompletionSource wrapper.
            var tcs = new TaskCompletionSource<ContactInfo>();
            var pickerDelegate = new ContactPickerDelegate();
            picker.Delegate = pickerDelegate;

            pickerDelegate.ContactSelected += (contact) =>
            {
                tcs.TrySetResult(new ContactInfo { Id = contact.Identifier, FamilyName = contact.FamilyName, AdditionalName = contact.MiddleName, GivenName = contact.GivenName });
            };

            pickerDelegate.SelectionCanceled += () =>
            {
                tcs.TrySetResult(null);
            };

            // Display as modal dialog on current ViewController
            UIWindow window = UIApplication.SharedApplication.KeyWindow;
            UIViewController viewController = window.RootViewController;
            if (viewController == null)
            {
                while (viewController.PresentedViewController != null)
                    viewController = viewController.PresentedViewController;
            }

            viewController.PresentViewController(picker, true, null);

            return tcs.Task;
            
        }
Ejemplo n.º 27
0
 public void ContactPickerDidSelectContactProperties(CNContactPickerViewController picker, NSArray <CNContactProperty> contactProperties)
 {
 }
Ejemplo n.º 28
0
 public void ContactPickerDidCancel(CNContactPickerViewController picker)
 {
     InvokeCallback(CancelMessage, null);
     DismissPicker();
 }
Ejemplo n.º 29
0
 public iOSContactsPickerCallback(Action <string, Contact> callback, CNContactPickerViewController picker)
 {
     this.callback = callback;
     this.picker   = picker;
 }
Ejemplo n.º 30
0
 public override void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty)
 {
     ContactPropertySelected?.Invoke(contactProperty);
 }
 public override void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty)
 {
     Console.WriteLine ("Selected Property: {0}", contactProperty);
 }
Ejemplo n.º 32
0
 public override void ContactPickerDidCancel(CNContactPickerViewController picker)
 {
     RaiseSelectionCanceled();
 }
 public override void ContactPickerDidCancel(CNContactPickerViewController picker)
 {
     Console.WriteLine ("User canceled picker");
 }
Ejemplo n.º 34
0
 public override void DidSelectContact(CNContactPickerViewController picker, CNContact contact)
 {
     RaiseContactSelected(contact);
 }
		public void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty)
		{
			string message = $"Picked -> {contactProperty.Identifier}";
			Console.WriteLine(message);
		}
		public void DidSelectContact(CNContactPickerViewController picker, CNContact contact)
		{
			string contactName = contact.GivenName;
			string message = $"Picked -> {contactName}";
			Console.WriteLine(message);
		}
		void ShowPeoplePickerController ()
		{
			var picker = new CNContactPickerViewController ();
			picker.Delegate = this;

			picker.PredicateForEnablingContact = NSPredicate.FromValue (true); // Enable selection for any person
			picker.PredicateForSelectionOfContact = NSPredicate.FromValue (false); // Don't select the person. Let me browse his properties
			picker.PredicateForSelectionOfProperty = NSPredicate.FromValue (true); // Invoke call back when user tap on any property

			NSString[] propertiesArray = { CNContactKey.EmailAddresses, CNContactKey.PhoneNumbers, (CNContactKey.NonGregorianBirthday)};
			picker.DisplayedPropertyKeys = propertiesArray;

			PresentViewController (picker, true, null);
		}
Ejemplo n.º 38
0
 public void ContactPickerDidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty)
 {
 }
Ejemplo n.º 39
0
 public void ContactPickerDidSelectContacts(CNContactPickerViewController picker, NSArray <CNContact> contacts)
 {
 }
 public override void DidSelectContact(CNContactPickerViewController picker, CNContact contact)
 {
     Console.WriteLine ("Selected: {0}", contact);
     helper.SetSelectedName ($"{contact.GivenName} {contact.FamilyName}");
     Console.WriteLine ($"Selected {contact.GivenName} {contact.FamilyName}");
 }