Interface IApplication
Interface for instances that provide backing functionality to static gateway class Application.
public interface IApplication : IDisposable
- Inherited Members
- Extension Methods
Remarks
Implements IDisposable to support automatic resource cleanup via using statements. Call Dispose() or use a using statement to properly clean up resources.
Properties
- ClearScreenNextIteration
Gets or sets whether the screen will be cleared, and all Views redrawn, during the next Application iteration.
- Clipboard
Gets the clipboard for this application instance.
- Driver
Gets or sets the console driver being used.
- 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.
- Initialized
Gets or sets whether the application has been initialized.
- Keyboard
Handles keyboard input and key bindings at the Application level.
- MainThreadId
Gets or sets the managed thread ID of the application's main UI thread, which is set during Init(string?) and used to determine if code is executing on the main thread.
- Mouse
Handles mouse event state and processing.
- Navigation
Gets or sets the navigation manager.
- Popover
Gets or sets the popover manager.
- 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 runnable session tokens. Sessions execute serially - the top of stack is the currently modal session.
- 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 the Runnable that is on the top of the SessionStack.
- TopRunnableView
Gets the View 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 SessionToken and prepares the provided IRunnable for execution. Not usually called directly by applications. Use Run(IRunnable, Func<Exception, bool>?) instead.
- End(SessionToken)
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.
- GetResult()
Gets the result from the last Run(IRunnable, Func<Exception, bool>?) or Run<TRunnable>(Func<Exception, bool>?, string?) call.
- GetResult<T>()
Gets the result from the last Run(IRunnable, Func<Exception, bool>?) or Run<TRunnable>(Func<Exception, bool>?, string?) call, cast to type
T.
- Init(string?)
Initializes a new instance of Terminal.Gui Application.
- Invoke(Action)
Runs
actionon the main UI loop thread.
- Invoke(Action<IApplication>?)
Runs
actionon the main UI loop thread.
- LayoutAndDraw(bool)
Causes any Runnables that need layout to be laid out, then draws any Runnables 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.
- Run(IRunnable, Func<Exception, bool>?)
Runs a new Session with the provided runnable view.
- Run<TRunnable>(Func<Exception, bool>?, string?)
Runs a new Session creating a IRunnable-derived object of type
TRunnableand calling Run(IRunnable, Func<Exception, bool>?). When the session is stopped, End(SessionToken) will be called.
- ToString()
Gets a string representation of the Application as rendered by Driver.
Events
- InitializedChanged
This event is raised after the Init(string?) and Dispose() 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(IRunnable) 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 IRunnable that was active during the session. This can be used to ensure the Runnable is disposed of properly.