Class EventSubscriber
A disposable class for subscribing to Phoenix events.
Inheritance
Implements
Inherited Members
Namespace: Phoenix.Controls
Assembly: Phoenix.Controls.dll
Syntax
public class EventSubscriber : IDisposable
Constructors
View SourceEventSubscriber(IEventAggregator)
Initializes a new instance of the EventSubscriber class.
Declaration
public EventSubscriber(IEventAggregator eventAggregator)
Parameters
Type | Name | Description |
---|---|---|
IEventAggregator | eventAggregator | The event aggregator. |
Methods
View SourceAdd(SubscriptionToken)
Adds a subscription token.
Declaration
public void Add(SubscriptionToken token)
Parameters
Type | Name | Description |
---|---|---|
SubscriptionToken | token | The token. |
Add<TEvent>(Action, ThreadOption, Boolean)
Adds an event subscription.
Declaration
public void Add<TEvent>(Action action, ThreadOption threadOption = null, bool keepSubscriberReferenceAlive = false)
where TEvent : PubSubEvent, new()
Parameters
Type | Name | Description |
---|---|---|
System.Action | action | The action to run. |
ThreadOption | threadOption | Specifies on which thread to receive the delegate callback. |
System.Boolean | keepSubscriberReferenceAlive | When true, the PubSubEvent keeps a reference to the subscriber so it does not get garbage collected. |
Type Parameters
Name | Description |
---|---|
TEvent | The event type. |
Add<TEvent, TArgs>(Action<TArgs>)
Adds an event subscription.
Declaration
public void Add<TEvent, TArgs>(Action<TArgs> action)
where TEvent : PubSubEvent<TArgs>, new()
Parameters
Type | Name | Description |
---|---|---|
System.Action<TArgs> | action | The action to run. |
Type Parameters
Name | Description |
---|---|
TEvent | The event type. |
TArgs | The event args type. |
Add<TEvent, TArgs>(Action<TArgs>, ThreadOption, Boolean, Predicate<TArgs>)
Adds an event subscription.
Declaration
public void Add<TEvent, TArgs>(Action<TArgs> action, ThreadOption threadOption, bool keepSubscriberReferenceAlive = false, Predicate<TArgs> filter = null)
where TEvent : PubSubEvent<TArgs>, new()
Parameters
Type | Name | Description |
---|---|---|
System.Action<TArgs> | action | The action to run. |
ThreadOption | threadOption | Specifies on which thread to receive the delegate callback. |
System.Boolean | keepSubscriberReferenceAlive | When true, the PubSubEvent keeps a reference to the subscriber so it does not get garbage collected. |
System.Predicate<TArgs> | filter | Filter to evaluate if the subscriber should receive the event. |
Type Parameters
Name | Description |
---|---|
TEvent | The event type. |
TArgs | The event args type. |
Dispose()
Declaration
public void Dispose()