/// <summary> /// /// </summary> /// <param name="handler"></param> public SubscribeInfo(Func <object> handler) : this(ObserverHandler.CreateA <object>(handler)) { }
/// <summary> /// /// </summary> /// <param name="handler"></param> public SubscribeInfo(Action handler) : this(ObserverHandler.Create(handler)) { }
/// <summary> /// /// </summary> /// <param name="bus"></param> /// <param name="topic">消息主题</param> /// <param name="handler">处理器</param> public static void Unsubscribe(this IMessageBus bus, string topic, Action handler) { Guard.NotNull(bus, "bus"); Guard.NotNull(handler, "handler"); bus.Unsubscribe(topic, null, ObserverHandler.Create(handler)); }
/// <summary> /// /// </summary> /// <typeparam name="TData"></typeparam> /// <param name="bus"></param> /// <param name="handler">处理器</param> public static void Unsubscribe <TData>(this IMessageBus bus, Action <TData> handler) { Guard.NotNull(bus, "bus"); Guard.NotNull(handler, "handler"); bus.Unsubscribe(null, typeof(TData), ObserverHandler.Create1 <TData>(handler)); }
/// <summary> /// /// </summary> /// <typeparam name="TData"></typeparam> /// <typeparam name="TResult"></typeparam> /// <param name="bus"></param> /// <param name="topic">消息主题</param> /// <param name="handler">处理器</param> public static void Unsubscribe <TData, TResult>(this IMessageBus bus, string topic, Func <object, TData, TResult> handler) { Guard.NotNull(bus, "bus"); Guard.NotNull(handler, "handler"); bus.Unsubscribe(topic, typeof(TData), ObserverHandler.CreateC <TData, TResult>(handler)); }
/// <summary> /// /// </summary> /// <typeparam name="TResult"></typeparam> /// <param name="bus"></param> /// <param name="topic">消息主题</param> /// <param name="handler">处理器</param> public static void Unsubscribe <TResult>(this IMessageBus bus, string topic, Func <TResult> handler) { Guard.NotNull(bus, "bus"); Guard.NotNull(handler, "handler"); bus.Unsubscribe(topic, null, ObserverHandler.CreateA(handler)); }
/// <summary> /// /// </summary> /// <typeparam name="TData"></typeparam> /// <typeparam name="TResult"></typeparam> /// <param name="bus"></param> /// <param name="handler">处理器</param> public static void Unsubscribe <TData, TResult>(this IMessageBus bus, Func <TData, TResult> handler) { Guard.NotNull(bus, "bus"); Guard.NotNull(handler, "handler"); bus.Unsubscribe(null, typeof(TData), ObserverHandler.CreateB <TData, TResult>(handler)); }