Custom TUI Library WIP

This commit is contained in:
2023-08-08 00:27:42 +02:00
parent 7807a82f3f
commit a77d5cc235
22 changed files with 334 additions and 282 deletions

View File

@@ -1,8 +1,5 @@
using FileTime.App.Core.Services;
using FileTime.ConsoleUI.App.Extensions;
using FileTime.ConsoleUI.App.KeyInputHandling;
using FileTime.Core.Models;
using Terminal.Gui;
namespace FileTime.ConsoleUI.App;
@@ -10,7 +7,7 @@ public class App : IApplication
{
private readonly ILifecycleService _lifecycleService;
private readonly IConsoleAppState _consoleAppState;
private readonly IAppKeyService<Key> _appKeyService;
//private readonly IAppKeyService<Key> _appKeyService;
private readonly MainWindow _mainWindow;
private readonly IKeyInputHandlerService _keyInputHandlerService;
@@ -18,13 +15,13 @@ public class App : IApplication
ILifecycleService lifecycleService,
IKeyInputHandlerService keyInputHandlerService,
IConsoleAppState consoleAppState,
IAppKeyService<Key> appKeyService,
//IAppKeyService<Key> appKeyService,
MainWindow mainWindow)
{
_lifecycleService = lifecycleService;
_keyInputHandlerService = keyInputHandlerService;
_consoleAppState = consoleAppState;
_appKeyService = appKeyService;
//_appKeyService = appKeyService;
_mainWindow = mainWindow;
}
@@ -34,24 +31,5 @@ public class App : IApplication
Task.Run(async () => await _lifecycleService.InitStartupHandlersAsync()).Wait();
_mainWindow.Initialize();
Application.Init();
var asd = Application.Top.ColorScheme;
foreach (var element in _mainWindow.GetElements())
{
Application.Top.Add(element);
}
Application.RootKeyEvent += e =>
{
if (e.ToGeneralKeyEventArgs(_appKeyService) is not { } args) return false;
_keyInputHandlerService.HandleKeyInput(args);
return args.Handled;
};
Application.Run();
Application.Shutdown();
}
}