Esempio n. 1
0
        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)));
        }
Esempio n. 2
0
        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)));
        }
Esempio n. 3
0
        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)));
        }