Item double click (run or open)

This commit is contained in:
2023-08-03 11:17:51 +02:00
parent 558a0a08bb
commit 3304d775f5
10 changed files with 66 additions and 77 deletions

View File

@@ -89,14 +89,15 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
});
}
private async Task RunOrOpen()
private async Task RunOrOpen(RunOrOpenCommand command)
{
if (_currentSelectedItem?.Value is IContainerViewModel)
var item = command.Item ?? _currentSelectedItem?.Value;
if (item is IContainerViewModel)
{
await OpenSelected();
}
else if (
_currentSelectedItem?.Value is IElementViewModel
item is IElementViewModel
{
Element: {NativePath: not null, Provider: ILocalContentProvider} localFile
}
@@ -344,7 +345,7 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
? (IContainer) await _timelessContentProvider.GetItemByFullNameAsync(fullName, PointInTime.Present)
: _localContentProvider;
}
catch(Exception ex)
catch (Exception ex)
{
var fullName = _currentLocation?.Value?.FullName?.Path ?? "unknown";
_logger.LogError(ex, "Could not resolve container while switching to tab {TabNumber} to path {FullName}", number, fullName);

View File

@@ -9,61 +9,6 @@ public class UserCommandHandlerService : IUserCommandHandlerService
public UserCommandHandlerService(IServiceProvider serviceProvider)
{
_commandHandlers = new Lazy<IEnumerable<IUserCommandHandler>>(serviceProvider.GetServices<IUserCommandHandler>);
//(Commands.AutoRefresh, ToggleAutoRefresh),
//(Commands.ChangeTimelineMode, ChangeTimelineMode),
//(Commands.CloseTab, CloseTab),
//(Commands.Compress, Compress),
//(Commands.Copy, Copy),
//(Commands.CopyHash, CopyHash),
//(Commands.CopyPath, CopyPath),
//(Commands.CreateContainer, CreateContainer),
//(Commands.CreateElement, CreateElement),
//(Commands.Cut, Cut),
//(Commands.Edit, Edit),
//(Commands.EnterRapidTravel, EnterRapidTravelMode),
//(Commands.FindByName, FindByName),
//(Commands.FindByNameRegex, FindByNameRegex),
//(Commands.GoToHome, GotToHome),
//(Commands.GoToPath, GoToContainer),
//(Commands.GoToProvider, GotToProvider),
//(Commands.GoToRoot, GotToRoot),
//(Commands.HardDelete, HardDelete),
//(Commands.Mark, MarkCurrentItem),
//(Commands.MoveCursorDownPage, MoveCursorDownPage),
//(Commands.MoveCursorUpPage, MoveCursorUpPage),
//(Commands.MoveToFirst, MoveToFirst),
//(Commands.MoveToLast, MoveToLast),
//(Commands.NextTimelineBlock, SelectNextTimelineBlock),
//(Commands.NextTimelineCommand, SelectNextTimelineCommand),
//(Commands.OpenInFileBrowser, OpenInDefaultFileExplorer),
//(Commands.OpenOrRun, OpenOrRun),
//(Commands.PasteMerge, PasteMerge),
//(Commands.PasteOverwrite, PasteOverwrite),
//(Commands.PasteSkip, PasteSkip),
//(Commands.PinFavorite, PinFavorite),
//(Commands.PreviousTimelineBlock, SelectPreviousTimelineBlock),
//(Commands.PreviousTimelineCommand, SelectPreviousTimelineCommand),
//(Commands.Refresh, RefreshCurrentLocation),
//(Commands.Rename, Rename),
//(Commands.RunCommand, RunCommandInContainer),
//(Commands.ScanContainerSize, ScanContainerSize),
//(Commands.ShowAllShotcut, ShowAllShortcut),
//(Commands.SoftDelete, SoftDelete),
//(Commands.SwitchToLastTab, async() => await SwitchToTab(-1)),
//(Commands.SwitchToTab1, async() => await SwitchToTab(1)),
//(Commands.SwitchToTab2, async() => await SwitchToTab(2)),
//(Commands.SwitchToTab3, async() => await SwitchToTab(3)),
//(Commands.SwitchToTab4, async() => await SwitchToTab(4)),
//(Commands.SwitchToTab5, async() => await SwitchToTab(5)),
//(Commands.SwitchToTab6, async() => await SwitchToTab(6)),
//(Commands.SwitchToTab7, async() => await SwitchToTab(7)),
//(Commands.SwitchToTab8, async() => await SwitchToTab(8)),
//(Commands.TimelinePause, PauseTimeline),
//(Commands.TimelineRefresh, RefreshTimeline),
//(Commands.TimelineStart, ContinueTimeline),
//(Commands.ToggleAdvancedIcons, ToggleAdvancedIcons),
//(Commands.ToggleHidden, ToggleHidden),
}
public async Task HandleCommandAsync(UserCommand.IUserCommand command)