public void RegisterHandler <T>(Action <T> handler) where T : IMessage { List <Action <IMessage> > handlers; if (!_actions.TryGetValue(typeof(T), out handlers)) { handlers = new List <Action <IMessage> >(); _actions.Add(typeof(T), handlers); } handlers.Add(ActionCastHelper.CastArgument <IMessage, T>(x => handler(x))); }
public void RegisterHandler <T>(Action <T> handler) where T : IMessage { ISubject <IMessage> handlers; if (!_actions.TryGetValue(typeof(T), out handlers)) { handlers = new EDASubject <IMessage>(); _actions.Add(typeof(T), handlers); } handlers.Subscribe(ActionCastHelper.CastArgument <IMessage, T>(c => handler(c))); }
public void RegisterHandler <T>(Action <T> handler) where T : IMessage { ISubject <IMessage> handlers; if (!_actions.TryGetValue(typeof(T), out handlers)) { handlers = new Subject <IMessage>(); _actions.Add(typeof(T), handlers); } Subject.Synchronize(handlers).SubscribeOn(Scheduler.Default) .Subscribe(ActionCastHelper.CastArgument <IMessage, T>(x => handler(x))); }