Table of Contents

Method Init

Namespace
Terminal.Gui.App
Assembly
Terminal.Gui.dll

Init(string?)

Initializes a new instance of Terminal.Gui Application.

[RequiresUnreferencedCode("AOT")]
[RequiresDynamicCode("AOT")]
public IApplication Init(string? driverName = null)

Parameters

driverName string

The short name (e.g. "dotnet", "windows", "unix", or "fake") of the IDriver to use. If not specified the default driver for the platform will be used.

Returns

IApplication

This instance for fluent API chaining.

Remarks

Call this method once per instance (or after Shutdown() has been called).

This function loads the right IDriver for the platform, creates a main loop coordinator, initializes keyboard and mouse handlers, and subscribes to driver events.

Shutdown() must be called when the application is closing (typically after Run<TRunnable>(Func<Exception, bool>?) has returned) to ensure resources are cleaned up and terminal settings restored.

The Run<TRunnable>(Func<Exception, bool>?) function combines Init(string?) and Run(Toplevel, Func<Exception, bool>?) into a single call. An application can use Run<TRunnable>(Func<Exception, bool>?) without explicitly calling Init(string?).

Supports fluent API: Application.Create().Init().Run<MyView>().Shutdown()