Table of Contents

Class Application

Namespace
SimulationFramework
Assembly
SimulationFramework.dll

Provides mechanisms for acquiring components to the simulation.

public static class Application
Inheritance
Application
Inherited Members

Properties

PrimaryDisplay

Gets an IDisplay instance which represents the system's primary display.

public static IDisplay PrimaryDisplay { get; }

Property Value

IDisplay

Methods

CancelExit()

Cancels a pending request to exit the simulation. Must be called from a listener of either the Exiting event or an ExitMessage.

public static void CancelExit()

Exceptions

InvalidOperationException

Exit(bool)

Makes request to exit the simulation.

Calling this method invokes the Exiting event and dispatches an ExitMessage, during which CancelExit() can be called to cancel the exit request.

public static void Exit(bool cancellable)

Parameters

cancellable bool

Whether the exit request can be cancelled using CancelExit().

GetComponentOrDefault<TComponent>()

Gets the first component of the a specific type. If no components of the specified type are found, this method returns null.

public static TComponent? GetComponentOrDefault<TComponent>() where TComponent : class, ISimulationComponent

Returns

TComponent

A component of type TComponent; or null if one wasn't found.

Type Parameters

TComponent

The type of component to get.

GetComponent<TComponent>()

Gets the first component of the a specific type. If no components of the specified type are found, this method throws an exception.

public static TComponent GetComponent<TComponent>() where TComponent : class, ISimulationComponent

Returns

TComponent

A component of type TComponent.

Type Parameters

TComponent

The type of component to get.

GetDisplays()

Gets all of the system's currently active displays.

public static IEnumerable<IDisplay> GetDisplays()

Returns

IEnumerable<IDisplay>

An IEnumerable<T> containing the system's displays.

HasComponent<TComponent>()

Determines if the true if the simulation has a component of the specified type.

public static bool HasComponent<TComponent>() where TComponent : class, ISimulationComponent

Returns

bool

true if the simulation has a component of type TComponent; otherwise false.

Type Parameters

TComponent

The type of component.

InterceptComponent<TComponent>(Func<TComponent, TComponent>)

Removes the component of the provided type from the simulation and replaces it with the one returned by interceptProvider.

public static void InterceptComponent<TComponent>(Func<TComponent, TComponent> interceptProvider) where TComponent : class, ISimulationComponent

Parameters

interceptProvider Func<TComponent, TComponent>

A delegate which accepts the component being intercepted and returns the new component to be added in it's place.

Type Parameters

TComponent

The type of component to intercept.

RegisterComponent<TComponent>()

Adds a new component to the simulation.

public static void RegisterComponent<TComponent>() where TComponent : class, ISimulationComponent, new()

Type Parameters

TComponent

The type of component to add. Must be a class and have a parameterless constructor.

RegisterComponent<TComponent>(TComponent)

Adds a new component to the simulation.

public static void RegisterComponent<TComponent>(TComponent component) where TComponent : class, ISimulationComponent

Parameters

component TComponent

The component to add.

Type Parameters

TComponent

The type of component to add. Must be a class.

Events

Exiting

Invoked when the simulation is trying to exit. The exit can be cancelled using CancelExit().

public static event MessageListener<ExitMessage> Exiting

Event Type

MessageListener<ExitMessage>