Table of Contents

Interface IApplication

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

Interface for instances that provide backing functionality to static gateway class Application.

public interface IApplication
Extension Methods

Properties

CachedSessionTokenToplevel

Caches the Toplevel associated with the current Session.

ClearScreenNextIteration

Gets or sets whether the screen will be cleared, and all Views redrawn, during the next Application iteration.

Driver

Gets or sets the console driver being used.

Force16Colors

Gets or sets whether Driver will be forced to output only the 16 colors defined in ColorName16. The default is false, meaning 24-bit (TrueColor) colors will be output as long as the selected IDriver supports TrueColor.

ForceDriver

Forces the use of the specified driver (one of "fake", "dotnet", "windows", or "unix"). If not specified, the driver is selected based on the platform.

FrameworkOwnedRunnable

Gets or sets the runnable that was created by Run<TRunnable>(Func<Exception, bool>?) for automatic disposal.

Initialized

Gets or sets whether the application has been initialized.

Keyboard

Handles keyboard input and key bindings at the Application level.

Mouse

Handles mouse event state and processing.

Navigation

Gets or sets the navigation manager.

Popover

Gets or sets the popover manager.

RunnableSessionStack

Gets the stack of all active runnable session tokens. Sessions execute serially - the top of stack is the currently modal session.

Screen

Gets or sets the size of the screen. By default, this is the size of the screen as reported by the IDriver.

SessionStack

Gets the stack of all active Toplevel sessions.

Sixel

Collection of sixel images to write out to screen when updating. Only add to this collection if you are sure terminal supports sixel format.

StopAfterFirstIteration

Set to true to cause the session to stop running after first iteration.

TimedEvents

Handles recurring events. These are invoked on the main UI thread - allowing for safe updates to View instances.

TopRunnable

Gets or sets the Toplevel that is on the top of the SessionStack.

Methods

AddTimeout(TimeSpan, Func<bool>)

Adds a timeout to the application.

Begin(IRunnable)

Building block API: Creates a RunnableSessionToken and prepares the provided IRunnable for execution. Not usually called directly by applications. Use Run(IRunnable, Func<Exception, bool>?) instead.

Begin(Toplevel)

Building block API: Creates a SessionToken and prepares the provided Toplevel for execution. Not usually called directly by applications. Use Run(Toplevel, Func<Exception, bool>?) instead.

End(RunnableSessionToken)

Building block API: Ends the session associated with the token and completes the execution of an IRunnable. Not usually called directly by applications. Run(IRunnable, Func<Exception, bool>?) will automatically call this method when the session is stopped.

End(SessionToken)

Building block API: Ends a Session and completes the execution of a Toplevel that was started with Begin(Toplevel). Not usually called directly by applications. Run(Toplevel, Func<Exception, bool>?) will automatically call this method when the session is stopped.

Init(string?)

Initializes a new instance of Terminal.Gui Application.

Invoke(Action)

Runs action on the main UI loop thread.

Invoke(Action<IApplication>?)

Runs action on the main UI loop thread.

LayoutAndDraw(bool)

Causes any Toplevels that need layout to be laid out, then draws any Toplevels that need display. Only Views that need to be laid out (see NeedsLayout) will be laid out. Only Views that need to be drawn (see NeedsDraw) will be drawn.

PositionCursor()

Calls PositionCursor() on the most focused view.

RaiseIteration()

Raises the Iteration event.

RemoveTimeout(object)

Removes a previously scheduled timeout.

RequestStop()

Requests that the currently running Session stop. The Session will stop after the current iteration completes.

RequestStop(IRunnable?)

Requests that the specified runnable session stop.

RequestStop(Toplevel?)

Requests that the currently running Session stop. The Session will stop after the current iteration completes.

ResetState(bool)

Resets the state of this instance.

Run(Func<Exception, bool>?, string?)

Runs a new Session creating a Toplevel and calling Begin(Toplevel). When the session is stopped, End(SessionToken) will be called.

Run(IRunnable, Func<Exception, bool>?)

Runs a new Session with the provided runnable view.

Run(Toplevel, Func<Exception, bool>?)

Runs a new Session using the provided Toplevel view and calling Run(Toplevel, Func<Exception, bool>?). When the session is stopped, End(SessionToken) will be called..

Run<TRunnable>(Func<Exception, bool>?)

Creates and runs a new session with a TRunnable of the specified type.

Run<TView>(Func<Exception, bool>?, string?)

Runs a new Session creating a Toplevel-derived object of type TView and calling Run(Toplevel, Func<Exception, bool>?). When the session is stopped, End(SessionToken) will be called.

Shutdown()

Shutdown an application initialized with Init(string?).

ToString()

Gets a string representation of the Application as rendered by Driver.

Events

InitializedChanged

This event is raised after the Init(string?) and Shutdown() methods have been called.

Iteration

This event is raised on each iteration of the main loop.

ScreenChanged

Raised when the terminal's size changed. The new size of the terminal is provided.

SessionBegun

Raised when Begin(Toplevel) has been called and has created a new SessionToken.

SessionEnded

Raised when End(SessionToken) was called and the session is stopping. The event args contain a reference to the Toplevel that was active during the session. This can be used to ensure the Toplevel is disposed of properly.