Interface IRunnable
Non-generic base interface for runnable views. Provides common members without type parameter.
public interface IRunnable
Remarks
This interface enables storing heterogeneous runnables in collections (e.g., SessionStack) while preserving type safety at usage sites via IRunnable<TResult>.
Most code should use IRunnable<TResult> directly. This base interface is primarily for framework infrastructure (session management, stacking, etc.).
A runnable view executes as a self-contained blocking session with its own lifecycle, event loop iteration, and focus management./> blocks until RequestStop() is called.
This interface follows the Terminal.Gui Cancellable Work Pattern (CWP) for all lifecycle events.
Properties
- IsModal
Gets whether this runnable session is at the top of the SessionStack and thus exclusively receiving mouse and keyboard input.
- IsRunning
Gets whether this runnable session is currently running (i.e., on the SessionStack).
- Result
Gets or sets the result data extracted when the session was accepted, or null if not accepted.
- StopRequested
Gets or sets whether a stop has been requested for this runnable session.
Methods
- RaiseIsModalChangedEvent(bool)
Called by the framework to raise the IsModalChanged event.
- RaiseIsRunningChangedEvent(bool)
Called by the framework to raise the IsRunningChanged event.
- RaiseIsRunningChanging(bool, bool)
Called by the framework to raise the IsRunningChanging event.
- RequestStop()
Requests that this runnable session stop.
- SetApp(IApplication)
Sets the application context for this runnable. Called from Begin(IRunnable).
- SetIsModal(bool)
Sets the cached IsModal state. Called by ApplicationImpl within the session stack lock. This method is internal to the framework and should not be called by application code.
- SetIsRunning(bool)
Sets the cached IsRunning state. Called by ApplicationImpl within the session stack lock. This method is internal to the framework and should not be called by application code.
Events
- IsModalChanged
Raised after this runnable has become modal (top of stack) or ceased being modal.
- IsRunningChanged
Raised after IsRunning has changed (after the runnable has been added to or removed from the SessionStack).
- IsRunningChanging
Raised when IsRunning is changing (e.g., when Begin(IRunnable) or End(SessionToken) is called). Can be canceled by setting
args.Cancelto true.