CommandPalette WIP

This commit is contained in:
2023-05-22 09:29:41 +02:00
parent 2fe362ad6e
commit 0ed161c819
59 changed files with 536 additions and 276 deletions

View File

@@ -16,4 +16,6 @@ public class IdentifiableUserCommandService : IIdentifiableUserCommandService
return _identifiableUserCommands[identifier].Invoke();
}
public IReadOnlyCollection<string> GetCommandIdentifiers() => _identifiableUserCommands.Keys.ToList();
}

View File

@@ -1,5 +1,4 @@
using System.Reactive.Linq;
using FileTime.App.Core.Models;
using FileTime.App.Core.Models.Enums;
using FileTime.App.Core.UserCommand;
using FileTime.App.Core.ViewModels;

View File

@@ -1,3 +1,4 @@
using FileTime.App.CommandPalette.Services;
using FileTime.App.Core.Extensions;
using FileTime.App.Core.Models.Enums;
using FileTime.App.Core.UserCommand;
@@ -22,6 +23,7 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
private readonly ITimelessContentProvider _timelessContentProvider;
private readonly IUserCommunicationService _userCommunicationService;
private readonly IFrequencyNavigationService _frequencyNavigationService;
private readonly ICommandPaletteService _commandPaletteService;
private ITabViewModel? _selectedTab;
private IContainer? _currentLocation;
private IItemViewModel? _currentSelectedItem;
@@ -35,7 +37,8 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
IUserCommandHandlerService userCommandHandlerService,
ITimelessContentProvider timelessContentProvider,
IUserCommunicationService userCommunicationService,
IFrequencyNavigationService frequencyNavigationService) : base(appState)
IFrequencyNavigationService frequencyNavigationService,
ICommandPaletteService commandPaletteService) : base(appState)
{
_appState = appState;
_serviceProvider = serviceProvider;
@@ -44,6 +47,7 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
_timelessContentProvider = timelessContentProvider;
_userCommunicationService = userCommunicationService;
_frequencyNavigationService = frequencyNavigationService;
_commandPaletteService = commandPaletteService;
SaveSelectedTab(t => _selectedTab = t);
SaveCurrentSelectedItem(i => _currentSelectedItem = i);
@@ -69,6 +73,7 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
new TypeUserCommandHandler<MoveCursorToLastCommand>(MoveCursorToLast),
new TypeUserCommandHandler<MoveCursorUpCommand>(MoveCursorUp),
new TypeUserCommandHandler<MoveCursorUpPageCommand>(MoveCursorUpPage),
new TypeUserCommandHandler<OpenCommandPaletteCommand>(OpenCommandPalette),
new TypeUserCommandHandler<OpenContainerCommand>(OpenContainer),
new TypeUserCommandHandler<OpenSelectedCommand>(OpenSelected),
new TypeUserCommandHandler<RefreshCommand>(Refresh),
@@ -76,6 +81,12 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
});
}
private Task OpenCommandPalette()
{
_commandPaletteService.OpenCommandPalette();
return Task.CompletedTask;
}
private Task GoByFrequency()
{
_frequencyNavigationService.OpenNavigationWindow();

View File

@@ -1,6 +1,4 @@
using System.Diagnostics;
using System.Security.Cryptography;
using System.Text;
using FileTime.App.Core.UserCommand;
using FileTime.App.Core.ViewModels;
using FileTime.App.Search;