예제 #1
0
 public void Update(IHandlerId data)
 {
     this.MessageType = data.MessageType;
     this.Description = data.Description;
     this.LogType     = data.LogType;
     this.Location    = data.Location;
 }
예제 #2
0
 public HandlerIdViewModel(IHandlerId data)
 {
     _id          = data.Id;
     _messageType = data.MessageType;
     _location    = data.Location;
     _logType     = data.LogType;
     _description = data.Description;
 }
예제 #3
0
        public static DelegateHandler <TMessage> Access <TMessage>(
            Guid id, string description, LogEnum logType, Action <TMessage> action)
        {
            StackTrace ss        = new StackTrace(false);
            Type       location  = ss.GetFrame(1).GetMethod().DeclaringType;
            IHandlerId handlerId = HandlerId.Create(typeof(TMessage), location, id, description, logType);

            return(MessageDispatcher.Register(handlerId, action));
        }
예제 #4
0
        // 修建消息(命令或事件)的运动路径
        public static DelegateHandler <TMessage> Path <TMessage>(string description, LogEnum logType, Action <TMessage> action)
        {
            StackTrace ss = new StackTrace(false);
            // 0是Path,1是Accpt或On,2是当地
            Type       location  = ss.GetFrame(2).GetMethod().DeclaringType;
            IHandlerId handlerId = HandlerId.Create(typeof(TMessage), location, description, logType);

            return(SMessageDispatcher.Register(handlerId, action));
        }
예제 #5
0
 public DelegateHandler(IHandlerId handlerId, Action <TMessage> action)
 {
     this.HandlerId = handlerId;
     _action        = action;
 }
예제 #6
0
 public DelegateHandler(IHandlerId handlerId, Action <TMessage> action)
 {
     this.HandlerId = handlerId;
     this.IsEnabled = true;
     _action        = action;
 }
        public static DelegateHandler <TMessage> Register <TMessage>(this IMessageDispatcher dispatcher, IHandlerId handlerId, Action <TMessage> action)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }
            DelegateHandler <TMessage> handler = new DelegateHandler <TMessage>(handlerId, action);

            dispatcher.Register(handler);
            return(handler);
        }