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."; } } }
public static string GetNameMatchingKey(this CNContactProperty property) { switch (property.Key) { case "emailAddress": return("Email address"); case "phoneNumber": return("Phone number"); case "postalAddress": return("Postal address"); default: return(null); } }
public static string GetNameMatchingLocalizedLabel(this CNContactProperty property) { var label = property?.Label; if (!string.IsNullOrEmpty(label)) { var nativelabel = new NSString(label); switch (property.Label) { case "emailAddresses": return(CNLabeledValue <NSString> .LocalizeLabel(nativelabel)); case "phoneNumbers": return(CNLabeledValue <NSString> .LocalizeLabel(nativelabel)); case "postalAddresses": return(CNLabeledValue <NSString> .LocalizeLabel(nativelabel)); } } return(null); }
public static string GetNameMatchingValue(this CNContactProperty property) { switch (property.Key) { case "emailAddress": return(property.Value as NSString); case "phoneNumber": if (property.Value is CNPhoneNumber phoneNumber) { return(phoneNumber.StringValue); } break; case "postalAddress": if (property.Value is CNPostalAddress postalAddress) { return(postalAddress.GetFormattedPostalAddress()); } break; } return(null); }
public void ContactPickerDidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty) { }
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}"); } // 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); } }
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); }
public void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty) { string message = $"Picked -> {contactProperty.Identifier}"; Console.WriteLine(message); }
internal void RaiseContactPropertySelected(CNContactProperty property) { ContactPropertySelected?.Invoke(property); }
public override void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty) { // Raise the contact property selected event RaiseContactPropertySelected(contactProperty); }
public override void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty) { Console.WriteLine("Selected Property: {0}", contactProperty); }
public bool ShouldPerformDefaultAction(CNContactViewController viewController, CNContactProperty property) { return(false); }