Move common things to AppCore from GuiApp 3
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
public class GeneralKeyEventArgs
|
||||
{
|
||||
private readonly Action<bool> _handledChanged;
|
||||
private readonly Action<bool>? _handledChanged;
|
||||
private bool _handled;
|
||||
public required Keys Key { get; init; }
|
||||
|
||||
@@ -14,12 +14,12 @@ public class GeneralKeyEventArgs
|
||||
if (_handled != value)
|
||||
{
|
||||
_handled = value;
|
||||
_handledChanged(value);
|
||||
_handledChanged?.Invoke(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GeneralKeyEventArgs(Action<bool> handledChanged)
|
||||
public GeneralKeyEventArgs(Action<bool>? handledChanged = null)
|
||||
{
|
||||
_handledChanged = handledChanged;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace FileTime.App.Core.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace FileTime.App.Core.Models;
|
||||
|
||||
public enum Keys
|
||||
{
|
||||
@@ -46,7 +48,7 @@ public enum Keys
|
||||
Right,
|
||||
Enter,
|
||||
Escape,
|
||||
Back,
|
||||
Backspace,
|
||||
Space,
|
||||
PageUp,
|
||||
PageDown,
|
||||
@@ -55,14 +57,24 @@ public enum Keys
|
||||
Tab,
|
||||
LWin,
|
||||
RWin,
|
||||
[Description("0")]
|
||||
Num0,
|
||||
[Description("1")]
|
||||
Num1,
|
||||
[Description("2")]
|
||||
Num2,
|
||||
[Description("3")]
|
||||
Num3,
|
||||
[Description("4")]
|
||||
Num4,
|
||||
[Description("5")]
|
||||
Num5,
|
||||
[Description("6")]
|
||||
Num6,
|
||||
[Description("7")]
|
||||
Num7,
|
||||
[Description("8")]
|
||||
Num8,
|
||||
[Description("9")]
|
||||
Num9,
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace FileTime.App.Core.Models;
|
||||
|
||||
public record SpecialKeysStatus(bool IsAltPressed, bool IsShiftPressed, bool IsCtrlPressed);
|
||||
public record struct SpecialKeysStatus(bool IsAltPressed, bool IsShiftPressed, bool IsCtrlPressed);
|
||||
@@ -4,5 +4,5 @@ namespace FileTime.App.Core.Services;
|
||||
|
||||
public interface IKeyInputHandler
|
||||
{
|
||||
Task HandleInputKey(Keys key, SpecialKeysStatus specialKeysStatus, Action<bool> setHandled);
|
||||
Task HandleInputKey(GeneralKeyEventArgs e, SpecialKeysStatus specialKeysStatus);
|
||||
}
|
||||
Reference in New Issue
Block a user