Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageProcessor"/> class.
        /// </summary>
        /// <param name="msgID">ID of the message to process. Must be non-zero.</param>
        /// <param name="methodDelegate">Delegate to the processing method.</param>
        /// <exception cref="ArgumentNullException"><paramref name="methodDelegate" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="msgID"/> is zero.</exception>
        public MessageProcessor(MessageProcessorID msgID, MessageProcessorHandler methodDelegate)
        {
            if (methodDelegate == null)
                throw new ArgumentNullException("methodDelegate");

            if (msgID == 0)
                throw new ArgumentOutOfRangeException("msgID", "The message ID may not be zero.");

            _msgID = msgID;
            _call = methodDelegate;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageProcessor"/> class.
        /// </summary>
        /// <param name="msgID">ID of the message to process. Must be non-zero.</param>
        /// <param name="methodDelegate">Delegate to the processing method.</param>
        /// <exception cref="ArgumentNullException"><paramref name="methodDelegate" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="msgID"/> is zero.</exception>
        public MessageProcessor(MessageProcessorID msgID, MessageProcessorHandler methodDelegate)
        {
            if (methodDelegate == null)
            {
                throw new ArgumentNullException("methodDelegate");
            }

            if (msgID.GetRawValue() == 0)
            {
                throw new ArgumentOutOfRangeException("msgID", "The message ID may not be zero.");
            }

            _msgID = msgID;
            _call  = methodDelegate;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a <see cref="IMessageProcessor"/>. Can be overridden in the derived classes to provide a different
 /// <see cref="IMessageProcessor"/> implementation. 
 /// </summary>
 /// <param name="atb">The <see cref="MessageHandlerAttribute"/> that was attached to the method that the
 /// <see cref="IMessageProcessor"/> is being created for.</param>
 /// <param name="handler">The <see cref="MessageProcessorHandler"/> for invoking the method.</param>
 /// <returns>The <see cref="IMessageProcessor"/> instance.</returns>
 protected virtual IMessageProcessor CreateMessageProcessor(MessageHandlerAttribute atb, MessageProcessorHandler handler)
 {
     return new MessageProcessor(atb.MsgID, handler);
 }
 /// <summary>
 /// Creates a <see cref="IMessageProcessor"/>. Can be overridden in the derived classes to provide a different
 /// <see cref="IMessageProcessor"/> implementation.
 /// </summary>
 /// <param name="atb">The <see cref="MessageHandlerAttribute"/> that was attached to the method that the
 /// <see cref="IMessageProcessor"/> is being created for.</param>
 /// <param name="handler">The <see cref="MessageProcessorHandler"/> for invoking the method.</param>
 /// <returns>The <see cref="IMessageProcessor"/> instance.</returns>
 protected virtual IMessageProcessor CreateMessageProcessor(MessageHandlerAttribute atb, MessageProcessorHandler handler)
 {
     return(new MessageProcessor(atb.MsgID, handler));
 }