Table of Contents

Class MessageDispatcher

Namespace
SimulationFramework.Messaging
Assembly
SimulationFramework.dll

Dispatches application messages.

public sealed class MessageDispatcher
Inheritance
MessageDispatcher
Inherited Members

Methods

Flush()

Dispatches all queued messages. This method is called by the application at the beginning and end of each frame.

public void Flush()

ImmediateDispatch<T>(T)

Immediately dispatches a message, raising notifications and calling listeners.

public void ImmediateDispatch<T>(T message) where T : Message

Parameters

message T

The message data.

Type Parameters

T

The type of message to dispatch.

NotifyAfter<T>(MessageListener<T>)

Invokes the provided delegate once after the next dispatch of the specified message type.

public void NotifyAfter<T>(MessageListener<T> listener) where T : Message

Parameters

listener MessageListener<T>

The notification delegate.

Type Parameters

T

The type of message to be notified of.

NotifyBefore<T>(MessageListener<T>)

Invokes the provided delegate once before the next dispatch of the specified message type.

public void NotifyBefore<T>(MessageListener<T> listener) where T : Message

Parameters

listener MessageListener<T>

The notification delegate.

Type Parameters

T

The type of message to be notified of.

QueueDispatch<T>(T)

Adds an event to the event queue. The event is dispatched upon the next call to Flush() (usually done by the application).

public void QueueDispatch<T>(T message) where T : Message

Parameters

message T

Type Parameters

T

Subscribe<T>(MessageListener<T>)

Subscribes a delegate to listen for messages of a specific type.

public void Subscribe<T>(MessageListener<T> listener) where T : Message

Parameters

listener MessageListener<T>

The listener delegate.

Type Parameters

T

The type of message to listen for.

Unsubscribe<T>(MessageListener<T>)

Unsubscibes a delegate from listening for messages.

public void Unsubscribe<T>(MessageListener<T> listener) where T : Message

Parameters

listener MessageListener<T>

The listener to unsubscribe.

Type Parameters

T

The type of messages the delegate was listening for.