Interface IBlockingEvent<TEventArgs>
Represents an event which can be subscribed and invoked synchronously. An event is a notification for something that has happened. Interested parties can subscribe to the event and be notified when it triggers (https://en.wikipedia.org/wiki/Event-driven_programming).
Inherited Members
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public interface IBlockingEvent<TEventArgs> : IDisposable
Type Parameters
Name | Description |
---|---|
TEventArgs |
Properties
| Improve this Doc View SourceSubscribersCount
Gets the number of subscribers to the event.
Declaration
int SubscribersCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The subscribers count. |
Methods
| Improve this Doc View SourceInvoke(TEventArgs)
Invoke the event synchronously (i.e will wait for all subscribers to process the event before moving on).
Declaration
void Invoke(TEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
TEventArgs | args | Event arguments which can be used to provide additional data. |
Subscribe(ClaimableCallbackWithArgs<TEventArgs>, CallbackPriority)
Subscribe the specified callback to the event. Once subscribed, whenever the event happens this callback will be called.
In addition, this specific overload allows you to claim the event so that subscribers which follow you on the list will not receive the event. For an example- ClaimableCallback.
Declaration
void Subscribe(ClaimableCallbackWithArgs<TEventArgs> callback, CallbackPriority priority = CallbackPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
ClaimableCallbackWithArgs<TEventArgs> | callback | Callback. |
CallbackPriority | priority | The callback priority (determines the order in which the subscribers get the events). |
Subscribe(Action, CallbackPriority)
Subscribe the specified callback to the event. Once subscribed, whenever the event happens this callback will be called.
Declaration
void Subscribe(Action callback, CallbackPriority priority = CallbackPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
System.Action | callback | Callback. |
CallbackPriority | priority | The callback priority (determines the order in which the subscribers get the events). |
Subscribe(Action<TEventArgs>, CallbackPriority)
Subscribe the specified callback to the event. Once subscribed, whenever the event happens this callback will be called.
Declaration
void Subscribe(Action<TEventArgs> callback, CallbackPriority priority = CallbackPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
System.Action<TEventArgs> | callback | Callback. |
CallbackPriority | priority | The callback priority (determines the order in which the subscribers get the events). |
Unsubscribe(ClaimableCallbackWithArgs<TEventArgs>, CallbackPriority)
Unsubscribe the specified callback from the event. This will stops notifications to call this callback.
Declaration
void Unsubscribe(ClaimableCallbackWithArgs<TEventArgs> callback, CallbackPriority priority = CallbackPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
ClaimableCallbackWithArgs<TEventArgs> | callback | Callback. |
CallbackPriority | priority | The callback priority (determines the order in which the subscribers get the events). |
Unsubscribe(Action, CallbackPriority)
Unsubscribe the specified callback from the event. This will stops notifications to call this callback.
Declaration
void Unsubscribe(Action callback, CallbackPriority priority = CallbackPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
System.Action | callback | Callback. |
CallbackPriority | priority | The callback priority (determines the order in which the subscribers get the events). |
Unsubscribe(Action<TEventArgs>, CallbackPriority)
Unsubscribe the specified callback from the event. This will stops notifications to call this callback.
Declaration
void Unsubscribe(Action<TEventArgs> callback, CallbackPriority priority = CallbackPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
System.Action<TEventArgs> | callback | Callback. |
CallbackPriority | priority | The callback priority (determines the order in which the subscribers get the events). |
WaitUntilAsync(Predicate<TEventArgs>, CallbackPriority)
Asynchronously wait until the event fires and the specific condition applies.
Declaration
Task WaitUntilAsync(Predicate<TEventArgs> condition, CallbackPriority priority = CallbackPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
System.Predicate<TEventArgs> | condition | The condition we are waiting to apply before moving on. |
CallbackPriority | priority | The callback priority (determines the order in which the subscribers get the events). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The task to be awaited. |