Пример #1
0
        public static IDictionary <RecipientItemType, HashSet <RepType> > BuildReplyAllRecipients <RepType>(RepType sender, RepType from, IList <RepType> replyTo, IDictionary <RecipientItemType, HashSet <RepType> > recipients, IEqualityComparer <RepType> participantRepresentationComparer)
        {
            IDictionary <RecipientItemType, HashSet <RepType> > dictionary = ReplyAllParticipantsRepresentationProperty <T> .BuildToAndCCRecipients <RepType>(recipients, participantRepresentationComparer);

            if (replyTo == null || replyTo.Count == 0)
            {
                if (from != null)
                {
                    dictionary[RecipientItemType.To].Add(from);
                }
                else if (sender != null)
                {
                    dictionary[RecipientItemType.To].Add(sender);
                }
            }
            else
            {
                foreach (RepType item in replyTo)
                {
                    dictionary[RecipientItemType.To].Add(item);
                }
            }
            dictionary[RecipientItemType.Cc].ExceptWith(dictionary[RecipientItemType.To]);
            return(dictionary);
        }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            IDictionary <RecipientItemType, HashSet <string> > recipients = null;

            foreach (ComplexParticipantExtractorBase <string> complexParticipantExtractorBase in ReplyDisplayNamesProperty.Extractors)
            {
                if (complexParticipantExtractorBase.ShouldExtract(propertyBag))
                {
                    object result;
                    if (complexParticipantExtractorBase.Extract(propertyBag, (Participant participant) => participant.DisplayName, this.ParticipantRepresentationComparer, out recipients))
                    {
                        result = ReplyAllParticipantsRepresentationProperty <string> .BuildToAndCCRecipients <string>(recipients, this.ParticipantRepresentationComparer);
                    }
                    else
                    {
                        result = new PropertyError(this, PropertyErrorCode.GetCalculatedPropertyError);
                    }
                    return(result);
                }
            }
            return(new PropertyError(this, PropertyErrorCode.GetCalculatedPropertyError));
        }