// 拆除消息(命令或事件)的运动路径 public static void UnPath(IDelegateHandler handler) { if (handler == null) { return; } SMessageDispatcher.UnRegister(handler); }
public static void DeletePath(IMessagePathId handler) { if (handler == null) { return; } SMessageDispatcher.Disconnect(handler); }
// 修建消息(命令或事件)的运动路径 public static DelegateHandler <TMessage> Path <TMessage>(string description, LogEnum logType, Action <TMessage> action) { StackTrace ss = new StackTrace(false); // 0是Path,1是Window或On,2是当地 Type location = ss.GetFrame(2).GetMethod().DeclaringType; IHandlerId handlerId = HandlerId.Create(typeof(TMessage), location, description, logType); return(SMessageDispatcher.Register(handlerId, action)); }