Example #1
0
        private string GetAssociatedNumberDescription(IConversation conversation)
        {
            if (!IsSinglePartnerConversation(conversation))
            {
                throw new ArgumentException("Single partner conversation expected.");
            }

            IContact associatedContact = conversation.AssociatedContacts[0];
            string   phoneNumberDescription;

            if (associatedContact.PhoneNumbers.Count == 1)
            {
                //
                // Add LTR markers because phone numbers should never be displayed RTL.
                //

                phoneNumberDescription = string.Format("{0}{1}{2}",
                                                       '\u200E',
                                                       PhoneNumberFormatter.FormatNumberWithDashes(associatedContact.PhoneNumbers[0]),
                                                       '\u202C');
            }
            else
            {
                phoneNumberDescription = string.Format("{0} numbers", associatedContact.PhoneNumbers.Count);
            }

            return(phoneNumberDescription);
        }
        protected string GetAssociatedPhoneNumbersAsString(IContact contact)
        {
            List <string> phoneNumberValues = new List <string>();

            foreach (IPhoneNumber phoneNumber in contact.PhoneNumbers)
            {
                string formattedNumber = PhoneNumberFormatter.FormatNumberWithDashes(phoneNumber);
                phoneNumberValues.Add(formattedNumber);
            }

            string phoneNumbers = string.Join(", ", phoneNumberValues);

            return(phoneNumbers);
        }