Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (26 sloc) 2.15 KB

On events, dispatchers and lists (a general explanation of the system)

The system works with the following classes and interfaces:

  • Events
    This is how events are exposed to the ourside world
    • IEvent<TSender, TArgs> – models an event with a generic sender and generic argument.
    • ISimpleEvent<TArgs> – models a simple event with a generic argument.
    • ISignal – models a signal; an argumentless event.
    • ISubscribable<THandlerType> – Base interface for the events. Not used outside the system. Helps to make an abstraction over events by making the handler of an event generic. Needed for the system to use base class implementations.

  • Handlers
    This is how the the outside world subscribes to an event. It defines the function signature.
    • IEventHandler<TSender, TArgs>(sender: TSender, args: TArgs): void – this handler is for events.
    • ISimpleEventHandler<TArgs>(args: TArgs): void – this handler is for simple events.
    • ISignalHandler(): void – this handler is for signals.

  • Dispatchers
    This is how events are implemented. It implements a subscribe, unsubscribe and provides a dispatch method for dispatching the events. Dispatchers make the whole system work.
    • EventDispatcher<TSender, TArgs> – implements a dispatcher for events.
    • SimpleEventDispatcher<TArgs> – implements a dispatcher for simple events.
    • SignalDispatcher – implements a dispatcher for signals.
    • DispatcherBase<TEventHandler> – abstract base class to implement dispatchers.

  • Eventlists
    Helps with the implementation of multiple named events. Events are automatically created when a get is called. Useful when implementing multiple events on a class.
    • EventList<TSender, TArgs> – implements an event list for events.
    • SimpleEventList<TArgs> – implements an event list for simple events.
    • SignalList – implements an event list for signals.
    • EventListBase<TEventDispatcher> – abstract base class for event lists.

You can’t perform that action at this time.