Interface IBlockingEvent
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 : IDisposable
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()
Invoke the event synchronously (i.e will wait for all subscribers to process the event before moving on).
Declaration
void Invoke()
Subscribe(ClaimableCallback, 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(ClaimableCallback callback, CallbackPriority priority = CallbackPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
ClaimableCallback | 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). |
Unsubscribe(ClaimableCallback, CallbackPriority)
Unsubscribe the specified callback from the event. This will stops notifications to call this callback.
Declaration
void Unsubscribe(ClaimableCallback callback, CallbackPriority priority = CallbackPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
ClaimableCallback | 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). |
WaitUntilAsync(Func<Boolean>, CallbackPriority)
Asynchronously wait until the event fires and the specific condition applies.
Declaration
Task WaitUntilAsync(Func<bool> condition, CallbackPriority priority = CallbackPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
System.Func<System.Boolean> | 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. |