ConsoleForge 0.3.0
Elm-architecture TUI framework for .NET 8
Loading...
Searching...
No Matches
ConsoleForge.Core.App Class Referencesealed

Main event loop for a ConsoleForge application. More...

Public Member Functions

void SetTheme (Theme theme)
 Update the active theme at runtime. Forces a re-render.

Static Public Member Functions

static Task Run (IModel model, ITerminal? terminal=null, Theme? theme=null, int targetFps=30, bool enableMouse=false)
 Run the application asynchronously.

Properties

ColorProfile ColorProfile [get]
 Detected color capability of the current terminal.

Detailed Description

Main event loop for a ConsoleForge application.

Call Run to start the application. The method blocks until the model issues QuitMsg or the user force-quits. The terminal is guaranteed to be restored (raw mode exited, alternate screen exited) even if an unhandled exception occurs.

Member Function Documentation

◆ Run()

Task ConsoleForge.Core.App.Run ( IModel model,
ITerminal? terminal = null,
Theme? theme = null,
int targetFps = 30,
bool enableMouse = false )
static

Run the application asynchronously.

Returns when the model produces a QuitMsg.

Parameters
modelInitial model. Init() is called before the loop starts.
terminalOptional terminal override. If null, a new AnsiTerminal is created. Pass a ConsoleForge.Testing.VirtualTerminal for testing.
themeTheme to use. Defaults to Theme.Default.
targetFpsTarget frames per second (1–60). Default 30.

The documentation for this class was generated from the following file:
  • src/ConsoleForge/Core/App.cs