Search Results for

    Show / Hide Table of Contents

    Class EventDispatcher

    The EventDispatcher is responsible for dispatching and invoking all the registered IEventHandler methods

    Inheritance
    System.Object
    EventDispatcher
    Namespace: OpenAPI.Events
    Assembly: OpenAPI.dll
    Syntax
    public class EventDispatcher : object

    Constructors

    | Improve this Doc View Source

    EventDispatcher(OpenApi, EventDispatcher[])

    Declaration
    public EventDispatcher(OpenApi openApi, params EventDispatcher[] dispatchers)
    Parameters
    Type Name Description
    OpenApi openApi
    EventDispatcher[] dispatchers

    Properties

    | Improve this Doc View Source

    Api

    Declaration
    protected OpenApi Api { get; }
    Property Value
    Type Description
    OpenApi

    Methods

    | Improve this Doc View Source

    DispatchEvent(Event)

    Dispatches a new Event to all methods registered with an EventHandlerAttribute

    Declaration
    public void DispatchEvent(Event e)
    Parameters
    Type Name Description
    Event e

    The event to dispatch

    | Improve this Doc View Source

    DispatchEventAsync<TEvent>(TEvent)

    Dispatches

    Declaration
    public Task<TEvent> DispatchEventAsync<TEvent>(TEvent e)
        where TEvent : Event
    Parameters
    Type Name Description
    TEvent e
    Returns
    Type Description
    Task<TEvent>
    Type Parameters
    Name Description
    TEvent
    | Improve this Doc View Source

    LoadFrom(Assembly)

    Loads all types implementing the Event class

    Declaration
    public void LoadFrom(Assembly assembly)
    Parameters
    Type Name Description
    Assembly assembly

    The assembly containing the Event implementations

    | Improve this Doc View Source

    RegisterEvents(IEventHandler)

    Registers all EventHandler methods with the current EventDispatcher.

    Declaration
    public void RegisterEvents(IEventHandler obj)
    Parameters
    Type Name Description
    IEventHandler obj

    The class to scan for EventHandlers

    | Improve this Doc View Source

    RegisterEventType(Type)

    Registers a new Event

    Declaration
    public bool RegisterEventType(Type type)
    Parameters
    Type Name Description
    Type type

    The type of the Event to register

    Returns
    Type Description
    System.Boolean

    Whether the event was succesfully registered.

    | Improve this Doc View Source

    RegisterEventType<TEvent>()

    Registers a new Event type with the current EventDispatcher

    Declaration
    public void RegisterEventType<TEvent>()
        where TEvent : Event
    Type Parameters
    Name Description
    TEvent

    The type of the Event to register

    Exceptions
    Type Condition
    DuplicateTypeException

    Thrown when the type of TEvent has already been registered.

    | Improve this Doc View Source

    Unload(Assembly)

    Unloads all Event's that were registered by specified assembly

    Declaration
    public void Unload(Assembly assembly)
    Parameters
    Type Name Description
    Assembly assembly

    The assembly containing the types to be unloaded.

    | Improve this Doc View Source

    UnregisterEvents(IEventHandler)

    Unregisters all EventHandlerAttribute from the specified IEventHandler implementation from the current EventDispatcher After UnRegistering, the class will no longer get invoked when an event gets dispatched.

    Declaration
    public void UnregisterEvents(IEventHandler obj)
    Parameters
    Type Name Description
    IEventHandler obj

    The implementation to unregister the eventhandlers for

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