NeoKolors.Tui.Lifecycle.Apps
2026.4.0-preview.2
dotnet add package NeoKolors.Tui.Lifecycle.Apps --version 2026.4.0-preview.2
NuGet\Install-Package NeoKolors.Tui.Lifecycle.Apps -Version 2026.4.0-preview.2
<PackageReference Include="NeoKolors.Tui.Lifecycle.Apps" Version="2026.4.0-preview.2" />
<PackageVersion Include="NeoKolors.Tui.Lifecycle.Apps" Version="2026.4.0-preview.2" />
<PackageReference Include="NeoKolors.Tui.Lifecycle.Apps" />
paket add NeoKolors.Tui.Lifecycle.Apps --version 2026.4.0-preview.2
#r "nuget: NeoKolors.Tui.Lifecycle.Apps, 2026.4.0-preview.2"
#:package NeoKolors.Tui.Lifecycle.Apps@2026.4.0-preview.2
#addin nuget:?package=NeoKolors.Tui.Lifecycle.Apps&version=2026.4.0-preview.2&prerelease
#tool nuget:?package=NeoKolors.Tui.Lifecycle.Apps&version=2026.4.0-preview.2&prerelease
NeoKolors.Tui.Lifecycle.Apps
NeoKolors.Tui.Lifecycle.Apps provides the application hosting infrastructure, execution loop strategies, window focus management, and view binding for interactive TUI applications.
Key Components
1. Application Host (AppLifecycleHost)
AppLifecycleHost coordinates application states:
- Activation State:
AppActivationState(ACTIVE,INACTIVE,SUSPENDED). - Focus Management: Automatically manages whether the terminal has OS window focus (
HasFocus). - Terminal Resizing: Responds to terminal resize events (
NotifyWindowResized(width, height)). - Graceful Termination: Handles close requests (
RequestClose(),CloseRequestedevent with cancellation option).
using NeoKolors.Tui.Lifecycle.Apps;
var host = new AppLifecycleHost();
host.CloseRequested += (sender, e) => {
if (HasUnsavedChanges()) {
e.Cancel = true; // Prevent shutdown
ShowUnsavedDialog();
}
};
host.Start();
2. View Presenter (NKAppView)
NKAppView connects a root IElement layout tree to an ICharScreen and HitMap:
- Manages dirty tracking (
Invalidate(),IsDirty,ResetDirty()). - Fires lifecycle events:
BeforeRender,Render,AfterRender. - Replaces or updates the active UI hierarchy seamlessly (
view.RootElement = BuildUi()).
using NeoKolors.Tui.Lifecycle.Apps;
var view = new NKAppView(rootElement, screen, hitMap);
// Trigger re-render whenever state changes
stateSignal.Changed += () => {
view.RootElement = BuildUpdatedUi();
view.Invalidate();
};
3. Rendering Loop Strategies (IAppLoopStrategy)
ThrottledAppLoopStrategy
Maintains high frame rates when the application is focused, and throttles down when the application loses focus:
ActiveFps: Target FPS when focused (e.g. 60 FPS).BackgroundFps: Target FPS when inactive (e.g. 10 FPS) to drastically reduce CPU usage.RenderOnlyWhenDirty: Only renders frames ifview.IsDirtyis true.SignalWakeup(): Thread-safe signal to immediately awaken the loop from sleeping on user interaction.
var loopStrategy = new ThrottledAppLoopStrategy {
ActiveFps = 60,
BackgroundFps = 10,
RenderOnlyWhenDirty = true
};
while (host.State != LifecycleState.STOPPED) {
loopStrategy.Tick(host, view);
}
LazyAppLoopStrategy
Designed for classic terminal utilities:
- Remains completely asleep until an input event, resize notification, or wakeup signal is dispatched.
- Uses 0% CPU while idle.
Complete Boilerplate Example
See Examples/ExampleApp.cs for a complete production-grade application loop using AppLifecycleHost, NKAppView, and ThrottledAppLoopStrategy.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- NeoKolors.Common (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Core (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Elements (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Lifecycle.Core (>= 2026.4.0-preview.2)
-
net10.0
- NeoKolors.Common (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Core (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Elements (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Lifecycle.Core (>= 2026.4.0-preview.2)
-
net11.0
- NeoKolors.Common (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Core (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Elements (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Lifecycle.Core (>= 2026.4.0-preview.2)
-
net5.0
- NeoKolors.Common (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Core (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Elements (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Lifecycle.Core (>= 2026.4.0-preview.2)
-
net8.0
- NeoKolors.Common (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Core (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Elements (>= 2026.4.0-preview.2)
- NeoKolors.Tui.Lifecycle.Core (>= 2026.4.0-preview.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.4.0-preview.2 | 0 | 10/30/2026 |
| 2026.4.0-preview.1 | 55 | 10/23/2026 |