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 new file mode 100644 index 0000000..2da1ed9 --- /dev/null +++ b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/FileTime.App.CommandPalette.Abstractions.csproj @@ -0,0 +1,18 @@ + + + + net7.0 + enable + enable + FileTime.App.CommandPalette + + + + + + + + + + + diff --git a/src/AppCommon/FileTime.App.CommandPalette.Abstractions/Models/ICommandPaletteEntry.cs b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/Models/ICommandPaletteEntry.cs new file mode 100644 index 0000000..d376e9f --- /dev/null +++ b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/Models/ICommandPaletteEntry.cs @@ -0,0 +1,8 @@ +namespace FileTime.App.CommandPalette.Models; + +public interface ICommandPaletteEntry +{ + string Identifier { get; } + string Title { get; } + +} \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.CommandPalette.Abstractions/Services/ICommandPaletteService.cs b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/Services/ICommandPaletteService.cs new file mode 100644 index 0000000..861f4a6 --- /dev/null +++ b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/Services/ICommandPaletteService.cs @@ -0,0 +1,12 @@ +using FileTime.App.CommandPalette.Models; +using FileTime.App.CommandPalette.ViewModels; + +namespace FileTime.App.CommandPalette.Services; + +public interface ICommandPaletteService +{ + IObservable ShowWindow { get; } + void OpenCommandPalette(); + IReadOnlyList GetCommands(); + ICommandPaletteViewModel? CurrentModal { get; } +} \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.CommandPalette.Abstractions/ViewModels/ICommandPaletteEntryViewModel.cs b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/ViewModels/ICommandPaletteEntryViewModel.cs new file mode 100644 index 0000000..eebf2fd --- /dev/null +++ b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/ViewModels/ICommandPaletteEntryViewModel.cs @@ -0,0 +1,7 @@ +namespace FileTime.App.CommandPalette.ViewModels; + +public interface ICommandPaletteEntryViewModel +{ + string Identifier { get; set; } + string Title { get; set; } +} \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.CommandPalette.Abstractions/ViewModels/ICommandPaletteViewModel.cs b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/ViewModels/ICommandPaletteViewModel.cs new file mode 100644 index 0000000..3e8b3f0 --- /dev/null +++ b/src/AppCommon/FileTime.App.CommandPalette.Abstractions/ViewModels/ICommandPaletteViewModel.cs @@ -0,0 +1,14 @@ +using Avalonia.Input; +using FileTime.App.Core.ViewModels; + +namespace FileTime.App.CommandPalette.ViewModels; + +public interface ICommandPaletteViewModel : IModalViewModel +{ + IObservable ShowWindow { get; } + List FilteredMatches { get; } + string SearchText { get; set; } + ICommandPaletteEntryViewModel SelectedItem { get; set; } + void Close(); + void HandleKeyDown(KeyEventArgs 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 new file mode 100644 index 0000000..36e5f38 --- /dev/null +++ b/src/AppCommon/FileTime.App.CommandPalette/FileTime.App.CommandPalette.csproj @@ -0,0 +1,23 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/src/AppCommon/FileTime.App.CommandPalette/Models/CommandPaletteEntry.cs b/src/AppCommon/FileTime.App.CommandPalette/Models/CommandPaletteEntry.cs new file mode 100644 index 0000000..1acac6e --- /dev/null +++ b/src/AppCommon/FileTime.App.CommandPalette/Models/CommandPaletteEntry.cs @@ -0,0 +1,13 @@ +namespace FileTime.App.CommandPalette.Models; + +public class CommandPaletteEntry : ICommandPaletteEntry +{ + public string Identifier { get; } + public string Title { get; } + + public CommandPaletteEntry(string identifier, string title) + { + Identifier = identifier; + Title = title; + } +} \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.CommandPalette/Services/CommandPaletteService.cs b/src/AppCommon/FileTime.App.CommandPalette/Services/CommandPaletteService.cs new file mode 100644 index 0000000..36995b5 --- /dev/null +++ b/src/AppCommon/FileTime.App.CommandPalette/Services/CommandPaletteService.cs @@ -0,0 +1,37 @@ +using System.Reactive.Linq; +using System.Reactive.Subjects; +using FileTime.App.CommandPalette.Models; +using FileTime.App.CommandPalette.ViewModels; +using FileTime.App.Core.Services; +using PropertyChanged.SourceGenerator; + +namespace FileTime.App.CommandPalette.Services; + +public partial class CommandPaletteService : ICommandPaletteService +{ + private readonly IModalService _modalService; + private readonly IIdentifiableUserCommandService _identifiableUserCommandService; + private readonly BehaviorSubject _showWindow = new(false); + IObservable ICommandPaletteService.ShowWindow => _showWindow.AsObservable(); + [Notify] ICommandPaletteViewModel? _currentModal; + + public CommandPaletteService( + IModalService modalService, + IIdentifiableUserCommandService identifiableUserCommandService) + { + _modalService = modalService; + _identifiableUserCommandService = identifiableUserCommandService; + } + public void OpenCommandPalette() + { + _showWindow.OnNext(true); + CurrentModal = _modalService.OpenModal(); + } + + public IReadOnlyList GetCommands() => + _identifiableUserCommandService + .GetCommandIdentifiers() + .Select(c => new CommandPaletteEntry(c, c)) + .ToList() + .AsReadOnly(); +} \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.CommandPalette/Startup.cs b/src/AppCommon/FileTime.App.CommandPalette/Startup.cs new file mode 100644 index 0000000..203efc0 --- /dev/null +++ b/src/AppCommon/FileTime.App.CommandPalette/Startup.cs @@ -0,0 +1,16 @@ +using FileTime.App.CommandPalette.Services; +using FileTime.App.CommandPalette.ViewModels; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; + +namespace FileTime.App.CommandPalette; + +public static class Startup +{ + public static IServiceCollection AddCommandPalette(this IServiceCollection services) + { + services.TryAddTransient(); + services.TryAddSingleton(); + return services; + } +} \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.CommandPalette/ViewModels/CommandPaletteEntryViewModel.cs b/src/AppCommon/FileTime.App.CommandPalette/ViewModels/CommandPaletteEntryViewModel.cs new file mode 100644 index 0000000..14c0e1b --- /dev/null +++ b/src/AppCommon/FileTime.App.CommandPalette/ViewModels/CommandPaletteEntryViewModel.cs @@ -0,0 +1,16 @@ +using MvvmGen; + +namespace FileTime.App.CommandPalette.ViewModels; + +[ViewModel] +public partial class CommandPaletteEntryViewModel : ICommandPaletteEntryViewModel +{ + [Property] private string _identifier; + [Property] private string _title; + + public CommandPaletteEntryViewModel(string identifier, string title) + { + _identifier = identifier; + _title = title; + } +} \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.CommandPalette/ViewModels/CommandPaletteViewModel.cs b/src/AppCommon/FileTime.App.CommandPalette/ViewModels/CommandPaletteViewModel.cs new file mode 100644 index 0000000..079d53e --- /dev/null +++ b/src/AppCommon/FileTime.App.CommandPalette/ViewModels/CommandPaletteViewModel.cs @@ -0,0 +1,59 @@ +using Avalonia.Input; +using FileTime.App.CommandPalette.Services; +using FileTime.App.Core.ViewModels; +using MvvmGen; + +namespace FileTime.App.CommandPalette.ViewModels; + +[ViewModel] +[Inject(typeof(ICommandPaletteService), "_commandPaletteService")] +public partial class CommandPaletteViewModel : ICommandPaletteViewModel +{ + private string _searchText; + + [Property] private IObservable _showWindow; + [Property] private List _filteredMatches; + [Property] private ICommandPaletteEntryViewModel? _selectedItem; + string IModalViewModel.Name => "CommandPalette"; + + public string SearchText + { + get => _searchText; + set + { + if (_searchText == value) return; + + _searchText = value; + OnPropertyChanged(); + + UpdateFilteredMatches(); + } + } + + public void Close() => throw new NotImplementedException(); + + public void HandleKeyDown(KeyEventArgs keyEventArgs) => throw new NotImplementedException(); + + partial void OnInitialize() + { + ShowWindow = _commandPaletteService.ShowWindow; + UpdateFilteredMatches(); + } + + private void UpdateFilteredMatches() + { + FilteredMatches = _commandPaletteService + .GetCommands() + .Select(c => + (ICommandPaletteEntryViewModel) new CommandPaletteEntryViewModel(c.Identifier, c.Title)) + .Take(30) // TODO remove magic number + .OrderBy(c => c.Title) + .ToList(); + + if (SelectedItem != null && FilteredMatches.Contains(SelectedItem)) return; + + SelectedItem = FilteredMatches.Count > 0 + ? FilteredMatches[0] + : null; + } +} \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/Extensions/DisposableExtensions.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Extensions/DisposableExtensions.cs index 86e89c0..ef91c41 100644 --- a/src/AppCommon/FileTime.App.Core.Abstraction/Extensions/DisposableExtensions.cs +++ b/src/AppCommon/FileTime.App.Core.Abstraction/Extensions/DisposableExtensions.cs @@ -1,5 +1,3 @@ -using System.Collections.ObjectModel; - namespace FileTime.App.Core.Extensions; public static class DisposableExtensions diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/Services/IIdentifiableUserCommandService.cs b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IIdentifiableUserCommandService.cs index 631f2e9..48d53c5 100644 --- a/src/AppCommon/FileTime.App.Core.Abstraction/Services/IIdentifiableUserCommandService.cs +++ b/src/AppCommon/FileTime.App.Core.Abstraction/Services/IIdentifiableUserCommandService.cs @@ -6,4 +6,5 @@ public interface IIdentifiableUserCommandService { void AddIdentifiableUserCommandFactory(string identifier, Func commandFactory); IIdentifiableUserCommand GetCommand(string identifier); + IReadOnlyCollection GetCommandIdentifiers(); } \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/UserCommand/IIdentifiableUserCommand.cs b/src/AppCommon/FileTime.App.Core.Abstraction/UserCommand/IIdentifiableUserCommand.cs index 2c0987c..4cfd70d 100644 --- a/src/AppCommon/FileTime.App.Core.Abstraction/UserCommand/IIdentifiableUserCommand.cs +++ b/src/AppCommon/FileTime.App.Core.Abstraction/UserCommand/IIdentifiableUserCommand.cs @@ -3,4 +3,5 @@ namespace FileTime.App.Core.UserCommand; public interface IIdentifiableUserCommand : IUserCommand { string UserCommandID { get; } + //string Title { get; } } \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/UserCommand/OpenCommandPaletteCommand.cs b/src/AppCommon/FileTime.App.Core.Abstraction/UserCommand/OpenCommandPaletteCommand.cs new file mode 100644 index 0000000..459b8e6 --- /dev/null +++ b/src/AppCommon/FileTime.App.Core.Abstraction/UserCommand/OpenCommandPaletteCommand.cs @@ -0,0 +1,13 @@ +namespace FileTime.App.Core.UserCommand; + +public class OpenCommandPaletteCommand : IIdentifiableUserCommand +{ + public const string CommandName = "open_command_palette"; + public static OpenCommandPaletteCommand Instance { get; } = new (); + + private OpenCommandPaletteCommand() + { + } + + public string UserCommandID => CommandName; +} \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/ITabViewModel.cs b/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/ITabViewModel.cs index a9e2612..8f0bf32 100644 --- a/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/ITabViewModel.cs +++ b/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/ITabViewModel.cs @@ -1,6 +1,5 @@ using DynamicData; -using FileTime.App.Core.Models; using FileTime.Core.Models; using FileTime.Core.Services; using InitableService; diff --git a/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/Timeline/IParallelCommandsViewModel.cs b/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/Timeline/IParallelCommandsViewModel.cs index 0580987..251cede 100644 --- a/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/Timeline/IParallelCommandsViewModel.cs +++ b/src/AppCommon/FileTime.App.Core.Abstraction/ViewModels/Timeline/IParallelCommandsViewModel.cs @@ -1,5 +1,4 @@ using FileTime.Core.Models; -using FileTime.Core.Timeline; namespace FileTime.App.Core.ViewModels.Timeline; diff --git a/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj b/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj index ffbea3b..5646bdb 100644 --- a/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj +++ b/src/AppCommon/FileTime.App.Core/FileTime.App.Core.csproj @@ -23,6 +23,8 @@ + + diff --git a/src/AppCommon/FileTime.App.Core/Services/ItemPreviewService.cs b/src/AppCommon/FileTime.App.Core/Services/ItemPreviewService.cs index dd0bf4e..7b9fa0a 100644 --- a/src/AppCommon/FileTime.App.Core/Services/ItemPreviewService.cs +++ b/src/AppCommon/FileTime.App.Core/Services/ItemPreviewService.cs @@ -3,7 +3,6 @@ using FileTime.App.Core.ViewModels; using FileTime.App.Core.ViewModels.ItemPreview; using FileTime.Core.Models; using InitableService; -using Microsoft.Extensions.DependencyInjection; namespace FileTime.App.Core.Services; diff --git a/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/IdentifiableUserCommandService.cs b/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/IdentifiableUserCommandService.cs index a1a0c7b..aa37ac7 100644 --- a/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/IdentifiableUserCommandService.cs +++ b/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/IdentifiableUserCommandService.cs @@ -16,4 +16,6 @@ public class IdentifiableUserCommandService : IIdentifiableUserCommandService return _identifiableUserCommands[identifier].Invoke(); } + + public IReadOnlyCollection GetCommandIdentifiers() => _identifiableUserCommands.Keys.ToList(); } \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/ItemManipulationUserCommandHandlerService.cs b/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/ItemManipulationUserCommandHandlerService.cs index 2565379..ad96bd8 100644 --- a/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/ItemManipulationUserCommandHandlerService.cs +++ b/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/ItemManipulationUserCommandHandlerService.cs @@ -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; diff --git a/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/NavigationUserCommandHandlerService.cs b/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/NavigationUserCommandHandlerService.cs index 55c57f1..cf685e6 100644 --- a/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/NavigationUserCommandHandlerService.cs +++ b/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/NavigationUserCommandHandlerService.cs @@ -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(MoveCursorToLast), new TypeUserCommandHandler(MoveCursorUp), new TypeUserCommandHandler(MoveCursorUpPage), + new TypeUserCommandHandler(OpenCommandPalette), new TypeUserCommandHandler(OpenContainer), new TypeUserCommandHandler(OpenSelected), new TypeUserCommandHandler(Refresh), @@ -76,6 +81,12 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase }); } + private Task OpenCommandPalette() + { + _commandPaletteService.OpenCommandPalette(); + return Task.CompletedTask; + } + private Task GoByFrequency() { _frequencyNavigationService.OpenNavigationWindow(); diff --git a/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/ToolUserCommandHandlerService.cs b/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/ToolUserCommandHandlerService.cs index 45ed290..0e8b15b 100644 --- a/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/ToolUserCommandHandlerService.cs +++ b/src/AppCommon/FileTime.App.Core/Services/UserCommandHandler/ToolUserCommandHandlerService.cs @@ -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; diff --git a/src/AppCommon/FileTime.App.Core/Startup.cs b/src/AppCommon/FileTime.App.Core/Startup.cs index e4ecf20..2b18cde 100644 --- a/src/AppCommon/FileTime.App.Core/Startup.cs +++ b/src/AppCommon/FileTime.App.Core/Startup.cs @@ -1,3 +1,4 @@ +using FileTime.App.CommandPalette.ViewModels; using FileTime.App.Core.Services; using FileTime.App.Core.Services.UserCommandHandler; using FileTime.App.Core.StartupServices; @@ -25,6 +26,7 @@ public static class Startup serviceCollection.TryAddSingleton(); serviceCollection.TryAddSingleton(); serviceCollection.TryAddSingleton(); + serviceCollection.TryAddSingleton(); return serviceCollection .AddCommandHandlers() diff --git a/src/AppCommon/FileTime.App.Core/StartupServices/DefaultIdentifiableCommandHandlerRegister.cs b/src/AppCommon/FileTime.App.Core/StartupServices/DefaultIdentifiableCommandHandlerRegister.cs index 5aa239c..7476a9f 100644 --- a/src/AppCommon/FileTime.App.Core/StartupServices/DefaultIdentifiableCommandHandlerRegister.cs +++ b/src/AppCommon/FileTime.App.Core/StartupServices/DefaultIdentifiableCommandHandlerRegister.cs @@ -5,11 +5,11 @@ namespace FileTime.App.Core.StartupServices; public class DefaultIdentifiableCommandHandlerRegister : IStartupHandler { - private readonly IIdentifiableUserCommandService _service; + private readonly IIdentifiableUserCommandService _userCommandHandlerService; - public DefaultIdentifiableCommandHandlerRegister(IIdentifiableUserCommandService service) + public DefaultIdentifiableCommandHandlerRegister(IIdentifiableUserCommandService userCommandHandlerService) { - _service = service; + _userCommandHandlerService = userCommandHandlerService; AddUserCommand(CloseTabCommand.Instance); AddUserCommand(CopyCommand.Instance); @@ -34,6 +34,7 @@ public class DefaultIdentifiableCommandHandlerRegister : IStartupHandler AddUserCommand(MoveCursorToLastCommand.Instance); AddUserCommand(MoveCursorUpCommand.Instance); AddUserCommand(MoveCursorUpPageCommand.Instance); + AddUserCommand(OpenCommandPaletteCommand.Instance); AddUserCommand(OpenInDefaultFileExplorerCommand.Instance); AddUserCommand(OpenSelectedCommand.Instance); AddUserCommand(PasteCommand.Merge); @@ -58,5 +59,5 @@ public class DefaultIdentifiableCommandHandlerRegister : IStartupHandler public Task InitAsync() => Task.CompletedTask; private void AddUserCommand(IIdentifiableUserCommand command) - => _service.AddIdentifiableUserCommandFactory(command.UserCommandID, () => command); + => _userCommandHandlerService.AddIdentifiableUserCommandFactory(command.UserCommandID, () => command); } \ No newline at end of file diff --git a/src/AppCommon/FileTime.App.Core/ViewModels/TabViewModel.cs b/src/AppCommon/FileTime.App.Core/ViewModels/TabViewModel.cs index 10b5966..fab67b0 100644 --- a/src/AppCommon/FileTime.App.Core/ViewModels/TabViewModel.cs +++ b/src/AppCommon/FileTime.App.Core/ViewModels/TabViewModel.cs @@ -2,7 +2,6 @@ using System.Reactive.Linq; using DynamicData; using DynamicData.Binding; using FileTime.App.Core.Extensions; -using FileTime.App.Core.Models; using FileTime.App.Core.Models.Enums; using FileTime.App.Core.Services; using FileTime.Core.Enums; diff --git a/src/AppCommon/FileTime.App.FrequencyNavigation/ViewModels/FrequencyNavigationViewModel.cs b/src/AppCommon/FileTime.App.FrequencyNavigation/ViewModels/FrequencyNavigationViewModel.cs index 0403f4f..14fd07d 100644 --- a/src/AppCommon/FileTime.App.FrequencyNavigation/ViewModels/FrequencyNavigationViewModel.cs +++ b/src/AppCommon/FileTime.App.FrequencyNavigation/ViewModels/FrequencyNavigationViewModel.cs @@ -19,7 +19,7 @@ public partial class FrequencyNavigationViewModel : IFrequencyNavigationViewMode [Property] private IObservable _showWindow; [Property] private List _filteredMatches; - [Property] private string _selectedItem; + [Property] private string? _selectedItem; public string SearchText { @@ -68,12 +68,12 @@ public partial class FrequencyNavigationViewModel : IFrequencyNavigationViewMode } partial void OnInitialize() - => _showWindow = _frequencyNavigationService.ShowWindow; + => ShowWindow = _frequencyNavigationService.ShowWindow; private void UpdateFilteredMatches() { FilteredMatches = new List(_frequencyNavigationService.GetMatchingContainers(_searchText)); - if (FilteredMatches.Contains(SelectedItem)) return; + if (SelectedItem != null && FilteredMatches.Contains(SelectedItem)) return; SelectedItem = FilteredMatches.Count > 0 ? FilteredMatches[0] diff --git a/src/AppCommon/FileTime.App.Search/SearchTask.cs b/src/AppCommon/FileTime.App.Search/SearchTask.cs index 48255c8..f6af12f 100644 --- a/src/AppCommon/FileTime.App.Search/SearchTask.cs +++ b/src/AppCommon/FileTime.App.Search/SearchTask.cs @@ -1,8 +1,6 @@ -using System.Reactive.Linq; using DynamicData; using FileTime.Core.ContentAccess; using FileTime.Core.Enums; -using FileTime.Core.Extensions; using FileTime.Core.Models; using FileTime.Core.Timeline; diff --git a/src/Core/FileTime.Core.Abstraction/Command/ICommandRunner.cs b/src/Core/FileTime.Core.Abstraction/Command/ICommandRunner.cs index cc8ee0b..87061a5 100644 --- a/src/Core/FileTime.Core.Abstraction/Command/ICommandRunner.cs +++ b/src/Core/FileTime.Core.Abstraction/Command/ICommandRunner.cs @@ -1,5 +1,3 @@ -using FileTime.Core.Timeline; - namespace FileTime.Core.Command; public interface ICommandRunner diff --git a/src/Core/FileTime.Core.Abstraction/Command/IExecutableCommand.cs b/src/Core/FileTime.Core.Abstraction/Command/IExecutableCommand.cs index 3f94c04..6af5683 100644 --- a/src/Core/FileTime.Core.Abstraction/Command/IExecutableCommand.cs +++ b/src/Core/FileTime.Core.Abstraction/Command/IExecutableCommand.cs @@ -1,5 +1,3 @@ -using FileTime.Core.Timeline; - namespace FileTime.Core.Command; public interface IExecutableCommand : ICommand diff --git a/src/Core/FileTime.Core.Abstraction/Models/IItem.cs b/src/Core/FileTime.Core.Abstraction/Models/IItem.cs index 43519df..186e6b6 100644 --- a/src/Core/FileTime.Core.Abstraction/Models/IItem.cs +++ b/src/Core/FileTime.Core.Abstraction/Models/IItem.cs @@ -1,4 +1,3 @@ -using System.Reactive.Linq; using DynamicData; using FileTime.Core.ContentAccess; using FileTime.Core.Enums; diff --git a/src/Core/FileTime.Core.Abstraction/Timeline/Difference.cs b/src/Core/FileTime.Core.Abstraction/Timeline/Difference.cs index c74d915..3f6415e 100644 --- a/src/Core/FileTime.Core.Abstraction/Timeline/Difference.cs +++ b/src/Core/FileTime.Core.Abstraction/Timeline/Difference.cs @@ -1,5 +1,4 @@ using FileTime.Core.Models; -using FileTime.Core.Services; namespace FileTime.Core.Timeline; diff --git a/src/Core/FileTime.Core.Command/Copy/CopyCommand.cs b/src/Core/FileTime.Core.Command/Copy/CopyCommand.cs index fca053b..9d9106f 100644 --- a/src/Core/FileTime.Core.Command/Copy/CopyCommand.cs +++ b/src/Core/FileTime.Core.Command/Copy/CopyCommand.cs @@ -1,5 +1,4 @@ using FileTime.Core.Enums; -using FileTime.Core.Extensions; using FileTime.Core.Models; using FileTime.Core.Timeline; diff --git a/src/Core/FileTime.Core.Command/Create/CreateItemBase.cs b/src/Core/FileTime.Core.Command/Create/CreateItemBase.cs index 086550b..0dd2d4f 100644 --- a/src/Core/FileTime.Core.Command/Create/CreateItemBase.cs +++ b/src/Core/FileTime.Core.Command/Create/CreateItemBase.cs @@ -1,6 +1,5 @@ using FileTime.Core.ContentAccess; using FileTime.Core.Enums; -using FileTime.Core.Extensions; using FileTime.Core.Models; using FileTime.Core.Timeline; using InitableService; diff --git a/src/Core/FileTime.Core.Command/Delete/DeleteCommand.cs b/src/Core/FileTime.Core.Command/Delete/DeleteCommand.cs index 9fe550d..fdd43d7 100644 --- a/src/Core/FileTime.Core.Command/Delete/DeleteCommand.cs +++ b/src/Core/FileTime.Core.Command/Delete/DeleteCommand.cs @@ -1,5 +1,4 @@ using FileTime.Core.ContentAccess; -using FileTime.Core.Extensions; using FileTime.Core.Models; using FileTime.Core.Timeline; diff --git a/src/Core/FileTime.Core.Command/Helper.cs b/src/Core/FileTime.Core.Command/Helper.cs index 01ffc7f..adffe9b 100644 --- a/src/Core/FileTime.Core.Command/Helper.cs +++ b/src/Core/FileTime.Core.Command/Helper.cs @@ -1,4 +1,3 @@ -using FileTime.Core.Extensions; using FileTime.Core.Models; namespace FileTime.Core.Command; diff --git a/src/Core/FileTime.Core.CommandHandlers/StreamCopyCommandHandler.cs b/src/Core/FileTime.Core.CommandHandlers/StreamCopyCommandHandler.cs index a07fddd..9fb04a5 100644 --- a/src/Core/FileTime.Core.CommandHandlers/StreamCopyCommandHandler.cs +++ b/src/Core/FileTime.Core.CommandHandlers/StreamCopyCommandHandler.cs @@ -1,7 +1,6 @@ using FileTime.Core.Command; using FileTime.Core.Command.Copy; using FileTime.Core.ContentAccess; -using FileTime.Core.Extensions; using FileTime.Core.Models; namespace FileTime.Core.CommandHandlers; diff --git a/src/FileTime.sln b/src/FileTime.sln index 4c07a38..6d28bdd 100644 --- a/src/FileTime.sln +++ b/src/FileTime.sln @@ -71,6 +71,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileTime.App.Search", "AppC EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileTime.App.Search.Abstractions", "AppCommon\FileTime.App.Search.Abstractions\FileTime.App.Search.Abstractions.csproj", "{D8D4A5C3-14B5-49E7-B029-D6E5D9574388}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileTime.App.CommandPalette", "AppCommon\FileTime.App.CommandPalette\FileTime.App.CommandPalette.csproj", "{D0CC03DA-4705-48BD-9C4F-B11545D8BC83}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileTime.App.CommandPalette.Abstractions", "AppCommon\FileTime.App.CommandPalette.Abstractions\FileTime.App.CommandPalette.Abstractions.csproj", "{5B3D2008-371F-485C-92C0-127F6CD64F64}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -181,6 +185,14 @@ Global {D8D4A5C3-14B5-49E7-B029-D6E5D9574388}.Debug|Any CPU.Build.0 = Debug|Any CPU {D8D4A5C3-14B5-49E7-B029-D6E5D9574388}.Release|Any CPU.ActiveCfg = Release|Any CPU {D8D4A5C3-14B5-49E7-B029-D6E5D9574388}.Release|Any CPU.Build.0 = Release|Any CPU + {D0CC03DA-4705-48BD-9C4F-B11545D8BC83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0CC03DA-4705-48BD-9C4F-B11545D8BC83}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0CC03DA-4705-48BD-9C4F-B11545D8BC83}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0CC03DA-4705-48BD-9C4F-B11545D8BC83}.Release|Any CPU.Build.0 = Release|Any CPU + {5B3D2008-371F-485C-92C0-127F6CD64F64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B3D2008-371F-485C-92C0-127F6CD64F64}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B3D2008-371F-485C-92C0-127F6CD64F64}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B3D2008-371F-485C-92C0-127F6CD64F64}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -213,6 +225,8 @@ Global {C1CA8B7E-F8E6-40AB-A45B-5EBEF6996290} = {A5291117-3001-498B-AC8B-E14F71F72570} {0D3C3584-242F-4DD6-A04A-2225A8AB6746} = {A5291117-3001-498B-AC8B-E14F71F72570} {D8D4A5C3-14B5-49E7-B029-D6E5D9574388} = {A5291117-3001-498B-AC8B-E14F71F72570} + {D0CC03DA-4705-48BD-9C4F-B11545D8BC83} = {A5291117-3001-498B-AC8B-E14F71F72570} + {5B3D2008-371F-485C-92C0-127F6CD64F64} = {A5291117-3001-498B-AC8B-E14F71F72570} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {859FB3DF-C60A-46B1-82E5-90274905D1EF} diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/Configuration/MainConfiguration.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/Configuration/MainConfiguration.cs index 013f85b..a055b05 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/Configuration/MainConfiguration.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/Configuration/MainConfiguration.cs @@ -71,6 +71,8 @@ public static class MainConfiguration new(MoveCursorToFirstCommand.CommandName, new[] {Key.G, Key.G}), //new CommandBindingConfiguration(ConfigCommand.NextTimelineBlock, Key.L ), //new CommandBindingConfiguration(ConfigCommand.NextTimelineCommand, Key.J ), + 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}), diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/Services/IDialogService.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/Services/IDialogService.cs index 4ab0ea6..aae4f25 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/Services/IDialogService.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/Services/IDialogService.cs @@ -1,4 +1,3 @@ -using FileTime.App.Core.Models; using FileTime.Core.Interactions; using FileTime.GuiApp.ViewModels; diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/ViewModels/IGuiAppState.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/ViewModels/IGuiAppState.cs index 7a644c6..7fd44ba 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/ViewModels/IGuiAppState.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.Abstractions/ViewModels/IGuiAppState.cs @@ -1,5 +1,4 @@ using System.Collections.ObjectModel; -using FileTime.App.Core.Models; using FileTime.App.Core.ViewModels; using FileTime.Core.Models; using FileTime.GuiApp.Configuration; diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/App.axaml.cs b/src/GuiApp/Avalonia/FileTime.GuiApp.App/App.axaml.cs index 4c2bc21..cd8b998 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/App.axaml.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/App.axaml.cs @@ -1,6 +1,7 @@ using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; +using FileTime.App.CommandPalette; using FileTime.App.DependencyInjection; using FileTime.App.FrequencyNavigation; using FileTime.App.Search; @@ -20,6 +21,7 @@ public partial class App : Application DI.ServiceProvider = DependencyInjection .RegisterDefaultServices() .AddFrequencyNavigation() + .AddCommandPalette() .AddSearch() .AddConfiguration(configuration) .ConfigureFont(configuration) diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp.App/FileTime.GuiApp.App.csproj b/src/GuiApp/Avalonia/FileTime.GuiApp.App/FileTime.GuiApp.App.csproj index bab9540..5b77c45 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp.App/FileTime.GuiApp.App.csproj +++ b/src/GuiApp/Avalonia/FileTime.GuiApp.App/FileTime.GuiApp.App.csproj @@ -38,6 +38,7 @@ + diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/FileTime.GuiApp.csproj b/src/GuiApp/Avalonia/FileTime.GuiApp/FileTime.GuiApp.csproj index 2daf6a9..461051e 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/FileTime.GuiApp.csproj +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/FileTime.GuiApp.csproj @@ -37,6 +37,7 @@ + diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/IconProviders/MaterialIconProvider.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/IconProviders/MaterialIconProvider.cs index 00782cc..2eef1f1 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/IconProviders/MaterialIconProvider.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/IconProviders/MaterialIconProvider.cs @@ -1,4 +1,3 @@ -using System.Runtime.InteropServices; using FileTime.Core.Models; using FileTime.GuiApp.Models; using FileTime.GuiApp.Services; diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/DefaultModeKeyInputHandler.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/DefaultModeKeyInputHandler.cs index c591c9a..f597edf 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/DefaultModeKeyInputHandler.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/DefaultModeKeyInputHandler.cs @@ -1,6 +1,5 @@ using System.Reactive.Linq; using Avalonia.Input; -using FileTime.App.Core.Models; using FileTime.App.Core.Services; using FileTime.App.Core.UserCommand; using FileTime.App.Core.ViewModels; diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/DialogService.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/DialogService.cs index 6019e7b..623b45b 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/DialogService.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/DialogService.cs @@ -1,8 +1,6 @@ -using System.Collections.ObjectModel; using System.Reactive.Linq; using Avalonia.Threading; using DynamicData; -using FileTime.App.Core.Models; using FileTime.App.Core.Services; using FileTime.Core.Interactions; using FileTime.GuiApp.ViewModels; diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/KeyboardConfigurationService.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/KeyboardConfigurationService.cs index fb554b4..eecfac9 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/KeyboardConfigurationService.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/KeyboardConfigurationService.cs @@ -1,4 +1,3 @@ -using System.Collections.ObjectModel; using FileTime.App.Core.UserCommand; using FileTime.GuiApp.Configuration; using Microsoft.Extensions.Options; diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/RapidTravelModeKeyInputHandler.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/RapidTravelModeKeyInputHandler.cs index 81ba155..cb88b3a 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/RapidTravelModeKeyInputHandler.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/RapidTravelModeKeyInputHandler.cs @@ -1,5 +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; diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/RootDriveInfoService.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/RootDriveInfoService.cs index 5ac647a..c77397c 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/RootDriveInfoService.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/RootDriveInfoService.cs @@ -1,12 +1,9 @@ -using System.Reactive.Linq; using System.Runtime.InteropServices; using DynamicData; using DynamicData.Binding; -using FileTime.App.Core.Models; using FileTime.App.Core.Services; using FileTime.Core.Extensions; using FileTime.Core.Models; -using FileTime.Core.Timeline; using FileTime.GuiApp.ViewModels; using FileTime.Providers.Local; diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/WindowsPlacesService.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/WindowsPlacesService.cs index 3891064..0f779e0 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/Services/WindowsPlacesService.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Services/WindowsPlacesService.cs @@ -1,5 +1,4 @@ using System.Runtime.InteropServices; -using FileTime.App.Core.Services; using FileTime.Core.Models; using FileTime.Core.Timeline; using FileTime.GuiApp.IconProviders; diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/ViewModels/MainWindowViewModel.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/ViewModels/MainWindowViewModel.cs index cd4ea5c..244fb6c 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/ViewModels/MainWindowViewModel.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/ViewModels/MainWindowViewModel.cs @@ -1,10 +1,10 @@ using System.Reactive.Linq; using System.Reflection; using Avalonia.Input; +using FileTime.App.CommandPalette.Services; using FileTime.App.Core.Services; using FileTime.App.Core.UserCommand; using FileTime.App.FrequencyNavigation.Services; -using FileTime.App.FrequencyNavigation.ViewModels; using FileTime.Core.Models; using FileTime.Core.Timeline; using FileTime.GuiApp.Services; @@ -27,6 +27,7 @@ namespace FileTime.GuiApp.ViewModels; [Inject(typeof(ITimelessContentProvider), PropertyName = "_timelessContentProvider")] [Inject(typeof(IFontService), "_fontService")] [Inject(typeof(IFrequencyNavigationService), PropertyAccessModifier = AccessModifier.Public)] +[Inject(typeof(ICommandPaletteService), PropertyAccessModifier = AccessModifier.Public)] public partial class MainWindowViewModel : IMainWindowViewModelBase { public bool Loading => false; diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Views/CommandPalette.axaml b/src/GuiApp/Avalonia/FileTime.GuiApp/Views/CommandPalette.axaml new file mode 100644 index 0000000..b6098e9 --- /dev/null +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Views/CommandPalette.axaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Views/CommandPalette.axaml.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/Views/CommandPalette.axaml.cs new file mode 100644 index 0000000..1b849e2 --- /dev/null +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Views/CommandPalette.axaml.cs @@ -0,0 +1,33 @@ +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Markup.Xaml; +using FileTime.App.FrequencyNavigation.ViewModels; + +namespace FileTime.GuiApp.Views; + +public partial class CommandPalette : UserControl +{ + public CommandPalette() + { + InitializeComponent(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } + + private void Search_OnKeyDown(object? sender, KeyEventArgs e) + { + if (DataContext is not IFrequencyNavigationViewModel viewModel) return; + + if (e.Key == Key.Escape) + { + viewModel.Close(); + } + else + { + viewModel.HandleKeyDown(e); + } + } +} \ No newline at end of file diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Views/FrequencyNavigation.axaml.cs b/src/GuiApp/Avalonia/FileTime.GuiApp/Views/FrequencyNavigation.axaml.cs index 7745e68..de21d8e 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/Views/FrequencyNavigation.axaml.cs +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Views/FrequencyNavigation.axaml.cs @@ -1,4 +1,3 @@ -using Avalonia; using Avalonia.Controls; using Avalonia.Input; using Avalonia.Markup.Xaml; diff --git a/src/GuiApp/Avalonia/FileTime.GuiApp/Views/MainWindow.axaml b/src/GuiApp/Avalonia/FileTime.GuiApp/Views/MainWindow.axaml index ed7b0e4..f714c93 100644 --- a/src/GuiApp/Avalonia/FileTime.GuiApp/Views/MainWindow.axaml +++ b/src/GuiApp/Avalonia/FileTime.GuiApp/Views/MainWindow.axaml @@ -1,7 +1,23 @@  + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> @@ -41,54 +41,36 @@ - + - + - + - + - + - + - + + CornerRadius="10" + Margin="10" + Padding="10"> - + - + + Width="20" /> + Orientation="Horizontal" + VerticalAlignment="Center"> + Text="{Binding FullName}" + VerticalAlignment="Center" /> + Margin="5,0,0,0" + Text="{Binding Label}" + VerticalAlignment="Center" /> + Orientation="Horizontal" + VerticalAlignment="Center"> + Text="{Binding Free, Converter={StaticResource FormatSizeConverter}, ConverterParameter=0}" + VerticalAlignment="Center" /> + Text=" / " + VerticalAlignment="Center" /> + Text="{Binding Size, Converter={StaticResource FormatSizeConverter}, ConverterParameter=0}" + VerticalAlignment="Center" /> @@ -166,20 +148,16 @@ + Padding="0,10"> - + - + + Width="20" /> + Text="{Binding DisplayName}" + VerticalAlignment="Center" /> @@ -275,8 +253,8 @@ @@ -289,18 +267,16 @@ + CornerRadius="10" + Margin="0,0,10,0" + MaxHeight="200" + Padding="5"> - + - + @@ -330,42 +304,36 @@ - + - + + Text="{Binding CurrentLocation^.Name, FallbackValue=Loading...}" + VerticalAlignment="Center" /> - + + ScrollViewer.VerticalScrollBarVisibility="Visible" + x:CompileBindings="False"> + Width="1" /> - + + Height="40" + Source="{SvgImage /Assets/loading.svg}" + Width="40"> @@ -403,55 +369,53 @@ + SelectedItem="{Binding AppState.SelectedTab^.CurrentSelectedItem^}" + x:Name="CurrentItems"> - + + Grid.Row="1" + HorizontalAlignment="Center" + IsVisible="{Binding AppState.SelectedTab^.CurrentItemsCollection.Collection.Count, Converter={StaticResource EqualityConverter}, ConverterParameter=0}" + Margin="10" + x:CompileBindings="False" + x:Name="CurrentEmpty"> Empty + Width="1" /> + ItemsSource="{Binding AppState.SelectedTab^.SelectedsChildrenCollection.Collection}" + x:CompileBindings="False" + x:Name="ChildItems"> @@ -460,35 +424,29 @@ + HorizontalAlignment="Center" + IsVisible="{Binding AppState.SelectedTab^.SelectedsChildrenCollection.Collection.Count, Converter={StaticResource EqualityConverter}, ConverterParameter=0}" + Margin="10" + x:CompileBindings="False" + x:Name="ChildEmpty"> Empty - + - + - + @@ -505,20 +463,20 @@ Text="Empty" /> + Text="{Binding ItemPreviewService.ItemPreview^.TextContent}" + x:CompileBindings="False" /> + ItemsSource="{Binding AppState.PopupTexts}" + Margin="0,0,0,20" + VerticalAlignment="Top">