Files
FileTime2/src/ConsoleApp/FileTime.ConsoleUI.App/Extensions/KeyEventArgsExtensions.cs
2023-08-07 14:55:18 +02:00

18 lines
499 B
C#

using FileTime.App.Core.Models;
using FileTime.App.Core.Services;
using Terminal.Gui;
namespace FileTime.ConsoleUI.App.Extensions;
public static class KeyEventArgsExtensions
{
public static GeneralKeyEventArgs? ToGeneralKeyEventArgs(this KeyEvent args, IAppKeyService<Key> appKeyService)
{
var maybeKey = appKeyService.MapKey(args.Key);
if (maybeKey is not { } key1) return null;
return new GeneralKeyEventArgs
{
Key = key1
};
}
}