Run

Description

static class Tinman.Engine.Run

Helper class for running IWidget, IApplication and other objects with minimal code effort.

Use the following methods to convert objects of other classes to IWidget or IApplication objects:

Public / Constants

Non​Modal


public static readonly attribute NonModal → (TinmanError)

A pseudo-error that indicates that an application is running in a non-modal environment.

In a typical modal environment, the application code runs its own loop, by calling ApplicationLoop.MainLoop repeatedly, until it decides to terminate. In a non-modal environment (for example, in a web browser), the application code is required to perform initialization and then register callbacks for a single main loop tick and the application shutdown. Finally, the application code must return control to the environment, which then runs the application by invoking the callbacks and terminates at its own discretion.

When a method of this class returns this pseudo-error, the calling code is expected to return control to the environment promptly, so that the application may start running. The called method will have registered callbacks with the environment, to ensure the following behaviour:

Public / Methods

This

6 overloads


public static method This1 → (6)

thing in : object own

[not-null]
The thing to run.

source opt : string = null

The error source to use as window title and in case an exception is thrown.

shaders opt : Path = null

Optional value to use for IGraphicsContextFactory.ShaderRepository.

settings opt : Path = null

Optional value to set to IWidget.SettingsPath.

width opt : int32 = 1280

The initial window width, see IApplicationWindow.Resize.

height opt : int32 = 800

The initial window height, see IApplicationWindow.Resize.

returns → TinmanError

The error in case of a crash, null if the application has ended normally, or NonModal if the application is running in non-modal mode.

Runs the given thing in with the default settings, for debugging and testing.

This method calls Widget.Create, IWidget.Initialize and then IWidget.ToApplication, to obtain the application object to run.


public static method This2 → (5)

widget in : IWidget own

[not-null]
The widget to run.

source opt : string = null

The error source to use as window title and in case an exception is thrown.

shaders opt : Path = null

Optional value to use for IGraphicsContextFactory.ShaderRepository.

width opt : int32 = 1280

The initial window width, see IApplicationWindow.Resize.

height opt : int32 = 800

The initial window height, see IApplicationWindow.Resize.

returns → TinmanError

The error in case of a crash, null if the application has ended normally, or NonModal if the application is running in non-modal mode.

Runs the given widget in with the default settings, for debugging and testing.

This method calls IWidget.Initialize and then IWidget.ToApplication, to obtain the application object to run.


public static method This3 → (5)

application in : IApplication own

[not-null]
The application to run.

source opt : string = null

The error source to use as window title and in case an exception is thrown.

shaders opt : Path = null

Optional value to use for IGraphicsContextFactory.ShaderRepository.

width opt : int32 = 1280

The initial window width, see IApplicationWindow.Resize.

height opt : int32 = 800

The initial window height, see IApplicationWindow.Resize.

returns → TinmanError

The error in case of a crash, null if the application has ended normally, or NonModal if the application is running in non-modal mode.

Runs the given application in with the default settings, for debugging and testing.

If applicable, this method will provide an EventDelegateGeneric to ApplicationWindow.Create that calls the following method, for interoperability with .NET WinForms:

System.Windows.Forms.Application.DoEvents()

public static method This4 → (5)

application in : IApplication own

[not-null]
The application to run.

source in : string

[not-empty]
The error source to use in case an exception is thrown.

context in : IGraphicsContextFactory

[not-null]
The graphics context factory to use.

window in : IApplicationWindow own

[not-null]
The application window to use.

sleepOnIdle opt : bool = true

Honour ApplicationLoopResult.Idle by sleeping for a short time?

returns → TinmanError

The error in case of a crash, null if the application has ended normally, or NonModal if the application is running in non-modal mode.

Runs the given application in.


public static method This5 → (6)

application in : IApplication own

[not-null]
The application to run.

source in : string

[not-empty]
The error source to use in case an exception is thrown.

contexts in : IVectorConst<IGraphicsContextFactory>

[not-empty]
The graphics context factories to use.

window in : IApplicationWindow own

[not-null]
The application window to use.

sleepOnIdle in : bool

Honour ApplicationLoopResult.Idle by sleeping for a short time?

context opt : int32 = -1

[-1..contexts.Count-1]
Index of initial graphics context factory in contexts in. If -1, the first suitable factory will be chosen automatically.

returns → TinmanError

The error in case of a crash, null if the application has ended normally, or NonModal if the application is running in non-modal mode.

Runs the given application in.


public static method This6 → (3)

application in : ApplicationLoop own

[not-null]
The application loop to run.

source in : string

[not-empty]
The error source to use in case an exception is thrown.

sleepOnIdle opt : bool = true

Honour ApplicationLoopResult.Idle by sleeping for a short time?

returns → TinmanError

The error in case of a crash, null if the application has ended normally, or NonModal if the application is running in non-modal mode.

Runs the given application in.