diff --git a/src/AppCommon/FileTime.App.CommandPalette.Abstractions/FileTime.App.CommandPalette.Abstractions.csproj b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/FileTime.App.CommandPalette.Abstractions.csproj
index 0421053..3561c71 100644
--- a/src/AppCommon/FileTime.App.CommandPalette.Abstractions/FileTime.App.CommandPalette.Abstractions.csproj
+++ b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/FileTime.App.CommandPalette.Abstractions.csproj
@@ -12,8 +12,4 @@
-
-
-
-
diff --git a/src/AppCommon/FileTime.App.CommandPalette.Abstractions/ViewModels/ICommandPaletteViewModel.cs b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/ViewModels/ICommandPaletteViewModel.cs
index 8b03d67..79992b1 100644
--- a/src/AppCommon/FileTime.App.CommandPalette.Abstractions/ViewModels/ICommandPaletteViewModel.cs
+++ b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/ViewModels/ICommandPaletteViewModel.cs
@@ -1,4 +1,4 @@
-using Avalonia.Input;
+using FileTime.App.Core.Models;
using FileTime.App.Core.ViewModels;
using FileTime.App.FuzzyPanel;
@@ -8,5 +8,5 @@ public interface ICommandPaletteViewModel : IFuzzyPanelViewModel ShowWindow { get; }
void Close();
- Task HandleKeyUp(KeyEventArgs keyEventArgs);
+ Task HandleKeyUp(GeneralKeyEventArgs keyEventArgs);
}
\ No newline at end of file
diff --git a/src/AppCommon/FileTime.App.CommandPalette/FileTime.App.CommandPalette.csproj b/src/AppCommon/FileTime.App.CommandPalette/FileTime.App.CommandPalette.csproj
index dde31c9..f439ade 100644
--- a/src/AppCommon/FileTime.App.CommandPalette/FileTime.App.CommandPalette.csproj
+++ b/src/AppCommon/FileTime.App.CommandPalette/FileTime.App.CommandPalette.csproj
@@ -7,7 +7,6 @@
-
diff --git a/src/AppCommon/FileTime.App.CommandPalette/ViewModels/CommandPaletteViewModel.cs b/src/AppCommon/FileTime.App.CommandPalette/ViewModels/CommandPaletteViewModel.cs
index 776a9ab..aa9820b 100644
--- a/src/AppCommon/FileTime.App.CommandPalette/ViewModels/CommandPaletteViewModel.cs
+++ b/src/AppCommon/FileTime.App.CommandPalette/ViewModels/CommandPaletteViewModel.cs
@@ -1,11 +1,10 @@
using System.Text;
-using Avalonia.Input;
using FileTime.App.CommandPalette.Services;
+using FileTime.App.Core.Configuration;
+using FileTime.App.Core.Models;
using FileTime.App.Core.Services;
using FileTime.App.Core.ViewModels;
using FileTime.App.FuzzyPanel;
-using FileTime.GuiApp.App.Configuration;
-using FileTime.GuiApp.App.Services;
using Microsoft.Extensions.Logging;
namespace FileTime.App.CommandPalette.ViewModels;
@@ -89,7 +88,7 @@ public class CommandPaletteViewModel : FuzzyPanelViewModel k.Keys)
.ToList();
- public override async Task HandleKeyDown(KeyEventArgs keyEventArgs)
+ public override async Task HandleKeyDown(GeneralKeyEventArgs keyEventArgs)
{
if (keyEventArgs.Handled) return false;
@@ -99,7 +98,7 @@ public class CommandPaletteViewModel : FuzzyPanelViewModel HandleKeyUp(KeyEventArgs keyEventArgs)
+ public async Task HandleKeyUp(GeneralKeyEventArgs keyEventArgs)
{
if (keyEventArgs.Handled) return false;
- if (keyEventArgs.Key == Key.Enter)
+ if (keyEventArgs.Key == Keys.Enter)
{
if (SelectedItem is null) return false;
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/CommandBindingConfiguration.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/CommandBindingConfiguration.cs
similarity index 82%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/CommandBindingConfiguration.cs
rename to src/AppCommon/FileTime.App.Core.Abstraction/Configuration/CommandBindingConfiguration.cs
index 0ecd47f..e176662 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/CommandBindingConfiguration.cs
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/CommandBindingConfiguration.cs
@@ -1,6 +1,6 @@
-using Avalonia.Input;
+using FileTime.App.Core.Models;
-namespace FileTime.GuiApp.App.Configuration;
+namespace FileTime.App.Core.Configuration;
public class CommandBindingConfiguration
{
@@ -24,19 +24,19 @@ public class CommandBindingConfiguration
public CommandBindingConfiguration(string command, KeyConfig key)
{
- Keys = new List() { key };
+ Keys = new List { key };
Command = command;
}
- public CommandBindingConfiguration(string command, IEnumerable keys)
+ public CommandBindingConfiguration(string command, IEnumerable keys)
{
Keys = keys.Select(k => new KeyConfig(k)).ToList();
Command = command;
}
- public CommandBindingConfiguration(string command, Key key)
+ public CommandBindingConfiguration(string command, Keys key)
{
- Keys = new List() { new KeyConfig(key) };
+ Keys = new List() { new(key) };
Command = command;
}
@@ -61,7 +61,10 @@ public class CommandBindingConfiguration
return s;
}
- private static string AddKeyWithCtrlOrAlt(KeyConfig key, string currentText, Func keyProcessor)
+ private static string AddKeyWithCtrlOrAlt(
+ KeyConfig key,
+ string currentText,
+ Func keyProcessor)
{
var s = "";
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/KeyBindingConfiguration.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/KeyBindingConfiguration.cs
similarity index 85%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/KeyBindingConfiguration.cs
rename to src/AppCommon/FileTime.App.Core.Abstraction/Configuration/KeyBindingConfiguration.cs
index 4d53d3b..c14330a 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/KeyBindingConfiguration.cs
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/KeyBindingConfiguration.cs
@@ -1,4 +1,4 @@
-namespace FileTime.GuiApp.App.Configuration;
+namespace FileTime.App.Core.Configuration;
public class KeyBindingConfiguration
{
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/KeyConfig.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/KeyConfig.cs
similarity index 76%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/KeyConfig.cs
rename to src/AppCommon/FileTime.App.Core.Abstraction/Configuration/KeyConfig.cs
index a381cba..a3140af 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/KeyConfig.cs
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/KeyConfig.cs
@@ -1,10 +1,10 @@
-using Avalonia.Input;
+using FileTime.App.Core.Models;
-namespace FileTime.GuiApp.App.Configuration;
+namespace FileTime.App.Core.Configuration;
public class KeyConfig
{
- public Key Key { get; set; }
+ public Keys Key { get; set; }
public bool Shift { get; set; }
public bool Alt { get; set; }
public bool Ctrl { get; set; }
@@ -12,7 +12,7 @@ public class KeyConfig
public KeyConfig() { }
public KeyConfig(
- Key key,
+ Keys key,
bool shift = false,
bool alt = false,
bool ctrl = false)
@@ -24,7 +24,7 @@ public class KeyConfig
}
public bool AreEquals(KeyConfig otherKeyConfig) =>
- Key == otherKeyConfig.Key
+ Key.Equals(otherKeyConfig.Key)
&& Alt == otherKeyConfig.Alt
&& Shift == otherKeyConfig.Shift
&& Ctrl == otherKeyConfig.Ctrl;
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/ProgramConfiguration.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/ProgramConfiguration.cs
similarity index 86%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/ProgramConfiguration.cs
rename to src/AppCommon/FileTime.App.Core.Abstraction/Configuration/ProgramConfiguration.cs
index 58d26b1..2628e78 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/ProgramConfiguration.cs
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/ProgramConfiguration.cs
@@ -1,4 +1,4 @@
-namespace FileTime.GuiApp.App.Configuration;
+namespace FileTime.App.Core.Configuration;
public class ProgramConfiguration
{
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/ProgramsConfiguration.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/ProgramsConfiguration.cs
similarity index 81%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/ProgramsConfiguration.cs
rename to src/AppCommon/FileTime.App.Core.Abstraction/Configuration/ProgramsConfiguration.cs
index d265e7a..78d364c 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/ProgramsConfiguration.cs
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/ProgramsConfiguration.cs
@@ -1,4 +1,4 @@
-namespace FileTime.GuiApp.App.Configuration;
+namespace FileTime.App.Core.Configuration;
public class ProgramsConfiguration
{
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/SectionNames.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/SectionNames.cs
similarity index 77%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/SectionNames.cs
rename to src/AppCommon/FileTime.App.Core.Abstraction/Configuration/SectionNames.cs
index 9655779..23254a0 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/SectionNames.cs
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Configuration/SectionNames.cs
@@ -1,4 +1,4 @@
-namespace FileTime.GuiApp.App.Configuration;
+namespace FileTime.App.Core.Configuration;
public static class SectionNames
{
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Extensions/KeyConfigExtensions.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Extensions/KeyConfigExtensions.cs
similarity index 77%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App/Extensions/KeyConfigExtensions.cs
rename to src/AppCommon/FileTime.App.Core.Abstraction/Extensions/KeyConfigExtensions.cs
index 53d4820..e760423 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Extensions/KeyConfigExtensions.cs
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Extensions/KeyConfigExtensions.cs
@@ -1,6 +1,6 @@
-using FileTime.GuiApp.App.Configuration;
+using FileTime.App.Core.Configuration;
-namespace FileTime.GuiApp.App.Extensions;
+namespace FileTime.App.Core.Extensions;
public static class KeyConfigExtensions
{
diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/Models/GeneralKeyEventArgs.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Models/GeneralKeyEventArgs.cs
new file mode 100644
index 0000000..ee83f00
--- /dev/null
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Models/GeneralKeyEventArgs.cs
@@ -0,0 +1,26 @@
+namespace FileTime.App.Core.Models;
+
+public class GeneralKeyEventArgs
+{
+ private readonly Action _handledChanged;
+ private bool _handled;
+ public required Keys Key { get; init; }
+
+ public bool Handled
+ {
+ get => _handled;
+ set
+ {
+ if (_handled != value)
+ {
+ _handled = value;
+ _handledChanged(value);
+ }
+ }
+ }
+
+ public GeneralKeyEventArgs(Action handledChanged)
+ {
+ _handledChanged = handledChanged;
+ }
+}
\ No newline at end of file
diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/Models/Keys.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Models/Keys.cs
new file mode 100644
index 0000000..27b1a6b
--- /dev/null
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Models/Keys.cs
@@ -0,0 +1,58 @@
+namespace FileTime.App.Core.Models;
+
+public enum Keys
+{
+ A,
+ B,
+ C,
+ D,
+ E,
+ F,
+ G,
+ H,
+ I,
+ J,
+ K,
+ L,
+ M,
+ N,
+ O,
+ P,
+ Q,
+ R,
+ S,
+ T,
+ U,
+ V,
+ W,
+ X,
+ Y,
+ Z,
+ F1,
+ F2,
+ F3,
+ F4,
+ F5,
+ F6,
+ F7,
+ F8,
+ F9,
+ F10,
+ F11,
+ F12,
+ Up,
+ Down,
+ Left,
+ Right,
+ Enter,
+ Escape,
+ Back,
+ Space,
+ PageUp,
+ PageDown,
+ Comma,
+ Question,
+ Tab,
+ LWin,
+ RWin,
+}
\ No newline at end of file
diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/Services/IAppKeyService.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IAppKeyService.cs
new file mode 100644
index 0000000..676a745
--- /dev/null
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IAppKeyService.cs
@@ -0,0 +1,8 @@
+using FileTime.App.Core.Models;
+
+namespace FileTime.App.Core.Services;
+
+public interface IAppKeyService
+{
+ Keys? MapKey(TKey key);
+}
\ No newline at end of file
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IKeyboardConfigurationService.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IKeyboardConfigurationService.cs
similarity index 77%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IKeyboardConfigurationService.cs
rename to src/AppCommon/FileTime.App.Core.Abstraction/Services/IKeyboardConfigurationService.cs
index f87d342..1477369 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IKeyboardConfigurationService.cs
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IKeyboardConfigurationService.cs
@@ -1,6 +1,6 @@
-using FileTime.GuiApp.App.Configuration;
+using FileTime.App.Core.Configuration;
-namespace FileTime.GuiApp.App.Services;
+namespace FileTime.App.Core.Services;
public interface IKeyboardConfigurationService
{
diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/Services/ILifecycleService.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Services/ILifecycleService.cs
new file mode 100644
index 0000000..ce5f8ac
--- /dev/null
+++ b/src/AppCommon/FileTime.App.Core.Abstraction/Services/ILifecycleService.cs
@@ -0,0 +1,7 @@
+namespace FileTime.App.Core.Services;
+
+public interface ILifecycleService
+{
+ Task InitStartupHandlersAsync();
+ Task ExitAsync();
+}
\ No newline at end of file
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/MainConfiguration.cs b/src/AppCommon/FileTime.App.Core/Configuration/MainConfiguration.cs
similarity index 58%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/MainConfiguration.cs
rename to src/AppCommon/FileTime.App.Core/Configuration/MainConfiguration.cs
index 4bbff55..a968eec 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Configuration/MainConfiguration.cs
+++ b/src/AppCommon/FileTime.App.Core/Configuration/MainConfiguration.cs
@@ -1,10 +1,10 @@
-using Avalonia.Input;
+using FileTime.App.Core.Models;
using FileTime.App.Core.UserCommand;
using FileTime.Providers.LocalAdmin;
-namespace FileTime.GuiApp.App.Configuration;
+namespace FileTime.App.Core.Configuration;
-public static class MainConfiguration
+public class MainConfiguration
{
private static readonly Lazy> _defaultKeybindings = new(InitDefaultKeyBindings);
@@ -30,7 +30,7 @@ public static class MainConfiguration
var baseKey = basePath + $":[{i}]:";
var commandBindingConfig = commandBindingConfigs[i];
configuration.Add(baseKey + nameof(CommandBindingConfiguration.Command),
- commandBindingConfig.Command.ToString());
+ commandBindingConfig.Command);
for (var j = 0; j < commandBindingConfig.Keys.Count; j++)
{
@@ -47,93 +47,93 @@ public static class MainConfiguration
private static List InitDefaultKeyBindings() =>
new List
{
- //new CommandBindingConfiguration(ConfigCommand.AutoRefresh, new KeyConfig(Key.R, shift: true)),
- //new CommandBindingConfiguration(ConfigCommand.ChangeTimelineMode, new[] { Key.T, Key.M }),
- new(CloseTabCommand.CommandName, Key.Q),
- //new CommandBindingConfiguration(ConfigCommand.Compress, new[] { Key.Y, Key.C }),
- new(CopyBase64Command.CommandName, new[] {Key.C, Key.B}),
- new(CopyCommand.CommandName, new[] {Key.Y, Key.Y}),
- //new CommandBindingConfiguration(ConfigCommand.CopyHash, new[] { Key.C, Key.H }),
- new(CopyNativePathCommand.CommandName, new[] {Key.C, Key.P}),
- new(CopyFilesToClipboardCommand.CommandName, new[] {Key.Y, Key.C}),
- new(CreateContainer.CommandName, Key.F7),
- new(CreateContainer.CommandName, new[] {Key.C, Key.C}),
- new(CreateElementCommand.CommandName, new[] {Key.C, Key.E}),
- //new CommandBindingConfiguration(ConfigCommand.Cut, new[] { Key.D, Key.D }),
- //new CommandBindingConfiguration(ConfigCommand.Edit, new KeyConfig(Key.F4)),
- new(EnterRapidTravelCommand.CommandName, new KeyConfig(Key.OemComma, shift: true)),
- new(EnterRapidTravelCommand.CommandName, new KeyConfig(Key.OemQuestion, shift: true)),
- new(GoBackCommand.CommandName, new KeyConfig(Key.Left, alt: true)),
- new(GoByFrequencyCommand.CommandName, Key.Z),
- new(GoForwardCommand.CommandName, new KeyConfig(Key.Right, alt: true)),
- new(GoToHomeCommand.CommandName, new[] {Key.G, Key.H}),
- new(GoToPathCommand.CommandName, new KeyConfig(Key.L, ctrl: true)),
- new(GoToPathCommand.CommandName, new[] {Key.G, Key.P}),
- new(GoToProviderCommand.CommandName, new[] {Key.G, Key.T}),
- new(GoToRootCommand.CommandName, new[] {Key.G, Key.R}),
- new(GoUpCommand.CommandName, Key.Left),
- new(DeleteCommand.HardDeleteCommandName, new[] {new KeyConfig(Key.D, shift: true), new KeyConfig(Key.D, shift: true)}),
- new(MarkCommand.CommandName, Key.Space),
- new(MoveCursorToLastCommand.CommandName, new KeyConfig(Key.G, shift: true)),
- new(MoveCursorToFirstCommand.CommandName, new[] {Key.G, Key.G}),
- new(MoveCursorUpCommand.CommandName, Key.Up),
- new(MoveCursorDownCommand.CommandName, Key.Down),
- new(MoveCursorUpPageCommand.CommandName, Key.PageUp),
- new(MoveCursorDownPageCommand.CommandName, Key.PageDown),
- //new CommandBindingConfiguration(ConfigCommand.NextTimelineBlock, Key.L ),
- //new CommandBindingConfiguration(ConfigCommand.NextTimelineCommand, Key.J ),
- new(OpenSelectedCommand.CommandName, Key.Right),
- new(OpenCommandPaletteCommand.CommandName, new[] {Key.F1}),
- new(OpenCommandPaletteCommand.CommandName, new[] {new KeyConfig(Key.P, ctrl: true, shift: true)}),
- new(OpenInDefaultFileExplorerCommand.CommandName, new[] {Key.O, Key.E}),
- new(PasteCommand.PasteMergeCommandName, new[] {Key.P, Key.P}),
- new(PasteCommand.PasteOverwriteCommandName, new[] {Key.P, Key.O}),
- new(PasteCommand.PasteSkipCommandName, new[] {Key.P, Key.S}),
- new(PasteFilesFromClipboardCommand.PasteMergeCommandName, new[] {new KeyConfig(Key.V, ctrl: true)}),
- new(PasteFilesFromClipboardCommand.PasteOverwriteCommandName, new[] {new KeyConfig(Key.V, ctrl: true, shift: true)}),
- //new CommandBindingConfiguration(ConfigCommand.PinFavorite, new[] { Key.F, Key.P }),
- //new CommandBindingConfiguration(ConfigCommand.PreviousTimelineBlock, Key.H ),
- //new CommandBindingConfiguration(ConfigCommand.PreviousTimelineCommand, Key.K ),
- new(RefreshCommand.CommandName, Key.R),
- new(RenameCommand.CommandName, Key.F2),
- new(RenameCommand.CommandName, new[] {Key.C, Key.W}),
- new(IdentifiableRunOrOpenCommand.CommandName, Key.Enter),
- //new CommandBindingConfiguration(ConfigCommand.RunCommand, new KeyConfig(Key.D4, shift: true)),
- //new CommandBindingConfiguration(ConfigCommand.ScanContainerSize, new[] { Key.C, Key.S }),
- //new CommandBindingConfiguration(ConfigCommand.ShowAllShortcut, Key.F1),
- new(DeleteCommand.SoftDeleteCommandName, new[] {new KeyConfig(Key.D), new KeyConfig(Key.D, shift: true)}),
- new(IdentifiableSearchCommand.SearchByNameContainsCommandName, new[] {Key.S, Key.N}),
- new(SwitchToTabCommand.SwitchToLastTabCommandName, new[] {new KeyConfig(Key.D9, alt: true)}),
- new(SwitchToTabCommand.SwitchToTab1CommandName, new[] {new KeyConfig(Key.D1, alt: true)}),
- new(SwitchToTabCommand.SwitchToTab2CommandName, new[] {new KeyConfig(Key.D2, alt: true)}),
- new(SwitchToTabCommand.SwitchToTab3CommandName, new[] {new KeyConfig(Key.D3, alt: true)}),
- new(SwitchToTabCommand.SwitchToTab4CommandName, new[] {new KeyConfig(Key.D4, alt: true)}),
- new(SwitchToTabCommand.SwitchToTab5CommandName, new[] {new KeyConfig(Key.D5, alt: true)}),
- new(SwitchToTabCommand.SwitchToTab6CommandName, new[] {new KeyConfig(Key.D6, alt: true)}),
- new(SwitchToTabCommand.SwitchToTab7CommandName, new[] {new KeyConfig(Key.D7, alt: true)}),
- new(SwitchToTabCommand.SwitchToTab8CommandName, new[] {new KeyConfig(Key.D8, alt: true)}),
- new(PauseCommandSchedulerCommand.CommandName, new[] {Key.T, Key.P}),
- //new CommandBindingConfiguration(ConfigCommand.TimelineRefresh, new[] { Key.T, Key.R }),
- new(StartCommandSchedulerCommand.CommandName, new[] {Key.T, Key.S}),
- //new CommandBindingConfiguration(ConfigCommand.ToggleAdvancedIcons, new[] { Key.Z, Key.I }),
+ //new CommandBindingConfiguration(ConfigCommand.AutoRefresh, new KeyConfig(Keys.R, shift: true)),
+ //new CommandBindingConfiguration(ConfigCommand.ChangeTimelineMode, new[] { Keys.T, Keys.M }),
+ new(CloseTabCommand.CommandName, Keys.Q),
+ //new CommandBindingConfiguration(ConfigCommand.Compress, new[] { Keys.Y, Keys.C }),
+ new(CopyBase64Command.CommandName, new[] {Keys.C, Keys.B}),
+ new(CopyCommand.CommandName, new[] {Keys.Y, Keys.Y}),
+ //new CommandBindingConfiguration(ConfigCommand.CopyHash, new[] { Keys.C, Keys.H }),
+ new(CopyNativePathCommand.CommandName, new[] {Keys.C, Keys.P}),
+ new(CopyFilesToClipboardCommand.CommandName, new[] {Keys.Y, Keys.C}),
+ new(CreateContainer.CommandName, Keys.F7),
+ new(CreateContainer.CommandName, new[] {Keys.C, Keys.C}),
+ new(CreateElementCommand.CommandName, new[] {Keys.C, Keys.E}),
+ //new CommandBindingConfiguration(ConfigCommand.Cut, new[] { Keys.D, Keys.D }),
+ //new CommandBindingConfiguration(ConfigCommand.Edit, new KeyConfig(Keys.F4)),
+ new(EnterRapidTravelCommand.CommandName, new KeyConfig(Keys.Comma, shift: true)),
+ new(EnterRapidTravelCommand.CommandName, new KeyConfig(Keys.Question, shift: true)),
+ new(GoBackCommand.CommandName, new KeyConfig(Keys.Left, alt: true)),
+ new(GoByFrequencyCommand.CommandName, Keys.Z),
+ new(GoForwardCommand.CommandName, new KeyConfig(Keys.Right, alt: true)),
+ new(GoToHomeCommand.CommandName, new[] {Keys.G, Keys.H}),
+ new(GoToPathCommand.CommandName, new KeyConfig(Keys.L, ctrl: true)),
+ new(GoToPathCommand.CommandName, new[] {Keys.G, Keys.P}),
+ new(GoToProviderCommand.CommandName, new[] {Keys.G, Keys.T}),
+ new(GoToRootCommand.CommandName, new[] {Keys.G, Keys.R}),
+ new(GoUpCommand.CommandName, Keys.Left),
+ new(DeleteCommand.HardDeleteCommandName, new[] {new KeyConfig(Keys.D, shift: true), new KeyConfig(Keys.D, shift: true)}),
+ new(MarkCommand.CommandName, Keys.Space),
+ new(MoveCursorToLastCommand.CommandName, new KeyConfig(Keys.G, shift: true)),
+ new(MoveCursorToFirstCommand.CommandName, new[] {Keys.G, Keys.G}),
+ new(MoveCursorUpCommand.CommandName, Keys.Up),
+ new(MoveCursorDownCommand.CommandName, Keys.Down),
+ new(MoveCursorUpPageCommand.CommandName, Keys.PageUp),
+ new(MoveCursorDownPageCommand.CommandName, Keys.PageDown),
+ //new CommandBindingConfiguration(ConfigCommand.NextTimelineBlock, Keys.L ),
+ //new CommandBindingConfiguration(ConfigCommand.NextTimelineCommand, Keys.J ),
+ new(OpenSelectedCommand.CommandName, Keys.Right),
+ new(OpenCommandPaletteCommand.CommandName, new[] {Keys.F1}),
+ new(OpenCommandPaletteCommand.CommandName, new[] {new KeyConfig(Keys.P, ctrl: true, shift: true)}),
+ new(OpenInDefaultFileExplorerCommand.CommandName, new[] {Keys.O, Keys.E}),
+ new(PasteCommand.PasteMergeCommandName, new[] {Keys.P, Keys.P}),
+ new(PasteCommand.PasteOverwriteCommandName, new[] {Keys.P, Keys.O}),
+ new(PasteCommand.PasteSkipCommandName, new[] {Keys.P, Keys.S}),
+ new(PasteFilesFromClipboardCommand.PasteMergeCommandName, new[] {new KeyConfig(Keys.V, ctrl: true)}),
+ new(PasteFilesFromClipboardCommand.PasteOverwriteCommandName, new[] {new KeyConfig(Keys.V, ctrl: true, shift: true)}),
+ //new CommandBindingConfiguration(ConfigCommand.PinFavorite, new[] { Keys.F, Keys.P }),
+ //new CommandBindingConfiguration(ConfigCommand.PreviousTimelineBlock, Keys.H ),
+ //new CommandBindingConfiguration(ConfigCommand.PreviousTimelineCommand, Keys.K ),
+ new(RefreshCommand.CommandName, Keys.R),
+ new(RenameCommand.CommandName, Keys.F2),
+ new(RenameCommand.CommandName, new[] {Keys.C, Keys.W}),
+ new(IdentifiableRunOrOpenCommand.CommandName, Keys.Enter),
+ //new CommandBindingConfiguration(ConfigCommand.RunCommand, new KeyConfig(Keys.D4, shift: true)),
+ //new CommandBindingConfiguration(ConfigCommand.ScanContainerSize, new[] { Keys.C, Keys.S }),
+ //new CommandBindingConfiguration(ConfigCommand.ShowAllShortcut, Keys.F1),
+ new(DeleteCommand.SoftDeleteCommandName, new[] {new KeyConfig(Keys.D), new KeyConfig(Keys.D, shift: true)}),
+ new(IdentifiableSearchCommand.SearchByNameContainsCommandName, new[] {Keys.S, Keys.N}),
+ new(SwitchToTabCommand.SwitchToLastTabCommandName, new[] {new KeyConfig(Keys.F9, alt: true)}),
+ new(SwitchToTabCommand.SwitchToTab1CommandName, new[] {new KeyConfig(Keys.F1, alt: true)}),
+ new(SwitchToTabCommand.SwitchToTab2CommandName, new[] {new KeyConfig(Keys.F2, alt: true)}),
+ new(SwitchToTabCommand.SwitchToTab3CommandName, new[] {new KeyConfig(Keys.F3, alt: true)}),
+ new(SwitchToTabCommand.SwitchToTab4CommandName, new[] {new KeyConfig(Keys.F4, alt: true)}),
+ new(SwitchToTabCommand.SwitchToTab5CommandName, new[] {new KeyConfig(Keys.F5, alt: true)}),
+ new(SwitchToTabCommand.SwitchToTab6CommandName, new[] {new KeyConfig(Keys.F6, alt: true)}),
+ new(SwitchToTabCommand.SwitchToTab7CommandName, new[] {new KeyConfig(Keys.F7, alt: true)}),
+ new(SwitchToTabCommand.SwitchToTab8CommandName, new[] {new KeyConfig(Keys.F8, alt: true)}),
+ new(PauseCommandSchedulerCommand.CommandName, new[] {Keys.T, Keys.P}),
+ //new CommandBindingConfiguration(ConfigCommand.TimelineRefresh, new[] { Keys.T, Keys.R }),
+ new(StartCommandSchedulerCommand.CommandName, new[] {Keys.T, Keys.S}),
+ //new CommandBindingConfiguration(ConfigCommand.ToggleAdvancedIcons, new[] { Keys.Z, Keys.I }),
};
private static void PopulateDefaultEditorPrograms(Dictionary configuration)
{
var editorPrograms = new List()
{
- new ProgramConfiguration(@"c:\Program Files\Notepad++\notepad++.exe"),
- new ProgramConfiguration("notepad.exe"),
+ new(@"c:\Program Files\Notepad++\notepad++.exe"),
+ new("notepad.exe"),
};
for (var i = 0; i < editorPrograms.Count; i++)
{
- if (editorPrograms[i].Path is not string path) continue;
+ if (editorPrograms[i].Path is not { } path) continue;
configuration.Add(
$"{SectionNames.ProgramsSectionName}:{nameof(ProgramsConfiguration.DefaultEditorPrograms)}:[{i}]:{nameof(ProgramConfiguration.Path)}",
path);
- if (editorPrograms[i].Arguments is string arguments)
+ if (editorPrograms[i].Arguments is { } arguments)
{
configuration.Add(
$"{SectionNames.ProgramsSectionName}:{nameof(ProgramsConfiguration.DefaultEditorPrograms)}:[{i}]:{nameof(ProgramConfiguration.Arguments)}",
diff --git a/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj b/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj
index 60814e7..d9ce856 100644
--- a/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj
+++ b/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj
@@ -12,6 +12,7 @@
+
@@ -24,6 +25,7 @@
+
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/KeyboardConfigurationService.cs b/src/AppCommon/FileTime.App.Core/Services/KeyboardConfigurationService.cs
similarity index 94%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/KeyboardConfigurationService.cs
rename to src/AppCommon/FileTime.App.Core/Services/KeyboardConfigurationService.cs
index 2b39f96..f188942 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/KeyboardConfigurationService.cs
+++ b/src/AppCommon/FileTime.App.Core/Services/KeyboardConfigurationService.cs
@@ -1,8 +1,8 @@
+using FileTime.App.Core.Configuration;
using FileTime.App.Core.UserCommand;
-using FileTime.GuiApp.App.Configuration;
using Microsoft.Extensions.Options;
-namespace FileTime.GuiApp.App.Services;
+namespace FileTime.App.Core.Services;
public class KeyboardConfigurationService : IKeyboardConfigurationService
{
@@ -48,8 +48,7 @@ public class KeyboardConfigurationService : IKeyboardConfigurationService
}
private static bool IsUniversal(CommandBindingConfiguration keyMapping)
- {
- return keyMapping.Command is
+ => keyMapping.Command is
GoUpCommand.CommandName
or OpenSelectedCommand.CommandName
or MoveCursorDownCommand.CommandName
@@ -57,5 +56,4 @@ public class KeyboardConfigurationService : IKeyboardConfigurationService
or MoveCursorUpCommand.CommandName
or MoveCursorUpPageCommand.CommandName
or IdentifiableRunOrOpenCommand.CommandName;
- }
}
\ No newline at end of file
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/LifecycleService.cs b/src/AppCommon/FileTime.App.Core/Services/LifecycleService.cs
similarity index 94%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/LifecycleService.cs
rename to src/AppCommon/FileTime.App.Core/Services/LifecycleService.cs
index 08488cf..3f2e897 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/LifecycleService.cs
+++ b/src/AppCommon/FileTime.App.Core/Services/LifecycleService.cs
@@ -1,10 +1,9 @@
-using FileTime.App.Core.Services;
using FileTime.Core.Extensions;
using Microsoft.Extensions.Logging;
-namespace FileTime.GuiApp.App.Services;
+namespace FileTime.App.Core.Services;
-public class LifecycleService
+public class LifecycleService : ILifecycleService
{
private readonly IEnumerable _exitHandlers;
private readonly IEnumerable _startupHandlers;
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/ModalService.cs b/src/AppCommon/FileTime.App.Core/Services/ModalService.cs
similarity index 93%
rename from src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/ModalService.cs
rename to src/AppCommon/FileTime.App.Core/Services/ModalService.cs
index 1ea0026..2300fdb 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/ModalService.cs
+++ b/src/AppCommon/FileTime.App.Core/Services/ModalService.cs
@@ -1,9 +1,8 @@
using DynamicData;
-using FileTime.App.Core.Services;
using FileTime.App.Core.ViewModels;
using Microsoft.Extensions.DependencyInjection;
-namespace FileTime.GuiApp.App.Services;
+namespace FileTime.App.Core.Services;
public class ModalService : IModalService
{
diff --git a/src/AppCommon/FileTime.App.Core/Startup.cs b/src/AppCommon/FileTime.App.Core/Startup.cs
index 39cb18a..a53d051 100644
--- a/src/AppCommon/FileTime.App.Core/Startup.cs
+++ b/src/AppCommon/FileTime.App.Core/Startup.cs
@@ -26,6 +26,8 @@ public static class Startup
serviceCollection.TryAddSingleton();
serviceCollection.TryAddSingleton();
serviceCollection.TryAddSingleton();
+ serviceCollection.TryAddSingleton();
+ serviceCollection.TryAddSingleton();
return serviceCollection
.AddCommandHandlers()
diff --git a/src/AppCommon/FileTime.App.FrequencyNavigation.Abstractions/FileTime.App.FrequencyNavigation.Abstractions.csproj b/src/AppCommon/FileTime.App.FrequencyNavigation.Abstractions/FileTime.App.FrequencyNavigation.Abstractions.csproj
index a165e4c..9f9f8ef 100644
--- a/src/AppCommon/FileTime.App.FrequencyNavigation.Abstractions/FileTime.App.FrequencyNavigation.Abstractions.csproj
+++ b/src/AppCommon/FileTime.App.FrequencyNavigation.Abstractions/FileTime.App.FrequencyNavigation.Abstractions.csproj
@@ -12,8 +12,4 @@
-
-
-
-
diff --git a/src/AppCommon/FileTime.App.FrequencyNavigation.Abstractions/ViewModels/IFrequencyNavigationViewModel.cs b/src/AppCommon/FileTime.App.FrequencyNavigation.Abstractions/ViewModels/IFrequencyNavigationViewModel.cs
index 2a0a5d5..f5f6e0b 100644
--- a/src/AppCommon/FileTime.App.FrequencyNavigation.Abstractions/ViewModels/IFrequencyNavigationViewModel.cs
+++ b/src/AppCommon/FileTime.App.FrequencyNavigation.Abstractions/ViewModels/IFrequencyNavigationViewModel.cs
@@ -1,4 +1,4 @@
-using Avalonia.Input;
+using FileTime.App.Core.Models;
using FileTime.App.Core.ViewModels;
using FileTime.App.FuzzyPanel;
@@ -8,5 +8,5 @@ public interface IFrequencyNavigationViewModel : IFuzzyPanelViewModel, I
{
IObservable ShowWindow { get; }
void Close();
- Task HandleKeyUp(KeyEventArgs keyEventArgs);
+ Task HandleKeyUp(GeneralKeyEventArgs keyEventArgs);
}
\ No newline at end of file
diff --git a/src/AppCommon/FileTime.App.FrequencyNavigation/ViewModels/FrequencyNavigationViewModel.cs b/src/AppCommon/FileTime.App.FrequencyNavigation/ViewModels/FrequencyNavigationViewModel.cs
index 03405e1..686b34b 100644
--- a/src/AppCommon/FileTime.App.FrequencyNavigation/ViewModels/FrequencyNavigationViewModel.cs
+++ b/src/AppCommon/FileTime.App.FrequencyNavigation/ViewModels/FrequencyNavigationViewModel.cs
@@ -1,4 +1,4 @@
-using Avalonia.Input;
+using FileTime.App.Core.Models;
using FileTime.App.Core.Services;
using FileTime.App.Core.UserCommand;
using FileTime.App.Core.ViewModels;
@@ -30,11 +30,11 @@ public class FrequencyNavigationViewModel : FuzzyPanelViewModel, IFreque
public void Close()
=> _frequencyNavigationService.CloseNavigationWindow();
- public async Task HandleKeyUp(KeyEventArgs keyEventArgs)
+ public async Task HandleKeyUp(GeneralKeyEventArgs keyEventArgs)
{
if (keyEventArgs.Handled) return false;
- if (keyEventArgs.Key == Key.Enter)
+ if (keyEventArgs.Key == Keys.Enter)
{
keyEventArgs.Handled = true;
var targetContainer = await _timelessContentProvider.GetItemByFullNameAsync(new FullName(SelectedItem), PointInTime.Present);
@@ -47,14 +47,14 @@ public class FrequencyNavigationViewModel : FuzzyPanelViewModel, IFreque
return false;
}
- public override async Task HandleKeyDown(KeyEventArgs keyEventArgs)
+ public override async Task HandleKeyDown(GeneralKeyEventArgs keyEventArgs)
{
if (keyEventArgs.Handled) return false;
var handled = await base.HandleKeyDown(keyEventArgs);
if (handled) return true;
- if (keyEventArgs.Key == Key.Escape)
+ if (keyEventArgs.Key == Keys.Escape)
{
keyEventArgs.Handled = true;
Close();
diff --git a/src/AppCommon/FileTime.App.FuzzyPanel.Abstraction/FileTime.App.FuzzyPanel.Abstraction.csproj b/src/AppCommon/FileTime.App.FuzzyPanel.Abstraction/FileTime.App.FuzzyPanel.Abstraction.csproj
index 88d2cc2..7c0b577 100644
--- a/src/AppCommon/FileTime.App.FuzzyPanel.Abstraction/FileTime.App.FuzzyPanel.Abstraction.csproj
+++ b/src/AppCommon/FileTime.App.FuzzyPanel.Abstraction/FileTime.App.FuzzyPanel.Abstraction.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/AppCommon/FileTime.App.FuzzyPanel.Abstraction/IFuzzyPanelViewModel.cs b/src/AppCommon/FileTime.App.FuzzyPanel.Abstraction/IFuzzyPanelViewModel.cs
index dc968fd..254320e 100644
--- a/src/AppCommon/FileTime.App.FuzzyPanel.Abstraction/IFuzzyPanelViewModel.cs
+++ b/src/AppCommon/FileTime.App.FuzzyPanel.Abstraction/IFuzzyPanelViewModel.cs
@@ -1,4 +1,4 @@
-using Avalonia.Input;
+using FileTime.App.Core.Models;
namespace FileTime.App.FuzzyPanel;
@@ -8,5 +8,5 @@ public interface IFuzzyPanelViewModel where TItem : class
TItem? SelectedItem { get; }
string SearchText { get; set; }
void UpdateFilteredMatches();
- Task HandleKeyDown(KeyEventArgs keyEventArgs);
+ Task HandleKeyDown(GeneralKeyEventArgs keyEventArgs);
}
\ No newline at end of file
diff --git a/src/AppCommon/FileTime.App.FuzzyPanel/FileTime.App.FuzzyPanel.csproj b/src/AppCommon/FileTime.App.FuzzyPanel/FileTime.App.FuzzyPanel.csproj
index 1982ba2..b9296f8 100644
--- a/src/AppCommon/FileTime.App.FuzzyPanel/FileTime.App.FuzzyPanel.csproj
+++ b/src/AppCommon/FileTime.App.FuzzyPanel/FileTime.App.FuzzyPanel.csproj
@@ -7,7 +7,6 @@
-
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/AppCommon/FileTime.App.FuzzyPanel/FuzzyPanelViewModel.cs b/src/AppCommon/FileTime.App.FuzzyPanel/FuzzyPanelViewModel.cs
index 2375ed6..fd9a3c6 100644
--- a/src/AppCommon/FileTime.App.FuzzyPanel/FuzzyPanelViewModel.cs
+++ b/src/AppCommon/FileTime.App.FuzzyPanel/FuzzyPanelViewModel.cs
@@ -1,5 +1,5 @@
using System.ComponentModel;
-using Avalonia.Input;
+using FileTime.App.Core.Models;
using PropertyChanged.SourceGenerator;
namespace FileTime.App.FuzzyPanel;
@@ -44,9 +44,9 @@ public abstract partial class FuzzyPanelViewModel : IFuzzyPanelViewModel<
public abstract void UpdateFilteredMatches();
- public virtual Task HandleKeyDown(KeyEventArgs keyEventArgs)
+ public virtual Task HandleKeyDown(GeneralKeyEventArgs keyEventArgs)
{
- if (keyEventArgs.Key == Key.Down)
+ if (keyEventArgs.Key == Keys.Down)
{
var nextItem = SelectedItem is null
? FilteredMatches.FirstOrDefault()
@@ -60,7 +60,7 @@ public abstract partial class FuzzyPanelViewModel : IFuzzyPanelViewModel<
return Task.FromResult(true);
}
- else if (keyEventArgs.Key == Key.Up)
+ else if (keyEventArgs.Key == Keys.Up)
{
var previousItem = SelectedItem is null
? FilteredMatches.LastOrDefault()
diff --git a/src/Core/FileTime.Core.Abstraction/Collections/CircularBuffer.cs b/src/Core/FileTime.Core.Abstraction/Collections/CircularBuffer.cs
index db73b53..38a0d9f 100644
--- a/src/Core/FileTime.Core.Abstraction/Collections/CircularBuffer.cs
+++ b/src/Core/FileTime.Core.Abstraction/Collections/CircularBuffer.cs
@@ -2,7 +2,7 @@
using System.Collections;
-namespace CircularBuffer;
+namespace FileTime.Core.Collections;
#if (NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER)
///
@@ -490,7 +490,7 @@ public class CircularBuffer : ICircularBuffer
throw new ArgumentNullException(nameof(array));
if (array.Length < _size)
- throw new ArgumentException($"The number of elements in the source {nameof(CircularBuffer)} is greater than the available " +
+ throw new ArgumentException($"The number of elements in the source {nameof(CircularBuffer)} is greater than the available " +
"number of elements of the destination array.", nameof(array));
CopyToInternal(array, 0);
@@ -506,7 +506,7 @@ public class CircularBuffer : ICircularBuffer
throw new ArgumentOutOfRangeException(nameof(index), $"{nameof(index)} is less than the lower bound of {nameof(array)}.");
if (array.Length - index < _size)
- throw new ArgumentException($"The number of elements in the source {nameof(CircularBuffer)} is greater than the available " +
+ throw new ArgumentException($"The number of elements in the source {nameof(CircularBuffer)} is greater than the available " +
"number of elements from index to the end of the destination array.", nameof(array));
CopyToInternal(array, index);
@@ -522,7 +522,7 @@ public class CircularBuffer : ICircularBuffer
throw new ArgumentOutOfRangeException(nameof(index), $"{nameof(index)} is less than the lower bound of {nameof(array)}.");
if (array.LongLength - index < _size)
- throw new ArgumentException($"The number of elements in the source {nameof(CircularBuffer)} is greater than the available " +
+ throw new ArgumentException($"The number of elements in the source {nameof(CircularBuffer)} is greater than the available " +
"number of elements from index to the end of the destination array.", nameof(array));
CopyToInternal(array, index);
@@ -534,7 +534,7 @@ public class CircularBuffer : ICircularBuffer
public void CopyTo(Memory memory)
{
if (memory.Length < _size)
- throw new ArgumentException($"The number of elements in the source {nameof(CircularBuffer)} is greater than the available " +
+ throw new ArgumentException($"The number of elements in the source {nameof(CircularBuffer)} is greater than the available " +
"number of elements of the destination Memory.", nameof(memory));
CopyToInternal(memory);
@@ -544,7 +544,7 @@ public class CircularBuffer : ICircularBuffer
public void CopyTo(Span span)
{
if (span.Length < _size)
- throw new ArgumentException($"The number of elements in the source {nameof(CircularBuffer)} is greater than the available " +
+ throw new ArgumentException($"The number of elements in the source {nameof(CircularBuffer)} is greater than the available " +
"number of elements of the destination Span.", nameof(span));
CopyToInternal(span);
diff --git a/src/Core/FileTime.Core.Services/Tab.cs b/src/Core/FileTime.Core.Services/Tab.cs
index ea44171..c316830 100644
--- a/src/Core/FileTime.Core.Services/Tab.cs
+++ b/src/Core/FileTime.Core.Services/Tab.cs
@@ -1,8 +1,8 @@
using System.Collections.ObjectModel;
-using CircularBuffer;
using DeclarativeProperty;
using DynamicData;
using FileTime.App.Core.Services;
+using FileTime.Core.Collections;
using FileTime.Core.Helper;
using FileTime.Core.Models;
using FileTime.Core.Timeline;
diff --git a/src/FileTime.sln b/src/FileTime.sln
index aa257c8..3305bbf 100644
--- a/src/FileTime.sln
+++ b/src/FileTime.sln
@@ -115,6 +115,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileTime.App.ContainerSizeS
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileTime.App.ContainerSizeScanner.Abstractions", "AppCommon\FileTime.App.ContainerSizeScanner.Abstractions\FileTime.App.ContainerSizeScanner.Abstractions.csproj", "{826AFD32-E36B-48BA-BC1E-1476B393CF24}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileTime.ConsoleUI.App.Abstractions", "ConsoleApp\FileTime.ConsoleUI.App.Abstractions\FileTime.ConsoleUI.App.Abstractions.csproj", "{81F44BBB-6F89-41B4-89F1-4A3204843DB5}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -309,6 +311,10 @@ Global
{826AFD32-E36B-48BA-BC1E-1476B393CF24}.Debug|Any CPU.Build.0 = Debug|Any CPU
{826AFD32-E36B-48BA-BC1E-1476B393CF24}.Release|Any CPU.ActiveCfg = Release|Any CPU
{826AFD32-E36B-48BA-BC1E-1476B393CF24}.Release|Any CPU.Build.0 = Release|Any CPU
+ {81F44BBB-6F89-41B4-89F1-4A3204843DB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {81F44BBB-6F89-41B4-89F1-4A3204843DB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {81F44BBB-6F89-41B4-89F1-4A3204843DB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {81F44BBB-6F89-41B4-89F1-4A3204843DB5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -362,6 +368,7 @@ Global
{EE1721A0-D15A-4E40-BEA5-8AB6BAB8FD44} = {8C3CFEFE-78A5-4940-B388-D15FCE02ECE9}
{E5FD38ED-6E4B-42AA-850B-470B939B836B} = {A5291117-3001-498B-AC8B-E14F71F72570}
{826AFD32-E36B-48BA-BC1E-1476B393CF24} = {A5291117-3001-498B-AC8B-E14F71F72570}
+ {81F44BBB-6F89-41B4-89F1-4A3204843DB5} = {CAEEAD3C-41EB-405C-ACA9-BA1E4C352549}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {859FB3DF-C60A-46B1-82E5-90274905D1EF}
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Models/KeyNotSupportedException.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Models/KeyNotSupportedException.cs
new file mode 100644
index 0000000..50ad402
--- /dev/null
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Models/KeyNotSupportedException.cs
@@ -0,0 +1,13 @@
+using Avalonia.Input;
+
+namespace FileTime.GuiApp.App.Models;
+
+public class KeyNotSupportedException : Exception
+{
+ private readonly Key _key;
+
+ public KeyNotSupportedException(Key key) : base($"Key {key} is not supported.")
+ {
+ _key = key;
+ }
+}
\ No newline at end of file
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/ViewModels/IGuiAppState.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/ViewModels/IGuiAppState.cs
index d9680c1..bbc4723 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/ViewModels/IGuiAppState.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/ViewModels/IGuiAppState.cs
@@ -1,6 +1,6 @@
using System.Collections.ObjectModel;
+using FileTime.App.Core.Configuration;
using FileTime.App.Core.ViewModels;
-using FileTime.GuiApp.App.Configuration;
using FileTime.GuiApp.App.Models;
namespace FileTime.GuiApp.App.ViewModels;
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Converters/NamePartShrinkerConverter.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Converters/NamePartShrinkerConverter.cs
index d8ae287..bdbcb8f 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Converters/NamePartShrinkerConverter.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Converters/NamePartShrinkerConverter.cs
@@ -1,7 +1,6 @@
using System.Globalization;
using Avalonia.Data.Converters;
using Avalonia.Media;
-using Avalonia.Threading;
using FileTime.Core.Models;
using FileTime.GuiApp.App.ViewModels;
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Extensions/KeyEventArgsExtension.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Extensions/KeyEventArgsExtension.cs
new file mode 100644
index 0000000..262ae9f
--- /dev/null
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Extensions/KeyEventArgsExtension.cs
@@ -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 appKeyService)
+ {
+ var maybeKey = appKeyService.MapKey(args.Key);
+ if (maybeKey is not {} key1) return null;
+ return new GeneralKeyEventArgs(h => args.Handled = h)
+ {
+ Key = key1
+ };
+ }
+}
\ No newline at end of file
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/DefaultModeKeyInputHandler.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/DefaultModeKeyInputHandler.cs
index 6399ecc..b5ffdb7 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/DefaultModeKeyInputHandler.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/DefaultModeKeyInputHandler.cs
@@ -5,12 +5,13 @@ using FileTime.App.Core.ViewModels;
using FileTime.Core.Extensions;
using FileTime.Core.Models;
using FileTime.Core.Models.Extensions;
-using FileTime.GuiApp.App.Configuration;
-using FileTime.GuiApp.App.Extensions;
using FileTime.GuiApp.App.Models;
using FileTime.GuiApp.App.ViewModels;
using Microsoft.Extensions.Logging;
using DeclarativeProperty;
+using FileTime.App.Core.Configuration;
+using FileTime.App.Core.Extensions;
+using FileTime.App.Core.Models;
namespace FileTime.GuiApp.App.Services;
@@ -24,6 +25,7 @@ public class DefaultModeKeyInputHandler : IDefaultModeKeyInputHandler
private readonly ILogger _logger;
private readonly IUserCommandHandlerService _userCommandHandlerService;
private readonly IIdentifiableUserCommandService _identifiableUserCommandService;
+ private readonly IAppKeyService _appKeyService;
private readonly BindedCollection _openModals;
public DefaultModeKeyInputHandler(
@@ -32,10 +34,12 @@ public class DefaultModeKeyInputHandler : IDefaultModeKeyInputHandler
IKeyboardConfigurationService keyboardConfigurationService,
ILogger logger,
IUserCommandHandlerService userCommandHandlerService,
- IIdentifiableUserCommandService identifiableUserCommandService)
+ IIdentifiableUserCommandService identifiableUserCommandService,
+ IAppKeyService appKeyService)
{
_appState = appState;
_identifiableUserCommandService = identifiableUserCommandService;
+ _appKeyService = appKeyService;
_keyboardConfigurationService = keyboardConfigurationService;
_logger = logger;
_modalService = modalService;
@@ -47,25 +51,26 @@ public class DefaultModeKeyInputHandler : IDefaultModeKeyInputHandler
_openModals = modalService.OpenModals.ToBindedCollection();
- _keysToSkip.Add(new[] {new KeyConfig(Key.Up)});
- _keysToSkip.Add(new[] {new KeyConfig(Key.Down)});
- _keysToSkip.Add(new[] {new KeyConfig(Key.Tab)});
- _keysToSkip.Add(new[] {new KeyConfig(Key.PageDown)});
- _keysToSkip.Add(new[] {new KeyConfig(Key.PageUp)});
- _keysToSkip.Add(new[] {new KeyConfig(Key.F4, alt: true)});
- _keysToSkip.Add(new[] {new KeyConfig(Key.LWin)});
- _keysToSkip.Add(new[] {new KeyConfig(Key.RWin)});
+ _keysToSkip.Add(new[] {new KeyConfig(Keys.Up)});
+ _keysToSkip.Add(new[] {new KeyConfig(Keys.Down)});
+ _keysToSkip.Add(new[] {new KeyConfig(Keys.Tab)});
+ _keysToSkip.Add(new[] {new KeyConfig(Keys.PageDown)});
+ _keysToSkip.Add(new[] {new KeyConfig(Keys.PageUp)});
+ _keysToSkip.Add(new[] {new KeyConfig(Keys.F4, alt: true)});
+ _keysToSkip.Add(new[] {new KeyConfig(Keys.LWin)});
+ _keysToSkip.Add(new[] {new KeyConfig(Keys.RWin)});
}
- public async Task HandleInputKey(Key key, SpecialKeysStatus specialKeysStatus, Action setHandled)
+ public async Task HandleInputKey(Key key2, SpecialKeysStatus specialKeysStatus, Action setHandled)
{
+ if (_appKeyService.MapKey(key2) is not { } key) return;
var keyWithModifiers = new KeyConfig(key, shift: specialKeysStatus.IsShiftPressed, alt: specialKeysStatus.IsAltPressed, ctrl: specialKeysStatus.IsCtrlPressed);
_appState.PreviousKeys.Add(keyWithModifiers);
var selectedCommandBinding = _keyboardConfigurationService.UniversalCommandBindings.FirstOrDefault(c => c.Keys.AreKeysEqual(_appState.PreviousKeys));
selectedCommandBinding ??= _keyboardConfigurationService.CommandBindings.FirstOrDefault(c => c.Keys.AreKeysEqual(_appState.PreviousKeys));
- if (key == Key.Escape)
+ if (key == Keys.Escape)
{
var doGeneralReset = _appState.PreviousKeys.Count > 1 || _appState.IsAllShortcutVisible;
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/GuiAppKeyService.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/GuiAppKeyService.cs
new file mode 100644
index 0000000..aab92b8
--- /dev/null
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/GuiAppKeyService.cs
@@ -0,0 +1,83 @@
+using System.Collections.ObjectModel;
+using Avalonia.Input;
+using FileTime.App.Core.Models;
+using FileTime.App.Core.Services;
+using FileTime.GuiApp.App.Models;
+
+namespace FileTime.GuiApp.App.Services;
+
+public class GuiAppKeyService : IAppKeyService
+{
+ private static readonly Dictionary KeyMapping;
+
+ //TODO: write test for this. Test if every enum value is present in the dictionary.
+ public static ReadOnlyDictionary KeyMappingReadOnly { get; }
+
+ static GuiAppKeyService()
+ {
+ KeyMapping = new Dictionary
+ {
+ {Key.A, Keys.A},
+ {Key.B, Keys.B},
+ {Key.C, Keys.C},
+ {Key.D, Keys.D},
+ {Key.E, Keys.E},
+ {Key.F, Keys.F},
+ {Key.G, Keys.G},
+ {Key.H, Keys.H},
+ {Key.I, Keys.I},
+ {Key.J, Keys.J},
+ {Key.K, Keys.K},
+ {Key.L, Keys.L},
+ {Key.M, Keys.M},
+ {Key.N, Keys.N},
+ {Key.O, Keys.O},
+ {Key.P, Keys.P},
+ {Key.Q, Keys.Q},
+ {Key.R, Keys.R},
+ {Key.S, Keys.S},
+ {Key.T, Keys.T},
+ {Key.U, Keys.U},
+ {Key.V, Keys.V},
+ {Key.W, Keys.W},
+ {Key.X, Keys.X},
+ {Key.Y, Keys.Y},
+ {Key.Z, Keys.Z},
+ {Key.F1, Keys.F1},
+ {Key.F2, Keys.F2},
+ {Key.F3, Keys.F3},
+ {Key.F4, Keys.F4},
+ {Key.F5, Keys.F5},
+ {Key.F6, Keys.F6},
+ {Key.F7, Keys.F7},
+ {Key.F8, Keys.F8},
+ {Key.F9, Keys.F9},
+ {Key.F10, Keys.F10},
+ {Key.F11, Keys.F11},
+ {Key.F12, Keys.F12},
+ {Key.Up, Keys.Up},
+ {Key.Down, Keys.Down},
+ {Key.Left, Keys.Left},
+ {Key.Right, Keys.Right},
+ {Key.Enter, Keys.Enter},
+ {Key.Escape, Keys.Escape},
+ {Key.Back, Keys.Back},
+ {Key.Space, Keys.Space},
+ {Key.PageUp, Keys.PageUp},
+ {Key.PageDown, Keys.PageDown},
+ {Key.OemComma, Keys.Comma},
+ {Key.OemQuestion, Keys.Question},
+ {Key.Tab, Keys.Tab},
+ {Key.LWin, Keys.LWin},
+ {Key.RWin, Keys.RWin},
+ };
+
+ KeyMappingReadOnly = new(KeyMapping);
+ }
+
+ public Keys? MapKey(Key key)
+ {
+ if (!KeyMapping.TryGetValue(key, out var mappedKey)) return null;
+ return mappedKey;
+ }
+}
\ No newline at end of file
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/RapidTravelModeKeyInputHandler.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/RapidTravelModeKeyInputHandler.cs
index 5012bd9..233194d 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/RapidTravelModeKeyInputHandler.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/RapidTravelModeKeyInputHandler.cs
@@ -1,12 +1,12 @@
using Avalonia.Input;
+using FileTime.App.Core.Configuration;
+using FileTime.App.Core.Extensions;
+using FileTime.App.Core.Models;
using FileTime.App.Core.Services;
using FileTime.App.Core.UserCommand;
using FileTime.App.Core.ViewModels;
using FileTime.Core.Extensions;
using FileTime.Core.Models;
-using FileTime.Core.Services;
-using FileTime.GuiApp.App.Configuration;
-using FileTime.GuiApp.App.Extensions;
using FileTime.GuiApp.App.Models;
using Microsoft.Extensions.Logging;
@@ -22,6 +22,7 @@ public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler
private readonly IUserCommandHandlerService _userCommandHandlerService;
private readonly ILogger _logger;
private readonly IIdentifiableUserCommandService _identifiableUserCommandService;
+ private readonly IAppKeyService _appKeyService;
private readonly BindedCollection _openModals;
private ITabViewModel? _selectedTab;
@@ -31,7 +32,8 @@ public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler
IKeyboardConfigurationService keyboardConfigurationService,
IUserCommandHandlerService userCommandHandlerService,
ILogger logger,
- IIdentifiableUserCommandService identifiableUserCommandService)
+ IIdentifiableUserCommandService identifiableUserCommandService,
+ IAppKeyService appKeyService)
{
_appState = appState;
_modalService = modalService;
@@ -39,6 +41,7 @@ public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler
_userCommandHandlerService = userCommandHandlerService;
_logger = logger;
_identifiableUserCommandService = identifiableUserCommandService;
+ _appKeyService = appKeyService;
_appState.SelectedTab.Subscribe(t => _selectedTab = t);
@@ -56,11 +59,12 @@ public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler
});
}
- public async Task HandleInputKey(Key key, SpecialKeysStatus specialKeysStatus, Action setHandled)
+ public async Task HandleInputKey(Key key2, SpecialKeysStatus specialKeysStatus, Action setHandled)
{
+ if (_appKeyService.MapKey(key2) is not { } key) return;
var keyString = key.ToString();
- if (key == Key.Escape)
+ if (key == Keys.Escape)
{
setHandled(true);
if ((_openModals.Collection?.Count ?? 0) > 0)
@@ -72,7 +76,7 @@ public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler
await CallCommandAsync(ExitRapidTravelCommand.Instance);
}
}
- else if (key == Key.Back)
+ else if (key == Keys.Back)
{
if (_appState.RapidTravelText.Value!.Length > 0)
{
@@ -91,7 +95,7 @@ public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler
}
else
{
- var currentKeyAsList = new List() {new KeyConfig(key)};
+ var currentKeyAsList = new List {new(key)};
var selectedCommandBinding = _keyboardConfigurationService.UniversalCommandBindings.FirstOrDefault(c => c.Keys.AreKeysEqual(currentKeyAsList));
if (selectedCommandBinding != null)
{
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/IMainWindowViewModel.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/IMainWindowViewModel.cs
index b6a9e91..0f786ea 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/IMainWindowViewModel.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/IMainWindowViewModel.cs
@@ -1,5 +1,4 @@
-using DeclarativeProperty;
-using FileTime.App.CommandPalette.Services;
+using FileTime.App.CommandPalette.Services;
using FileTime.App.Core.Services;
using FileTime.App.Core.ViewModels;
using FileTime.App.FrequencyNavigation.Services;
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/MainWindowViewModel.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/MainWindowViewModel.cs
index 9d5691c..5407e73 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/MainWindowViewModel.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/MainWindowViewModel.cs
@@ -24,7 +24,7 @@ namespace FileTime.GuiApp.App.ViewModels;
[Inject(typeof(ILogger), PropertyName = "_logger")]
[Inject(typeof(IKeyInputHandlerService), PropertyName = "_keyInputHandlerService")]
[Inject(typeof(IUserCommandHandlerService), PropertyAccessModifier = AccessModifier.Public)]
-[Inject(typeof(LifecycleService), PropertyName = "_lifecycleService")]
+[Inject(typeof(ILifecycleService), PropertyName = "_lifecycleService")]
[Inject(typeof(IItemPreviewService), PropertyAccessModifier = AccessModifier.Public)]
[Inject(typeof(IDialogService), PropertyAccessModifier = AccessModifier.Public)]
[Inject(typeof(ITimelessContentProvider), PropertyName = "_timelessContentProvider")]
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/CommandPalette.axaml.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/CommandPalette.axaml.cs
index bd0b14f..57e6d58 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/CommandPalette.axaml.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/CommandPalette.axaml.cs
@@ -2,11 +2,16 @@
using Avalonia.Controls;
using Avalonia.Input;
using FileTime.App.CommandPalette.ViewModels;
+using FileTime.App.Core.Services;
+using FileTime.GuiApp.App.Extensions;
+using Microsoft.Extensions.DependencyInjection;
namespace FileTime.GuiApp.App.Views;
public partial class CommandPalette : UserControl
{
+ private readonly Lazy> _appKeyService = new(() => DI.ServiceProvider.GetRequiredService>());
+
public CommandPalette()
{
InitializeComponent();
@@ -34,14 +39,18 @@ public partial class CommandPalette : UserControl
}
else
{
- viewModel.HandleKeyDown(e);
+ if (e.ToGeneralKeyEventArgs(_appKeyService.Value) is not { } eventArgs) return;
+
+ viewModel.HandleKeyDown(eventArgs);
}
}
private void Search_OnKeyUp(object? sender, KeyEventArgs e)
{
- if (e.Handled) return;
- if (DataContext is not ICommandPaletteViewModel viewModel) return;
- viewModel.HandleKeyUp(e);
+ if (e.Handled
+ || DataContext is not ICommandPaletteViewModel viewModel) return;
+
+ if (e.ToGeneralKeyEventArgs(_appKeyService.Value) is not { } eventArgs) return;
+ viewModel.HandleKeyUp(eventArgs);
}
}
\ No newline at end of file
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/FrequencyNavigation.axaml.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/FrequencyNavigation.axaml.cs
index 2dd96e5..74f0f2b 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/FrequencyNavigation.axaml.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/FrequencyNavigation.axaml.cs
@@ -1,12 +1,17 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
+using FileTime.App.Core.Services;
using FileTime.App.FrequencyNavigation.ViewModels;
+using FileTime.GuiApp.App.Extensions;
+using Microsoft.Extensions.DependencyInjection;
namespace FileTime.GuiApp.App.Views;
public partial class FrequencyNavigation : UserControl
{
+ private readonly Lazy> _appKeyService = new(() => DI.ServiceProvider.GetRequiredService>());
+
public FrequencyNavigation()
{
InitializeComponent();
@@ -34,14 +39,18 @@ public partial class FrequencyNavigation : UserControl
}
else
{
- viewModel.HandleKeyDown(e);
+ if (e.ToGeneralKeyEventArgs(_appKeyService.Value) is not { } eventArgs) return;
+
+ viewModel.HandleKeyDown(eventArgs);
}
}
private void Search_OnKeyUp(object? sender, KeyEventArgs e)
{
- if (e.Handled) return;
- if (DataContext is not IFrequencyNavigationViewModel viewModel) return;
- viewModel.HandleKeyUp(e);
+ if (e.Handled
+ || DataContext is not IFrequencyNavigationViewModel viewModel) return;
+
+ if (e.ToGeneralKeyEventArgs(_appKeyService.Value) is not { } eventArgs) return;
+ viewModel.HandleKeyUp(eventArgs);
}
}
\ No newline at end of file
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/MainWindow.axaml b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/MainWindow.axaml
index a4b2e61..544c051 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/MainWindow.axaml
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/MainWindow.axaml
@@ -23,6 +23,7 @@
xmlns:appCoreModels="using:FileTime.App.Core.Models"
xmlns:appInteractions="using:FileTime.App.Core.Interactions"
xmlns:config="using:FileTime.GuiApp.App.Configuration"
+ xmlns:configuration="clr-namespace:FileTime.App.Core.Configuration;assembly=FileTime.App.Core.Abstraction"
xmlns:corevm="using:FileTime.App.Core.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
@@ -764,7 +765,7 @@
-
+
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/ViewModels/GuiAppState.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/ViewModels/GuiAppState.cs
index 848e02f..5d9ffc9 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/ViewModels/GuiAppState.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/ViewModels/GuiAppState.cs
@@ -1,9 +1,10 @@
using System.Collections.ObjectModel;
using System.Reactive.Linq;
using System.Reactive.Subjects;
+using Avalonia.Input;
+using FileTime.App.Core.Configuration;
using FileTime.App.Core.ViewModels;
using FileTime.App.Core.ViewModels.Timeline;
-using FileTime.GuiApp.App.Configuration;
using FileTime.GuiApp.App.Models;
using FileTime.GuiApp.App.ViewModels;
using MvvmGen;
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.Font/Font/Startup.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.Font/Font/Startup.cs
index a45653c..72112a6 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp.Font/Font/Startup.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp.Font/Font/Startup.cs
@@ -3,7 +3,7 @@ using FileTime.GuiApp.App.Services;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-namespace FileTime.GuiApp.Font;
+namespace FileTime.GuiApp.App.Font;
public static class Startup
{
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/App.axaml.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/App.axaml.cs
index 3831a58..6336cd5 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp/App.axaml.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp/App.axaml.cs
@@ -6,9 +6,9 @@ using FileTime.App.DependencyInjection;
using FileTime.App.FrequencyNavigation;
using FileTime.App.Search;
using FileTime.GuiApp.App;
+using FileTime.GuiApp.App.Font;
using FileTime.GuiApp.App.ViewModels;
using FileTime.GuiApp.App.Views;
-using FileTime.GuiApp.Font;
using FileTime.Server.Common;
using FileTime.Tools.Compression;
using Microsoft.Extensions.DependencyInjection;
diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Startup.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/Startup.cs
index 429d708..e684ff8 100644
--- a/src/GuiApp/Avalonia/FileTime.GuiApp/Startup.cs
+++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Startup.cs
@@ -1,5 +1,7 @@
using System.IO;
using System.Runtime.InteropServices;
+using Avalonia.Input;
+using FileTime.App.Core.Configuration;
using FileTime.App.Core.Services;
using FileTime.App.Core.ViewModels;
using FileTime.Core.Interactions;
@@ -54,14 +56,13 @@ public static class Startup
serviceCollection.TryAddSingleton();
serviceCollection.TryAddSingleton();
serviceCollection.TryAddSingleton();
- serviceCollection.TryAddSingleton();
serviceCollection.TryAddSingleton();
- serviceCollection.TryAddSingleton();
serviceCollection.TryAddSingleton();
serviceCollection.TryAddSingleton();
serviceCollection.TryAddSingleton(sp => sp.GetRequiredService());
serviceCollection.TryAddSingleton();
serviceCollection.TryAddSingleton(s => s.GetRequiredService());
+ serviceCollection.TryAddSingleton, GuiAppKeyService>();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{