RapidTravel impr, GoBack/Forward, header navigation
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
namespace FileTime.App.Core.UserCommand;
|
||||
|
||||
public class GoBackCommand : IIdentifiableUserCommand
|
||||
{
|
||||
public const string CommandName = "go_back";
|
||||
|
||||
public static GoBackCommand Instance { get; } = new();
|
||||
|
||||
private GoBackCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public string UserCommandID => CommandName;
|
||||
public string Title => "Go back";
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace FileTime.App.Core.UserCommand;
|
||||
|
||||
public class GoForwardCommand : IIdentifiableUserCommand
|
||||
{
|
||||
public const string CommandName = "go_forward";
|
||||
|
||||
public static GoForwardCommand Instance { get; } = new();
|
||||
|
||||
private GoForwardCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public string UserCommandID => CommandName;
|
||||
public string Title => "Go forward";
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public interface IAppState
|
||||
IObservable<string?> SearchText { get; }
|
||||
IDeclarativeProperty<ViewMode> ViewMode { get; }
|
||||
DeclarativeProperty<string?> RapidTravelText { get; }
|
||||
IDeclarativeProperty<string?> RapidTravelTextDebounced { get; }
|
||||
ITimelineViewModel TimelineViewModel { get; }
|
||||
IDeclarativeProperty<string?> ContainerStatus { get; }
|
||||
|
||||
|
||||
@@ -68,7 +68,9 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
|
||||
new TypeUserCommandHandler<CloseTabCommand>(CloseTab),
|
||||
new TypeUserCommandHandler<EnterRapidTravelCommand>(EnterRapidTravel),
|
||||
new TypeUserCommandHandler<ExitRapidTravelCommand>(ExitRapidTravel),
|
||||
new TypeUserCommandHandler<GoBackCommand>(GoBack),
|
||||
new TypeUserCommandHandler<GoByFrequencyCommand>(GoByFrequency),
|
||||
new TypeUserCommandHandler<GoForwardCommand>(GoForward),
|
||||
new TypeUserCommandHandler<GoToHomeCommand>(GoToHome),
|
||||
new TypeUserCommandHandler<GoToPathCommand>(GoToPath),
|
||||
new TypeUserCommandHandler<GoToProviderCommand>(GoToProvider),
|
||||
@@ -89,6 +91,20 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
|
||||
});
|
||||
}
|
||||
|
||||
private async Task GoBack()
|
||||
{
|
||||
if (_selectedTab?.Tab is null) return;
|
||||
|
||||
await _selectedTab.Tab.GoBackAsync();
|
||||
}
|
||||
|
||||
private async Task GoForward()
|
||||
{
|
||||
if (_selectedTab?.Tab is null) return;
|
||||
|
||||
await _selectedTab.Tab.GoForwardAsync();
|
||||
}
|
||||
|
||||
private async Task RunOrOpen(RunOrOpenCommand command)
|
||||
{
|
||||
var item = command.Item ?? _currentSelectedItem?.Value;
|
||||
|
||||
@@ -22,7 +22,9 @@ public class DefaultIdentifiableCommandHandlerRegister : IStartupHandler
|
||||
AddUserCommand(DeleteCommand.SoftDelete);
|
||||
AddUserCommand(EnterRapidTravelCommand.Instance);
|
||||
AddUserCommand(ExitRapidTravelCommand.Instance);
|
||||
AddUserCommand(GoBackCommand.Instance);
|
||||
AddUserCommand(GoByFrequencyCommand.Instance);
|
||||
AddUserCommand(GoForwardCommand.Instance);
|
||||
AddUserCommand(GoToHomeCommand.Instance);
|
||||
AddUserCommand(GoToPathCommand.Instance);
|
||||
AddUserCommand(GoToProviderCommand.Instance);
|
||||
|
||||
@@ -26,12 +26,21 @@ public abstract partial class AppStateBase : IAppState
|
||||
|
||||
public IDeclarativeProperty<ITabViewModel?> SelectedTab { get; private set; }
|
||||
public DeclarativeProperty<string?> RapidTravelText { get; private set; }
|
||||
public IDeclarativeProperty<string?> RapidTravelTextDebounced { get; private set; }
|
||||
|
||||
public IDeclarativeProperty<string?> ContainerStatus { get; private set; }
|
||||
|
||||
partial void OnInitialize()
|
||||
{
|
||||
RapidTravelText = new("");
|
||||
RapidTravelTextDebounced = RapidTravelText
|
||||
.Debounce(v =>
|
||||
string.IsNullOrEmpty(v)
|
||||
? TimeSpan.Zero
|
||||
: TimeSpan.FromMilliseconds(200)
|
||||
, resetTimer: true
|
||||
);
|
||||
|
||||
ViewMode = _viewMode;
|
||||
|
||||
SearchText = _searchText.AsObservable();
|
||||
|
||||
@@ -53,7 +53,7 @@ public abstract partial class ItemViewModel : IItemViewModel
|
||||
|
||||
var displayName = itemViewModelType switch
|
||||
{
|
||||
ItemViewModelType.Main => _appState.RapidTravelText.Map(async (s, _) =>
|
||||
ItemViewModelType.Main => _appState.RapidTravelTextDebounced.Map(async (s, _) =>
|
||||
_appState.ViewMode.Value != Models.Enums.ViewMode.RapidTravel
|
||||
&& _appState.SelectedTab.Value?.CurrentLocation.Value?.Provider is IItemNameConverterProvider nameConverterProvider
|
||||
? (IReadOnlyList<ItemNamePart>) await nameConverterProvider.GetItemNamePartsAsync(item)
|
||||
|
||||
@@ -138,7 +138,7 @@ public partial class TabViewModel : ITabViewModel
|
||||
CurrentSelectedItemAsContainer = CurrentSelectedItem.Map(i => i as IContainerViewModel);
|
||||
|
||||
SelectedsChildren = CurrentSelectedItem
|
||||
.Debounce(() => _refreshSmoothnessCalculator.RefreshDelay, resetTimer: true)
|
||||
.Debounce(_ => _refreshSmoothnessCalculator.RefreshDelay, resetTimer: true)
|
||||
.DistinctUntilChanged()
|
||||
.Map(item =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user