예제 #1
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);
            }
        }
예제 #2
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.";
         }
     }
 }