RootDrive navigation
This commit is contained in:
@@ -6,7 +6,7 @@ public class OpenContainerCommand : IUserCommand
|
|||||||
{
|
{
|
||||||
public IAbsolutePath Path { get; }
|
public IAbsolutePath Path { get; }
|
||||||
|
|
||||||
private OpenContainerCommand(IAbsolutePath path)
|
public OpenContainerCommand(IAbsolutePath path)
|
||||||
{
|
{
|
||||||
Path = path;
|
Path = path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,12 +47,21 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
|
|||||||
new TypeUserCommandHandler<GoUpCommand>(GoUp),
|
new TypeUserCommandHandler<GoUpCommand>(GoUp),
|
||||||
new TypeUserCommandHandler<MoveCursorDownCommand>(MoveCursorDown),
|
new TypeUserCommandHandler<MoveCursorDownCommand>(MoveCursorDown),
|
||||||
new TypeUserCommandHandler<MoveCursorUpCommand>(MoveCursorUp),
|
new TypeUserCommandHandler<MoveCursorUpCommand>(MoveCursorUp),
|
||||||
new TypeUserCommandHandler<OpenSelectedCommand>(OpenContainer),
|
new TypeUserCommandHandler<OpenContainerCommand>(OpenContainer),
|
||||||
|
new TypeUserCommandHandler<OpenSelectedCommand>(OpenSelected),
|
||||||
new TypeUserCommandHandler<SwitchToTabCommand>(SwitchToTab),
|
new TypeUserCommandHandler<SwitchToTabCommand>(SwitchToTab),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task OpenContainer()
|
private async Task OpenContainer(OpenContainerCommand command)
|
||||||
|
{
|
||||||
|
var resolvedPath = await command.Path.ResolveAsync();
|
||||||
|
if (resolvedPath is not IContainer resolvedContainer) return;
|
||||||
|
|
||||||
|
_selectedTab?.Tab?.SetCurrentLocation(resolvedContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task OpenSelected()
|
||||||
{
|
{
|
||||||
if (_currentSelectedItem is not IContainerViewModel containerViewModel || containerViewModel.Container is null) return Task.CompletedTask;
|
if (_currentSelectedItem is not IContainerViewModel containerViewModel || containerViewModel.Container is null) return Task.CompletedTask;
|
||||||
|
|
||||||
@@ -132,9 +141,9 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
|
|||||||
private Task CloseTab()
|
private Task CloseTab()
|
||||||
{
|
{
|
||||||
if (_appState.Tabs.Count < 2) return Task.CompletedTask;
|
if (_appState.Tabs.Count < 2) return Task.CompletedTask;
|
||||||
|
|
||||||
_appState.RemoveTab(_selectedTab!);
|
_appState.RemoveTab(_selectedTab!);
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,8 +67,8 @@ public partial class TabViewModel : ITabViewModel, IDisposable
|
|||||||
CurrentLocation = tab.CurrentLocation.AsObservable();
|
CurrentLocation = tab.CurrentLocation.AsObservable();
|
||||||
CurrentItems = tab.CurrentItems
|
CurrentItems = tab.CurrentItems
|
||||||
.Select(items => items?.Transform(i => MapItemToViewModel(i, ItemViewModelType.Main)))
|
.Select(items => items?.Transform(i => MapItemToViewModel(i, ItemViewModelType.Main)))
|
||||||
.ObserveOn(_rxSchedulerService.GetWorkerScheduler())
|
/*.ObserveOn(_rxSchedulerService.GetWorkerScheduler())
|
||||||
.SubscribeOn(_rxSchedulerService.GetUIScheduler())
|
.SubscribeOn(_rxSchedulerService.GetUIScheduler())*/
|
||||||
.Publish(null)
|
.Publish(null)
|
||||||
.RefCount();
|
.RefCount();
|
||||||
|
|
||||||
@@ -119,8 +119,8 @@ public partial class TabViewModel : ITabViewModel, IDisposable
|
|||||||
.Where(c => c is null or not IContainerViewModel)
|
.Where(c => c is null or not IContainerViewModel)
|
||||||
.Select(_ => (IObservable<IChangeSet<IItemViewModel>>?) null)
|
.Select(_ => (IObservable<IChangeSet<IItemViewModel>>?) null)
|
||||||
)
|
)
|
||||||
.ObserveOn(_rxSchedulerService.GetWorkerScheduler())
|
/*.ObserveOn(_rxSchedulerService.GetWorkerScheduler())
|
||||||
.SubscribeOn(_rxSchedulerService.GetUIScheduler())
|
.SubscribeOn(_rxSchedulerService.GetUIScheduler())*/
|
||||||
.Publish(null)
|
.Publish(null)
|
||||||
.RefCount();
|
.RefCount();
|
||||||
}
|
}
|
||||||
@@ -147,8 +147,8 @@ public partial class TabViewModel : ITabViewModel, IDisposable
|
|||||||
.Where(p => p is null)
|
.Where(p => p is null)
|
||||||
.Select(_ => (IObservable<IChangeSet<IItemViewModel>>?) null)
|
.Select(_ => (IObservable<IChangeSet<IItemViewModel>>?) null)
|
||||||
)
|
)
|
||||||
.ObserveOn(_rxSchedulerService.GetWorkerScheduler())
|
/*.ObserveOn(_rxSchedulerService.GetWorkerScheduler())
|
||||||
.SubscribeOn(_rxSchedulerService.GetUIScheduler())
|
.SubscribeOn(_rxSchedulerService.GetUIScheduler())*/
|
||||||
.Publish(null)
|
.Publish(null)
|
||||||
.RefCount();
|
.RefCount();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
|
using FileTime.App.Core.UserCommand;
|
||||||
using FileTime.Core.Models;
|
using FileTime.Core.Models;
|
||||||
using FileTime.GuiApp.Models;
|
using FileTime.GuiApp.Models;
|
||||||
using FileTime.GuiApp.ViewModels;
|
using FileTime.GuiApp.ViewModels;
|
||||||
@@ -101,7 +102,7 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
var resolvedItem = await path.ResolveAsync();
|
var resolvedItem = await path.ResolveAsync();
|
||||||
if (resolvedItem is not IContainer resolvedContainer) return;
|
if (resolvedItem is not IContainer resolvedContainer) return;
|
||||||
//ViewModel.CommandHandlerService.HandleCommandAsync()
|
await ViewModel.UserCommandHandlerService.HandleCommandAsync(new OpenContainerCommand(new AbsolutePath(resolvedContainer)));
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user