예제 #1
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            IDictionary <RecipientItemType, HashSet <string> > recipients = null;

            foreach (ComplexParticipantExtractorBase <string> complexParticipantExtractorBase in ReplyAllDisplayNamesProperty.Extractors)
            {
                if (complexParticipantExtractorBase.ShouldExtract(propertyBag))
                {
                    IList <string> replyTo;
                    object         result;
                    if (complexParticipantExtractorBase.Extract(propertyBag, (Participant participant) => participant.DisplayName, this.ParticipantRepresentationComparer, out recipients, out replyTo))
                    {
                        IParticipant simpleParticipant  = base.GetSimpleParticipant(InternalSchema.Sender, propertyBag);
                        IParticipant simpleParticipant2 = base.GetSimpleParticipant(InternalSchema.From, propertyBag);
                        result = ReplyAllParticipantsRepresentationProperty <string> .BuildReplyAllRecipients <string>((simpleParticipant == null)?null : simpleParticipant.DisplayName, (simpleParticipant2 == null)?null : simpleParticipant2.DisplayName, replyTo, recipients, this.ParticipantRepresentationComparer);
                    }
                    else
                    {
                        result = new PropertyError(this, PropertyErrorCode.GetCalculatedPropertyError);
                    }
                    return(result);
                }
            }
            return(new PropertyError(this, PropertyErrorCode.GetCalculatedPropertyError));
        }
예제 #2
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);
        }
예제 #3
0
        public bool TryRetrieveReplyAllDisplayNames(IStorePropertyBag propertyBag, out HashSet <string> displayNames)
        {
            ReplyAllParticipantsRepresentationProperty <string> replyAllDisplayNames = InternalSchema.ReplyAllDisplayNames;
            object obj = propertyBag.TryGetProperty(replyAllDisplayNames);

            displayNames = null;
            if (PropertyError.IsPropertyError(obj))
            {
                return(false);
            }
            displayNames = this.RetrieveReplyAllData((IDictionary <RecipientItemType, HashSet <string> >)obj, replyAllDisplayNames.ParticipantRepresentationComparer);
            return(true);
        }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            IDictionary <RecipientItemType, HashSet <IParticipant> > recipients = null;

            if (ReplyAllParticipantsProperty.Extractor.ShouldExtract(propertyBag))
            {
                IList <IParticipant> replyTo;
                if (ReplyAllParticipantsProperty.Extractor.Extract(propertyBag, (Participant participant) => participant, this.ParticipantRepresentationComparer, out recipients, out replyTo))
                {
                    IParticipant simpleParticipant  = base.GetSimpleParticipant(InternalSchema.Sender, propertyBag);
                    IParticipant simpleParticipant2 = base.GetSimpleParticipant(InternalSchema.From, propertyBag);
                    return(ReplyAllParticipantsRepresentationProperty <IParticipant> .BuildReplyAllRecipients <IParticipant>(simpleParticipant, simpleParticipant2, replyTo, recipients, this.ParticipantRepresentationComparer));
                }
            }
            return(ReplyAllParticipantsRepresentationProperty <IParticipant> .InstantiateResultType(this.ParticipantRepresentationComparer));
        }
예제 #5
0
        public static IDictionary <RecipientItemType, HashSet <RepType> > BuildToAndCCRecipients <RepType>(IDictionary <RecipientItemType, HashSet <RepType> > recipients, IEqualityComparer <RepType> participantRepresentationComparer)
        {
            IDictionary <RecipientItemType, HashSet <RepType> > dictionary = ReplyAllParticipantsRepresentationProperty <RepType> .InstantiateResultType(participantRepresentationComparer);

            foreach (KeyValuePair <RecipientItemType, HashSet <RepType> > keyValuePair in recipients)
            {
                if (keyValuePair.Key == RecipientItemType.To || keyValuePair.Key == RecipientItemType.Cc)
                {
                    foreach (RepType item in keyValuePair.Value)
                    {
                        dictionary[keyValuePair.Key].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));
        }