Class ApplicationMainLoop<T>
The main application loop that runs Terminal.Gui's UI rendering and event processing.
public class ApplicationMainLoop<T> : IApplicationMainLoop<T>, IDisposable
Type Parameters
T
Type of raw input events, e.g. ConsoleKeyInfo for .NET driver
- Inheritance
-
ApplicationMainLoop<T>
- Implements
- Inherited Members
Remarks
This class coordinates the Terminal.Gui application lifecycle by:
- Processing buffered input events and translating them to UI events
- Executing user timeout callbacks at scheduled intervals
- Detecting which views need redrawing or layout updates
- Rendering UI changes to the console output buffer
- Managing cursor position and visibility
- Throttling iterations to respect MaximumIterationsPerSecond
Fields
- ToplevelTransitionManager
Handles raising events and setting required draw status etc when Top changes
Properties
- AnsiRequestScheduler
Gets the class responsible for sending ANSI escape requests which expect a response from the remote terminal e.g. Device Attribute Request
- InputBuffer
The input events thread-safe collection. This is populated on separate thread by a IConsoleInput<T>. Is drained as part of each Iteration()
- InputProcessor
Gets the class responsible for processing buffered console input and translating it into events on the UI thread.
- Now
Determines how to get the current system type, adjust in unit tests to simulate specific timings.
- Out
Class for writing output to the console.
- OutputBuffer
Gets the class responsible for writing final rendered output to the console
- TimedEvents
Gets the class responsible for servicing user timeouts
- WindowSizeMonitor
Gets the class responsible for determining the current console size
Methods
- Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- Initialize(ITimedEvents, ConcurrentQueue<T>, IInputProcessor, IConsoleOutput, IComponentFactory<T>)
Initializes the class with the provided subcomponents
- Iteration()
Perform a single iteration of the main loop then blocks for a fixed length of time, this method is designed to be run in a loop.