Interface IEventAggregator
Delivers messages from publishers to the handlers subscribed to their type, so the two do not need to know each other.
public interface IEventAggregator
Properties
Subscriptions
The active subscriptions, as tokens.
IReadOnlyCollection<IEventSubscriptionToken> Subscriptions { get; }
Property Value
Methods
Clear()
Removes every subscription.
void Clear()
Publish<T>(T)
Delivers message to every handler subscribed to T.
void Publish<T>(T message) where T : IEvent
Parameters
messageT
Type Parameters
T
Subscribe<T>(Action<T>)
Subscribes a handler to messages of type T. Disposing the returned
token unsubscribes it.
IEventSubscriptionToken Subscribe<T>(Action<T> action) where T : IEvent
Parameters
actionAction<T>
Returns
Type Parameters
T
Subscribe<T>(Action<T>, IEventSubscriptionToken)
Subscribes a handler under a token the caller made. Unsubscribe with that token to stop it.
IEventSubscriptionToken Subscribe<T>(Action<T> action, IEventSubscriptionToken subscriptionToken) where T : IEvent
Parameters
actionAction<T>subscriptionTokenIEventSubscriptionToken
Returns
Type Parameters
T
Unsubscribe(IEventSubscriptionToken)
Removes the subscription with this token.
void Unsubscribe(IEventSubscriptionToken subscriptionToken)
Parameters
subscriptionTokenIEventSubscriptionToken