Class Application
A static, singleton class representing the application. This class is the entry point for the application.
public static class Application
- Inheritance
-
Application
- Inherited Members
Examples
Application.Init();
var win = new Window()
{
Title = $"Example App ({Application.QuitKey} to quit)"
};
Application.Run(win);
win.Dispose();
Application.Shutdown();
Fields
- 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.
Properties
- ArrangeKey
Gets or sets the key to activate arranging views using the keyboard.
- ClearScreenNextIteration
Gets or sets whether the screen will be cleared, and all Views redrawn, during the next Application iteration.
- Driver
Gets the IConsoleDriver that has been selected. See also ForceDriver.
- EndAfterFirstIteration
Set to true to cause End(RunState) to be called after the first iteration. Set to false (the default) to cause the application to continue running until Application.RequestStop () is called.
- 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 IConsoleDriver supports TrueColor.
- ForceDriver
Forces the use of the specified driver (one of "fake", "ansi", "curses", "net", or "windows"). If not specified, the driver is selected based on the platform.
- Initialized
Gets whether the application has been initialized with Init(IConsoleDriver?, string?) and not yet shutdown with Shutdown().
- IsMouseDisabled
Disable or enable the mouse. The mouse is enabled by default.
- KeyBindings
Gets the Application-scoped key bindings.
- MouseGrabView
Gets the view that grabbed the mouse (e.g. for dragging). When this is set, all mouse events will be routed to this view until the view calls UngrabMouse() or the mouse is released.
- Navigation
Gets the ApplicationNavigation instance for the current Application.
- NextTabGroupKey
Alternative key to navigate forwards through views. Ctrl+Tab is the primary key.
- NextTabKey
Alternative key to navigate forwards through views. Ctrl+Tab is the primary key.
- PrevTabGroupKey
Alternative key to navigate backwards through views. Shift+Ctrl+Tab is the primary key.
- PrevTabKey
Alternative key to navigate backwards through views. Shift+Ctrl+Tab is the primary key.
- QuitKey
Gets or sets the key to quit the application.
- Screen
Gets or sets the size of the screen. By default, this is the size of the screen as reported by the IConsoleDriver.
- SupportedCultures
Gets all cultures supported by the application without the invariant language.
- WantContinuousButtonPressedView
The current View object that wants continuous mouse button pressed events.
Methods
- AddTimeout(TimeSpan, Func<bool>)
Adds a timeout to the application.
- Begin(Toplevel)
Building block API: Prepares the provided Toplevel for execution.
- End(RunState)
Building block API: completes the execution of a Toplevel that was started with Begin(Toplevel) .
- GetDriverTypes()
Gets of list of IConsoleDriver types that are available.
- GetLastMousePosition()
Gets the most recent position of the mouse.
- GrabMouse(View?)
Grabs the mouse, forcing all mouse events to be routed to the specified view until UngrabMouse() is called.
- Init(IConsoleDriver?, string?)
Initializes a new instance of Terminal.Gui Application.
- Invoke(Action)
Runs
action
on the thread that is processing events
- 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.
- OnSizeChanging(SizeChangedEventArgs)
Called when the application's size changes. Sets the size of all Toplevels and fires the SizeChanging event.
- RaiseKeyDownEvent(Key)
Called when the user presses a key (by the IConsoleDriver). Raises the cancelable KeyDown event, then calls NewKeyDownEvent(Key) on all top level views, and finally if the key was not handled, invokes any Application-scoped KeyBindings.
- RaiseKeyUpEvent(Key)
Called when the user releases a key (by the IConsoleDriver). Raises the cancelable KeyUp event then calls NewKeyUpEvent(Key) on all top level views. Called after RaiseKeyDownEvent(Key).
- RemoveTimeout(object)
Removes a previously scheduled timeout
- RequestStop(Toplevel?)
Stops the provided Toplevel, causing or the
top
if provided.
- Run(Func<Exception, bool>?, IConsoleDriver?)
Runs the application by creating a Toplevel object and calling Run(Toplevel, Func<Exception, bool>?).
- Run(Toplevel, Func<Exception, bool>?)
Runs the Application using the provided Toplevel view.
- RunIteration(ref RunState, bool)
Run one application iteration.
- RunLoop(RunState)
Building block API: Runs the main loop for the created Toplevel.
- Run<T>(Func<Exception, bool>?, IConsoleDriver?)
Runs the application by creating a Toplevel-derived object of type
T
and calling Run(Toplevel, Func<Exception, bool>?).
- Shutdown()
Shutdown an application initialized with Init(IConsoleDriver?, string?).
- ToString()
Gets a string representation of the Application as rendered by Driver.
- ToString(IConsoleDriver?)
Gets a string representation of the Application rendered by the provided IConsoleDriver.
- UngrabMouse()
Releases the mouse grab, so mouse events will be routed to the view on which the mouse is.
- Wakeup()
Wakes up the running application that might be waiting on input.
Events
- GrabbedMouse
Invoked after a view has grabbed the mouse.
- GrabbingMouse
Invoked when a view wants to grab the mouse; can be canceled.
- InitializedChanged
This event is raised after the Init(IConsoleDriver?, string?) and Shutdown() methods have been called.
- Iteration
This event is raised on each iteration of the main loop.
- KeyDown
Raised when the user presses a key.
Set Handled to true to indicate the key was handled and to prevent additional processing.
- KeyUp
Raised when the user releases a key.
Set Handled to true to indicate the key was handled and to prevent additional processing.
- MouseEvent
Raised when a mouse event occurs. Can be cancelled by setting MouseEventArgs.Handled to true.
- NotifyNewRunState
Notify that a new RunState was created (Begin(Toplevel) was called). The token is created in Begin(Toplevel) and this event will be fired before that function exits.
- NotifyStopRunState
Notify that an existent RunState is stopping (End(RunState) was called).
- SizeChanging
Invoked when the terminal's size changed. The new size of the terminal is provided.
- UnGrabbedMouse
Invoked after a view has un-grabbed the mouse.
- UnGrabbingMouse
Invoked when a view wants un-grab the mouse; can be canceled.