public void RemoveActionRegister <T>(Action <T> action) where T : IEventData { var actionHandler = new ActionEventHandler <T>(action); var handlerToRemove = FindRegisterToRemove(typeof(T), actionHandler.GetType()); RemoveRegister(typeof(T), handlerToRemove); }
/// <summary> /// 注册Action事件处理器 /// </summary> /// <typeparam name="TEventData"></typeparam> /// <param name="action"></param> public void Register <TEventData>(Action <TEventData> action) where TEventData : IEventData { //1.构造ActionEventHandler var actionHandler = new ActionEventHandler <TEventData>(action); //2.将ActionEventHandler的实例注入到Ioc容器 //IocContainer.Register( // Component.For<IEventHandler<TEventData>>() // .UsingFactoryMethod(() => actionHandler)); //3.注册到事件总线 Register <TEventData>(actionHandler); }
public void AddActionRegister <T>(Action <T> action) where T : IEventData { var actionHandler = new ActionEventHandler <T>(action); AddRegister(typeof(T), actionHandler.GetType()); }