Move common things to AppCore from GuiApp

This commit is contained in:
2023-08-07 12:06:34 +02:00
parent 3d0eda54fb
commit 936c3896b9
48 changed files with 427 additions and 187 deletions

View File

@@ -0,0 +1,18 @@
using Avalonia.Input;
using FileTime.App.Core.Models;
using FileTime.App.Core.Services;
namespace FileTime.GuiApp.App.Extensions;
public static class KeyEventArgsExtension
{
public static GeneralKeyEventArgs? ToGeneralKeyEventArgs(this KeyEventArgs args, IAppKeyService<Key> appKeyService)
{
var maybeKey = appKeyService.MapKey(args.Key);
if (maybeKey is not {} key1) return null;
return new GeneralKeyEventArgs(h => args.Handled = h)
{
Key = key1
};
}
}