Ejemplo n.º 1
0
        private static bool TheMessageDoNotSatisfyMyFilter(IListenTo listener, IEvent message, Type messageType)
        {
            var closedInterface = typeof(IListenTo<>.ThatSatisfy).MakeGenericType(messageType);
            var genericMethod = SatisfiedByMethod(closedInterface);

            if (genericMethod == null)
                return true;

            return !(bool)genericMethod.Invoke(listener, new[] { message });
        }
Ejemplo n.º 2
0
        private static bool TheMessageWasNotSentToMe(IListenTo listener, dynamic message)
        {
            var messageIsDirectedEvent = ((Type)message.GetType()).ImplementsInterfaceTemplate(typeof(IDirectedEvent<>));
            if (!messageIsDirectedEvent)
                return true;

            if (message.CurrentReceiver == null)
                return true;

            var messageWasSentToMe = message.CurrentReceiver.Equals(listener);

            return !messageWasSentToMe;
        }
Ejemplo n.º 3
0
 public void Unsubscribe <TEvent>(IListenTo <TEvent> listener) where TEvent : Event
 {
     Unsubscribe(typeof(TEvent), listener);
 }