Show / Hide Table of Contents

    Interface IEvent

    Represents an event which can be subscribed both synchronously or asynchorously, and is invoked asynchronously. 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
    System.IDisposable.Dispose()
    Namespace: AGS.API
    Assembly: AGS.API.dll
    Syntax
    public interface IEvent : IDisposable

    Properties

    | Improve this Doc View Source

    SubscribersCount

    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 Source

    InvokeAsync()

    Invoke the event asynchronously.

    Declaration
    Task InvokeAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task
    | Improve this Doc View Source

    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).

    | Improve this Doc View Source

    SubscribeToAsync(Func<Task>, CallbackPriority)

    Subscribe the specified asynchronous callback to the event. Once subscribed, whenever the event happens this callback will be called.

    Declaration
    void SubscribeToAsync(Func<Task> callback, CallbackPriority priority = CallbackPriority.Normal)
    Parameters
    Type Name Description
    System.Func<System.Threading.Tasks.Task> callback

    Callback.

    CallbackPriority priority

    The callback priority (determines the order in which the subscribers get the events).

    | Improve this Doc View Source

    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).

    | Improve this Doc View Source

    UnsubscribeToAsync(Func<Task>, CallbackPriority)

    Unsubscribe the specified asynchronous callback from the event. This will stops notifications to call this callback.

    Declaration
    void UnsubscribeToAsync(Func<Task> callback, CallbackPriority priority = CallbackPriority.Normal)
    Parameters
    Type Name Description
    System.Func<System.Threading.Tasks.Task> callback

    Callback.

    CallbackPriority priority

    The callback priority (determines the order in which the subscribers get the events).

    | Improve this Doc View Source

    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.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX