Search Results for

    Show / Hide Table of Contents

    Class AsyncEvent<TSender, TArgs>

    Implementation of asynchronous event. The handlers of such events are executed asynchronously, but sequentially.

    Inheritance
    System.Object
    AsyncEvent
    AsyncEvent<TSender, TArgs>
    Inherited Members
    AsyncEvent.Name
    Namespace: DisCatSharp.Common.Utilities
    Assembly: DisCatSharp.Common.dll
    Syntax
    public sealed class AsyncEvent<TSender, TArgs> : AsyncEvent where TArgs : AsyncEventArgs
    Type Parameters
    Name Description
    TSender

    Type of the object that dispatches this event.

    TArgs

    Type of event argument object passed to this event's handlers.

    Constructors

    | Improve this Doc View Source

    AsyncEvent(String, TimeSpan, AsyncEventExceptionHandler<TSender, TArgs>)

    Creates a new asynchronous event with specified name and exception handler.

    Declaration
    public AsyncEvent(string name, TimeSpan maxExecutionTime, AsyncEventExceptionHandler<TSender, TArgs> exceptionHandler)
    Parameters
    Type Name Description
    System.String name

    Name of this event.

    System.TimeSpan maxExecutionTime

    Maximum handler execution time. A value of System.TimeSpan.Zero means infinite.

    AsyncEventExceptionHandler<TSender, TArgs> exceptionHandler

    Delegate which handles exceptions caused by this event.

    Properties

    | Improve this Doc View Source

    MaximumExecutionTime

    Gets the maximum allotted execution time for all handlers. Any event which causes the handler to time out will raise a non-fatal AsyncEventTimeoutException<TSender, TArgs>.

    Declaration
    public TimeSpan MaximumExecutionTime { get; }
    Property Value
    Type Description
    System.TimeSpan

    Methods

    | Improve this Doc View Source

    InvokeAsync(TSender, TArgs, AsyncEventExceptionMode)

    Raises this event by invoking all of its registered handlers, in order of registration.

    All exceptions throw during invocation will be handled by the event's registered exception handler.

    Declaration
    public async Task InvokeAsync(TSender sender, TArgs e, AsyncEventExceptionMode exceptionMode = AsyncEventExceptionMode.HandleAll)
    Parameters
    Type Name Description
    TSender sender

    Object which raised this event.

    TArgs e

    Arguments for this event.

    AsyncEventExceptionMode exceptionMode

    Defines what to do with exceptions caught from handlers.

    Returns
    Type Description
    System.Threading.Tasks.Task
    | Improve this Doc View Source

    Register(AsyncEventHandler<TSender, TArgs>)

    Registers a new handler for this event.

    Declaration
    public void Register(AsyncEventHandler<TSender, TArgs> handler)
    Parameters
    Type Name Description
    AsyncEventHandler<TSender, TArgs> handler

    Handler to register for this event.

    | Improve this Doc View Source

    Unregister(AsyncEventHandler<TSender, TArgs>)

    Unregisters an existing handler from this event.

    Declaration
    public void Unregister(AsyncEventHandler<TSender, TArgs> handler)
    Parameters
    Type Name Description
    AsyncEventHandler<TSender, TArgs> handler

    Handler to unregister from the event.

    | Improve this Doc View Source

    UnregisterAll()

    Unregisters all existing handlers from this event.

    Declaration
    public void UnregisterAll()

    Extension Methods

    ReflectionUtilities.ToDictionary<T>(T)
    • Improve this Doc
    • View Source
    In This Article
    Back to top © 2021-2022 Aiko IT Systems