Пример #1
0
        /// <summary>
        /// Gets the message handler candidates for the specified message, i.e., the message handlers which return a confidence
        /// higher than one for the current message.
        /// </summary>
        /// <param name="message">The message info.</param>
        /// <returns></returns>
        private static Dictionary <MessageHandler, MessageHandlingResponse> GetMessageHandlerCandidates(Message message)
        {
            Dictionary <MessageHandler, MessageHandlingResponse> messageHandlerCandidates = new Dictionary <MessageHandler, MessageHandlingResponse>();
            List <MessageHandler> allMessageHandlers = MessageHandlerFactory.InitializeMessageHandlers();

            foreach (MessageHandler messageHandlerCandidate in allMessageHandlers)
            {
                MessageHandlingResponse handlingResponse = messageHandlerCandidate.CanHandle(message);
                if (handlingResponse.Confidence > 0)
                {
                    messageHandlerCandidates[messageHandlerCandidate] = handlingResponse;
                }
            }
            return(messageHandlerCandidates);
        }