diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/Models/Keys.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Models/Keys.cs index 27b1a6b..eaddcde 100644 --- a/src/AppCommon/FileTime.App.Core.Abstraction/Models/Keys.cs +++ b/src/AppCommon/FileTime.App.Core.Abstraction/Models/Keys.cs @@ -55,4 +55,14 @@ public enum Keys Tab, LWin, RWin, + Num0, + Num1, + Num2, + Num3, + Num4, + Num5, + Num6, + Num7, + Num8, + Num9, } \ No newline at end of file diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Models/SpecialKeysStatus.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Models/SpecialKeysStatus.cs similarity index 70% rename from src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Models/SpecialKeysStatus.cs rename to src/AppCommon/FileTime.App.Core.Abstraction/Models/SpecialKeysStatus.cs index 87f43e4..4a42fd1 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Models/SpecialKeysStatus.cs +++ b/src/AppCommon/FileTime.App.Core.Abstraction/Models/SpecialKeysStatus.cs @@ -1,3 +1,3 @@ -namespace FileTime.GuiApp.App.Models; +namespace FileTime.App.Core.Models; public record SpecialKeysStatus(bool IsAltPressed, bool IsShiftPressed, bool IsCtrlPressed); \ No newline at end of file diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IDefaultModeKeyInputHandler.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IDefaultModeKeyInputHandler.cs similarity index 62% rename from src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IDefaultModeKeyInputHandler.cs rename to src/AppCommon/FileTime.App.Core.Abstraction/Services/IDefaultModeKeyInputHandler.cs index 514ac09..04b3b31 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IDefaultModeKeyInputHandler.cs +++ b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IDefaultModeKeyInputHandler.cs @@ -1,3 +1,3 @@ -namespace FileTime.GuiApp.App.Services; +namespace FileTime.App.Core.Services; public interface IDefaultModeKeyInputHandler : IKeyInputHandler { } \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/Services/IKeyInputHandler.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IKeyInputHandler.cs new file mode 100644 index 0000000..768af6e --- /dev/null +++ b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IKeyInputHandler.cs @@ -0,0 +1,8 @@ +using FileTime.App.Core.Models; + +namespace FileTime.App.Core.Services; + +public interface IKeyInputHandler +{ + Task HandleInputKey(Keys key, SpecialKeysStatus specialKeysStatus, Action setHandled); +} \ No newline at end of file diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IRapidTravelModeKeyInputHandler.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IRapidTravelModeKeyInputHandler.cs similarity index 64% rename from src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IRapidTravelModeKeyInputHandler.cs rename to src/AppCommon/FileTime.App.Core.Abstraction/Services/IRapidTravelModeKeyInputHandler.cs index 4e50eaa..451dba2 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IRapidTravelModeKeyInputHandler.cs +++ b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IRapidTravelModeKeyInputHandler.cs @@ -1,3 +1,3 @@ -namespace FileTime.GuiApp.App.Services; +namespace FileTime.App.Core.Services; public interface IRapidTravelModeKeyInputHandler : IKeyInputHandler { } \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/IAppState.cs b/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/IAppState.cs index b334c7e..40df07a 100644 --- a/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/IAppState.cs +++ b/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/IAppState.cs @@ -1,5 +1,6 @@ using System.Collections.ObjectModel; using DeclarativeProperty; +using FileTime.App.Core.Configuration; using FileTime.App.Core.Models.Enums; using FileTime.App.Core.ViewModels.Timeline; @@ -13,8 +14,10 @@ public interface IAppState IDeclarativeProperty ViewMode { get; } DeclarativeProperty RapidTravelText { get; } IDeclarativeProperty RapidTravelTextDebounced { get; } - ITimelineViewModel TimelineViewModel { get; } IDeclarativeProperty ContainerStatus { get; } + List PreviousKeys { get; } + List PossibleCommands { get; set; } + bool NoCommandFound { get; set; } void AddTab(ITabViewModel tabViewModel); void RemoveTab(ITabViewModel tabViewModel); diff --git a/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj b/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj index d9ce856..8d2cf9a 100644 --- a/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj +++ b/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj @@ -16,6 +16,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/DefaultModeKeyInputHandler.cs b/src/AppCommon/FileTime.App.Core/Services/DefaultModeKeyInputHandler.cs similarity index 90% rename from src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/DefaultModeKeyInputHandler.cs rename to src/AppCommon/FileTime.App.Core/Services/DefaultModeKeyInputHandler.cs index b5ffdb7..8d7956b 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/DefaultModeKeyInputHandler.cs +++ b/src/AppCommon/FileTime.App.Core/Services/DefaultModeKeyInputHandler.cs @@ -1,23 +1,19 @@ -using Avalonia.Input; -using FileTime.App.Core.Services; +using DeclarativeProperty; +using FileTime.App.Core.Configuration; +using FileTime.App.Core.Extensions; +using FileTime.App.Core.Models; using FileTime.App.Core.UserCommand; using FileTime.App.Core.ViewModels; using FileTime.Core.Extensions; using FileTime.Core.Models; using FileTime.Core.Models.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; +namespace FileTime.App.Core.Services; public class DefaultModeKeyInputHandler : IDefaultModeKeyInputHandler { - private readonly IGuiAppState _appState; + private readonly IAppState _appState; private readonly IModalService _modalService; private readonly IKeyboardConfigurationService _keyboardConfigurationService; private readonly List _keysToSkip = new(); @@ -25,21 +21,18 @@ 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( - IGuiAppState appState, + IAppState appState, IModalService modalService, IKeyboardConfigurationService keyboardConfigurationService, ILogger logger, IUserCommandHandlerService userCommandHandlerService, - IIdentifiableUserCommandService identifiableUserCommandService, - IAppKeyService appKeyService) + IIdentifiableUserCommandService identifiableUserCommandService) { _appState = appState; _identifiableUserCommandService = identifiableUserCommandService; - _appKeyService = appKeyService; _keyboardConfigurationService = keyboardConfigurationService; _logger = logger; _modalService = modalService; @@ -61,9 +54,8 @@ public class DefaultModeKeyInputHandler : IDefaultModeKeyInputHandler _keysToSkip.Add(new[] {new KeyConfig(Keys.RWin)}); } - public async Task HandleInputKey(Key key2, SpecialKeysStatus specialKeysStatus, Action setHandled) + public async Task HandleInputKey(Keys key, 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); @@ -72,7 +64,7 @@ public class DefaultModeKeyInputHandler : IDefaultModeKeyInputHandler if (key == Keys.Escape) { - var doGeneralReset = _appState.PreviousKeys.Count > 1 || _appState.IsAllShortcutVisible; + var doGeneralReset = _appState.PreviousKeys.Count > 1; if ((_openModals.Collection?.Count ?? 0) > 0) { @@ -106,7 +98,6 @@ public class DefaultModeKeyInputHandler : IDefaultModeKeyInputHandler if (doGeneralReset) { setHandled(true); - _appState.IsAllShortcutVisible = false; _appState.PreviousKeys.Clear(); _appState.PossibleCommands = new(); } diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/RapidTravelModeKeyInputHandler.cs b/src/AppCommon/FileTime.App.Core/Services/RapidTravelModeKeyInputHandler.cs similarity index 90% rename from src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/RapidTravelModeKeyInputHandler.cs rename to src/AppCommon/FileTime.App.Core/Services/RapidTravelModeKeyInputHandler.cs index 233194d..074641d 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/RapidTravelModeKeyInputHandler.cs +++ b/src/AppCommon/FileTime.App.Core/Services/RapidTravelModeKeyInputHandler.cs @@ -1,16 +1,13 @@ -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.GuiApp.App.Models; using Microsoft.Extensions.Logging; -namespace FileTime.GuiApp.App.Services; +namespace FileTime.App.Core.Services; public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler { @@ -22,7 +19,6 @@ 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; @@ -32,8 +28,7 @@ public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler IKeyboardConfigurationService keyboardConfigurationService, IUserCommandHandlerService userCommandHandlerService, ILogger logger, - IIdentifiableUserCommandService identifiableUserCommandService, - IAppKeyService appKeyService) + IIdentifiableUserCommandService identifiableUserCommandService) { _appState = appState; _modalService = modalService; @@ -41,7 +36,6 @@ public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler _userCommandHandlerService = userCommandHandlerService; _logger = logger; _identifiableUserCommandService = identifiableUserCommandService; - _appKeyService = appKeyService; _appState.SelectedTab.Subscribe(t => _selectedTab = t); @@ -59,9 +53,8 @@ public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler }); } - public async Task HandleInputKey(Key key2, SpecialKeysStatus specialKeysStatus, Action setHandled) + public async Task HandleInputKey(Keys key, SpecialKeysStatus specialKeysStatus, Action setHandled) { - if (_appKeyService.MapKey(key2) is not { } key) return; var keyString = key.ToString(); if (key == Keys.Escape) diff --git a/src/AppCommon/FileTime.App.Core/ViewModels/AppStateBase.cs b/src/AppCommon/FileTime.App.Core/ViewModels/AppStateBase.cs index e8ab5c2..94420a3 100644 --- a/src/AppCommon/FileTime.App.Core/ViewModels/AppStateBase.cs +++ b/src/AppCommon/FileTime.App.Core/ViewModels/AppStateBase.cs @@ -2,16 +2,16 @@ using System.Collections.ObjectModel; using System.Reactive.Linq; using System.Reactive.Subjects; using DeclarativeProperty; +using FileTime.App.Core.Configuration; using FileTime.App.Core.Models.Enums; using FileTime.App.Core.ViewModels.Timeline; using FileTime.Core.Models.Extensions; using MvvmGen; using MoreLinq; +using PropertyChanged.SourceGenerator; namespace FileTime.App.Core.ViewModels; -[ViewModel] -[Inject(typeof(ITimelineViewModel), "TimelineViewModel", PropertyAccessModifier = AccessModifier.Public)] public abstract partial class AppStateBase : IAppState { private readonly BehaviorSubject _searchText = new(null); @@ -29,8 +29,11 @@ public abstract partial class AppStateBase : IAppState public IDeclarativeProperty RapidTravelTextDebounced { get; private set; } public IDeclarativeProperty ContainerStatus { get; private set; } + [Notify] public List PreviousKeys { get; } = new(); + [Notify] public List PossibleCommands { get; set; } = new(); + [Notify] public bool NoCommandFound { get; set; } - partial void OnInitialize() + protected AppStateBase() { RapidTravelText = new(""); RapidTravelTextDebounced = RapidTravelText diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IKeyInputHandler.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IKeyInputHandler.cs deleted file mode 100644 index 1a52de9..0000000 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/Services/IKeyInputHandler.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Avalonia.Input; -using FileTime.GuiApp.App.Models; - -namespace FileTime.GuiApp.App.Services; - -public interface IKeyInputHandler -{ - Task HandleInputKey(Key key, SpecialKeysStatus specialKeysStatus, Action setHandled); -} \ 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 bbc4723..69a7f19 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/ViewModels/IGuiAppState.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App.Abstractions/ViewModels/IGuiAppState.cs @@ -1,5 +1,4 @@ using System.Collections.ObjectModel; -using FileTime.App.Core.Configuration; using FileTime.App.Core.ViewModels; using FileTime.GuiApp.App.Models; @@ -7,10 +6,6 @@ namespace FileTime.GuiApp.App.ViewModels; public interface IGuiAppState : IAppState { - List PreviousKeys { get; } - bool IsAllShortcutVisible { get; set; } - bool NoCommandFound { get; set; } - List PossibleCommands { get; set; } ObservableCollection RootDriveInfos { get; set; } IReadOnlyList Places { get; set; } ObservableCollection PopupTexts { get; } diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/GuiAppKeyService.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/GuiAppKeyService.cs index aab92b8..a79d8f1 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/GuiAppKeyService.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/GuiAppKeyService.cs @@ -2,7 +2,6 @@ using Avalonia.Input; using FileTime.App.Core.Models; using FileTime.App.Core.Services; -using FileTime.GuiApp.App.Models; namespace FileTime.GuiApp.App.Services; @@ -55,6 +54,16 @@ public class GuiAppKeyService : IAppKeyService {Key.F10, Keys.F10}, {Key.F11, Keys.F11}, {Key.F12, Keys.F12}, + {Key.D0, Keys.Num0}, + {Key.D1, Keys.Num1}, + {Key.D2, Keys.Num2}, + {Key.D3, Keys.Num3}, + {Key.D4, Keys.Num4}, + {Key.D5, Keys.Num5}, + {Key.D6, Keys.Num6}, + {Key.D7, Keys.Num7}, + {Key.D8, Keys.Num8}, + {Key.D9, Keys.Num9}, {Key.Up, Keys.Up}, {Key.Down, Keys.Down}, {Key.Left, Keys.Left}, diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/KeyInputHandlerService.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/KeyInputHandlerService.cs index da97804..f460049 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/KeyInputHandlerService.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Services/KeyInputHandlerService.cs @@ -1,5 +1,7 @@ using Avalonia.Input; +using FileTime.App.Core.Models; using FileTime.App.Core.Models.Enums; +using FileTime.App.Core.Services; using FileTime.GuiApp.App.Models; using FileTime.GuiApp.App.ViewModels; @@ -10,8 +12,10 @@ public class KeyInputHandlerService : IKeyInputHandlerService private readonly IGuiAppState _appState; private readonly IDefaultModeKeyInputHandler _defaultModeKeyInputHandler; private readonly IRapidTravelModeKeyInputHandler _rapidTravelModeKeyInputHandler; + private readonly IAppKeyService _appKeyService; private ViewMode _viewMode; private GuiPanel _activePanel; + private readonly Dictionary<(GuiPanel, Key), GuiPanel> _panelMovements = new() { [(GuiPanel.FileBrowser, Key.Up)] = GuiPanel.Timeline, @@ -21,12 +25,13 @@ public class KeyInputHandlerService : IKeyInputHandlerService public KeyInputHandlerService( IGuiAppState appState, IDefaultModeKeyInputHandler defaultModeKeyInputHandler, - IRapidTravelModeKeyInputHandler rapidTravelModeKeyInputHandler - ) + IRapidTravelModeKeyInputHandler rapidTravelModeKeyInputHandler, + IAppKeyService appKeyService) { _appState = appState; _defaultModeKeyInputHandler = defaultModeKeyInputHandler; _rapidTravelModeKeyInputHandler = rapidTravelModeKeyInputHandler; + _appKeyService = appKeyService; appState.ViewMode.Subscribe(v => _viewMode = v); appState.ActivePanel.Subscribe(p => _activePanel = p); @@ -51,8 +56,8 @@ public class KeyInputHandlerService : IKeyInputHandlerService var isCtrlPressed = (keyModifiers & KeyModifiers.Control) == KeyModifiers.Control; if (isCtrlPressed - && key is Key.Left or Key.Right or Key.Up or Key.Down - && _panelMovements.TryGetValue((_activePanel, key), out var newPanel)) + && key is Key.Left or Key.Right or Key.Up or Key.Down + && _panelMovements.TryGetValue((_activePanel, key), out var newPanel)) { _appState.SetActivePanel(newPanel); setHandled(true); @@ -65,11 +70,17 @@ public class KeyInputHandlerService : IKeyInputHandlerService { if (_viewMode == ViewMode.Default) { - await _defaultModeKeyInputHandler.HandleInputKey(key, specialKeyStatus, setHandled); + if (_appKeyService.MapKey(key) is { } mappedKey) + { + await _defaultModeKeyInputHandler.HandleInputKey(mappedKey, specialKeyStatus, setHandled); + } } else { - await _rapidTravelModeKeyInputHandler.HandleInputKey(key, specialKeyStatus, setHandled); + if (_appKeyService.MapKey(key) is { } mappedKey) + { + await _rapidTravelModeKeyInputHandler.HandleInputKey(mappedKey, specialKeyStatus, setHandled); + } } } else if (_activePanel == GuiPanel.Timeline) @@ -85,4 +96,4 @@ public class KeyInputHandlerService : IKeyInputHandlerService // await HandleFavoritesKey(key, specialKeyStatus, setHandled); } } -} +} \ No newline at end of file diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/IMainWindowViewModel.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/IMainWindowViewModel.cs index 0f786ea..a27efe8 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/IMainWindowViewModel.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/IMainWindowViewModel.cs @@ -1,6 +1,7 @@ using FileTime.App.CommandPalette.Services; using FileTime.App.Core.Services; using FileTime.App.Core.ViewModels; +using FileTime.App.Core.ViewModels.Timeline; using FileTime.App.FrequencyNavigation.Services; using FileTime.GuiApp.App.Services; using FileTime.Providers.LocalAdmin; @@ -17,5 +18,6 @@ public interface IMainWindowViewModel : IMainWindowViewModelBase IRefreshSmoothnessCalculator RefreshSmoothnessCalculator { get; } IAdminElevationManager AdminElevationManager { get; } IClipboardService ClipboardService { get; } + ITimelineViewModel TimelineViewModel { get; } Task RunOrOpenItem(IItemViewModel itemViewModel); } \ No newline at end of file diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/MainWindowViewModel.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/MainWindowViewModel.cs index 5407e73..c9bfed5 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/MainWindowViewModel.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/ViewModels/MainWindowViewModel.cs @@ -6,6 +6,7 @@ using FileTime.App.CommandPalette.Services; using FileTime.App.Core.Services; using FileTime.App.Core.UserCommand; using FileTime.App.Core.ViewModels; +using FileTime.App.Core.ViewModels.Timeline; using FileTime.App.FrequencyNavigation.Services; using FileTime.Core.Models; using FileTime.Core.Timeline; @@ -35,6 +36,7 @@ namespace FileTime.GuiApp.App.ViewModels; [Inject(typeof(IAdminElevationManager), PropertyAccessModifier = AccessModifier.Public)] [Inject(typeof(IClipboardService), PropertyAccessModifier = AccessModifier.Public)] [Inject(typeof(IModalService), PropertyName = "_modalService")] +[Inject(typeof(ITimelineViewModel), PropertyAccessModifier = AccessModifier.Public)] public partial class MainWindowViewModel : IMainWindowViewModel { public bool Loading => false; @@ -63,7 +65,7 @@ public partial class MainWindowViewModel : IMainWindowViewModel #if DEBUG title += " (Debug)"; #endif - + Title.SetValueSafe(title); _modalService.AllModalClosed += (_, _) => FocusDefaultElement?.Invoke(); @@ -71,7 +73,7 @@ public partial class MainWindowViewModel : IMainWindowViewModel Task.Run(async () => await _lifecycleService.InitStartupHandlersAsync()).Wait(); } - public void ProcessKeyDown(Key key, KeyModifiers keyModifiers, Action setHandled) + public void ProcessKeyDown(Key key, KeyModifiers keyModifiers, Action setHandled) => _keyInputHandlerService.ProcessKeyDown(key, keyModifiers, setHandled); public async Task OpenContainerByFullName(FullName fullName) @@ -89,6 +91,6 @@ public partial class MainWindowViewModel : IMainWindowViewModel Item = itemViewModel }); - public async Task OnExit() + public async Task OnExit() => await _lifecycleService.ExitAsync(); } \ 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 544c051..f17274b 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/MainWindow.axaml +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/Views/MainWindow.axaml @@ -323,7 +323,7 @@ diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/FileTime.GuiApp.CustomImpl.csproj b/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/FileTime.GuiApp.CustomImpl.csproj index 9e337c3..22dfdd5 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/FileTime.GuiApp.CustomImpl.csproj +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/FileTime.GuiApp.CustomImpl.csproj @@ -15,4 +15,11 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/ViewModels/GuiAppState.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/ViewModels/GuiAppState.cs index 5d9ffc9..103c595 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/ViewModels/GuiAppState.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.CustomImpl/ViewModels/GuiAppState.cs @@ -8,30 +8,26 @@ using FileTime.App.Core.ViewModels.Timeline; using FileTime.GuiApp.App.Models; using FileTime.GuiApp.App.ViewModels; using MvvmGen; +using PropertyChanged.SourceGenerator; namespace FileTime.GuiApp.CustomImpl.ViewModels; -[ViewModel(GenerateConstructor = false)] public partial class GuiAppState : AppStateBase, IGuiAppState, IDisposable { private readonly BehaviorSubject _activePanel = new(GuiPanel.FileBrowser); - public GuiAppState(ITimelineViewModel timelineViewModel) : base(timelineViewModel) + public GuiAppState() { ActivePanel = _activePanel.AsObservable(); } - [Property] private bool _isAllShortcutVisible; + [Notify] private bool _noCommandFound; - [Property] private bool _noCommandFound; + [Notify] private List _possibleCommands = new(); - [Property] private List _possibleCommands = new(); + [Notify] private ObservableCollection _rootDriveInfos = new(); - [Property] private ObservableCollection _rootDriveInfos = new(); - - [Property] private IReadOnlyList _places = new List(); - - public List PreviousKeys { get; } = new(); + [Notify] private IReadOnlyList _places = new List(); public ObservableCollection PopupTexts { get; } = new(); public IObservable ActivePanel { get; } diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.DesignPreview/Services/GuiAppStatePreview.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.DesignPreview/Services/GuiAppStatePreview.cs index 36101c7..5352445 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.DesignPreview/Services/GuiAppStatePreview.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.DesignPreview/Services/GuiAppStatePreview.cs @@ -38,7 +38,6 @@ public void AddTab(ITabViewModel tabViewModel) => throw new NotImplementedException(); public List PreviousKeys { get; } - public bool IsAllShortcutVisible { get; set; } public bool NoCommandFound { get; set; } public List PossibleCommands { get; set; } public BindedCollection RootDriveInfos { get; set; }