Table of Contents

Class SimulationHost

Namespace
SimulationFramework
Assembly
SimulationFramework.dll

Runs a simulation and manages its components.

public class SimulationHost
Inheritance
SimulationHost
Inherited Members

Constructors

SimulationHost()

Creates a new SimulationHost instance.

public SimulationHost()

Properties

Current

The currently running simulation host.

public static SimulationHost? Current { get; }

Property Value

SimulationHost

Dispatcher

The simulation's dispatcher.

public MessageDispatcher Dispatcher { get; set; }

Property Value

MessageDispatcher

IsRendering

true if the simulation currently rendering, preventing some operations like window resizing; otherwise false.

public bool IsRendering { get; }

Property Value

bool

Methods

GetComponent<T>()

Gets a component of the provided type.

public T? GetComponent<T>() where T : class, ISimulationComponent

Returns

T

The component, of type T, or null if it was not found.

Type Parameters

T

The type of component to find.

GetCurrent()

Returns Current if it is not null; throw an exception otherwise.

public static SimulationHost GetCurrent()

Returns

SimulationHost

Initialize(ISimulationPlatform?)

Initializes this SimulationHost using the provided platform.

public void Initialize(ISimulationPlatform? platform)

Parameters

platform ISimulationPlatform

RegisterComponent(ISimulationComponent)

Register a component with the simulation.

public void RegisterComponent(ISimulationComponent component)

Parameters

component ISimulationComponent

The component to register.

RegisterPlatform(Func<ISimulationPlatform?>)

public static void RegisterPlatform(Func<ISimulationPlatform?> factory)

Parameters

factory Func<ISimulationPlatform>

RemoveComponent(ISimulationComponent)

Removes a component from the simulation.

public void RemoveComponent(ISimulationComponent component)

Parameters

component ISimulationComponent

The component to remove.

Start(Simulation?)

Starts a simulation and makes this host current.

If this host is not initialized, then this method initializes it.

This method throws if a SimulationHost is already running (Current is non-null).

public void Start(Simulation? simulation)

Parameters

simulation Simulation

The simulation to start. If this value is null, the host starts without a simulation.

Start<TSimulation>()

Starts a new instance of TSimulation and makes this host current.

If this host is not initialized, then this method initializes it.

This method throws if a SimulationHost is already running (Current is non-null).

public void Start<TSimulation>() where TSimulation : Simulation, new()

Type Parameters

TSimulation

The type of simulation to start. Must have a parameterless constructor.