예제 #1
0
 public QuestionContainer(T MessageIdentifier, IReceiveQuestion ReceiverObject, Predicate <object> ConditionPredicate = null)
     : base(MessageIdentifier, ConditionPredicate)
 {
     this.MessageIdentifier  = MessageIdentifier;
     this.ReceiverObject     = ReceiverObject;
     this.ConditionPredicate = ConditionPredicate;
 }
예제 #2
0
        public void SubscribeByQuestionType <T>(IReceiveQuestion ReceiverObject)
            where T : QuestionBase
        {
            var FoundQuestions = from question in QuestionsByType
                                 where question.ReceiverObject == ReceiverObject
                                 select question;

            int FoundQuestionsCount = FoundQuestions.Count();

            if (FoundQuestionsCount == 0)
            {
                QuestionsByType.Add(new QuestionContainer <Type>(typeof(T), ReceiverObject));
            }
        }
예제 #3
0
        public void SubscribeByQuestionTypeAndCondition <T>(IReceiveQuestion ReceiverObject, Predicate <object> ConditionPredicate)
            where T : MessageBase
        {
            if (ConditionPredicate == null)
            {
                throw new Exception("The ConditionPredicate entered can not be null.");
            }

            var FoundQuestions = from question in QuestionsByType
                                 where question.ReceiverObject == ReceiverObject
                                 select question;

            int FoundQuestionsCount = FoundQuestions.Count();

            if (FoundQuestionsCount == 0)
            {
                QuestionsByType.Add(new QuestionContainer <Type>(typeof(T), ReceiverObject, ConditionPredicate));
            }
        }