Interface IRunnable<TResult>
Defines a view that can be run as an independent blocking session with Run(IRunnable, Func<Exception, bool>?), returning a typed result.
public interface IRunnable<TResult> : IRunnable
Type Parameters
TResultThe type of result data returned when the session completes. Common types: int for button indices, string for file paths, custom types for complex form data.
- Inherited Members
Remarks
A runnable view executes as a self-contained blocking session with its own lifecycle, event loop iteration, and focus management. Run(IRunnable, Func<Exception, bool>?) blocks until RequestStop() is called.
When Result is null, the session was stopped without being accepted (e.g., ESC key pressed, window closed). When non-null, it contains the result data extracted in RaiseIsRunningChanging(bool, bool) (when stopping) before views are disposed.
Implementing IRunnable<TResult> does not require deriving from any specific base class or using Overlapped. These are orthogonal concerns.
This interface follows the Terminal.Gui Cancellable Work Pattern (CWP) for all lifecycle events.
Properties
- Result
Gets or sets the result data extracted when the session was accepted, or null if not accepted.