Open by path

This commit is contained in:
2022-05-30 17:09:10 +02:00
parent e9ed2c01e6
commit 1a32e97973
12 changed files with 82 additions and 18 deletions

View File

@@ -130,7 +130,7 @@ public class ItemManipulationUserCommandHandlerService : UserCommandHandlerServi
{
var containerNameInput = new TextInputElement("Container name");
await _inputInterface.ReadInputs(new List<IInputElement>() { containerNameInput });
await _inputInterface.ReadInputs(containerNameInput);
//TODO: message on empty result
var newContainerName = containerNameInput.Value;
@@ -147,7 +147,7 @@ public class ItemManipulationUserCommandHandlerService : UserCommandHandlerServi
{
var containerNameInput = new TextInputElement("Element name");
await _inputInterface.ReadInputs(new List<IInputElement>() { containerNameInput });
await _inputInterface.ReadInputs(containerNameInput);
//TODO: message on empty result
var newContainerName = containerNameInput.Value;

View File

@@ -2,6 +2,7 @@ using FileTime.App.Core.Extensions;
using FileTime.App.Core.Models.Enums;
using FileTime.App.Core.UserCommand;
using FileTime.App.Core.ViewModels;
using FileTime.Core.Interactions;
using FileTime.Core.Models;
using FileTime.Core.Services;
using FileTime.Core.Timeline;
@@ -18,6 +19,7 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
private readonly ILocalContentProvider _localContentProvider;
private readonly IUserCommandHandlerService _userCommandHandlerService;
private readonly ITimelessContentProvider _timelessContentProvider;
private readonly IInputInterface _inputInterface;
private ITabViewModel? _selectedTab;
private IContainer? _currentLocation;
private IItemViewModel? _currentSelectedItem;
@@ -29,13 +31,15 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
IServiceProvider serviceProvider,
ILocalContentProvider localContentProvider,
IUserCommandHandlerService userCommandHandlerService,
ITimelessContentProvider timelessContentProvider) : base(appState)
ITimelessContentProvider timelessContentProvider,
IInputInterface inputInterface) : base(appState)
{
_appState = appState;
_serviceProvider = serviceProvider;
_localContentProvider = localContentProvider;
_userCommandHandlerService = userCommandHandlerService;
_timelessContentProvider = timelessContentProvider;
_inputInterface = inputInterface;
SaveSelectedTab(t => _selectedTab = t);
SaveCurrentSelectedItem(i => _currentSelectedItem = i);
@@ -50,6 +54,7 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
new TypeUserCommandHandler<EnterRapidTravelCommand>(EnterRapidTravel),
new TypeUserCommandHandler<ExitRapidTravelCommand>(ExitRapidTravel),
new TypeUserCommandHandler<GoToHomeCommand>(GoToHome),
new TypeUserCommandHandler<GoToPathCommand>(GoToPath),
new TypeUserCommandHandler<GoToProviderCommand>(GoToProvider),
new TypeUserCommandHandler<GoToRootCommand>(GoToRoot),
new TypeUserCommandHandler<GoUpCommand>(GoUp),
@@ -66,6 +71,20 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
});
}
private async Task GoToPath()
{
var pathInput = new TextInputElement("Path");
await _inputInterface.ReadInputs(pathInput);
//TODO: message on empty result and on null pathInput.Value
var resolvedPath = await _timelessContentProvider.GetItemByNativePathAsync(new NativePath(pathInput.Value));
if (resolvedPath is IContainer container)
{
await _userCommandHandlerService.HandleCommandAsync(
new OpenContainerCommand(new AbsolutePath(_timelessContentProvider, container)));
}
}
private async Task GoToHome()
{
var path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);

View File

@@ -19,6 +19,7 @@ public class DefaultIdentifiableCommandHandlerRegister : IStartupHandler
AddUserCommand(EnterRapidTravelCommand.Instance);
AddUserCommand(ExitRapidTravelCommand.Instance);
AddUserCommand(GoToHomeCommand.Instance);
AddUserCommand(GoToPathCommand.Instance);
AddUserCommand(GoToProviderCommand.Instance);
AddUserCommand(GoToRootCommand.Instance);
AddUserCommand(GoUpCommand.Instance);