Exemple #1
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.";
         }
     }
 }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
 public void ContactPickerDidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty)
 {
 }
Exemple #6
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}");
                }

                // 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);
            }
        }
Exemple #7
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);
 }
		public void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty)
		{
			string message = $"Picked -> {contactProperty.Identifier}";
			Console.WriteLine(message);
		}
Exemple #10
0
 internal void RaiseContactPropertySelected(CNContactProperty property)
 {
     ContactPropertySelected?.Invoke(property);
 }
Exemple #11
0
 public override void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty)
 {
     // Raise the contact property selected event
     RaiseContactPropertySelected(contactProperty);
 }
Exemple #12
0
        public void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty)
        {
            string message = $"Picked -> {contactProperty.Identifier}";

            Console.WriteLine(message);
        }
 public override void DidSelectContactProperty(CNContactPickerViewController picker, CNContactProperty contactProperty)
 {
     Console.WriteLine("Selected Property: {0}", contactProperty);
 }
Exemple #14
0
 public bool ShouldPerformDefaultAction(CNContactViewController viewController, CNContactProperty property)
 {
     return(false);
 }