Rapid travel filter + ESC improvements
This commit is contained in:
@@ -5,4 +5,5 @@ namespace FileTime.GuiApp.App.Services;
|
||||
public interface IKeyInputHandlerService
|
||||
{
|
||||
Task ProcessKeyDown(KeyEventArgs e);
|
||||
event EventHandler? UnhandledEsc;
|
||||
}
|
||||
@@ -16,6 +16,8 @@ public class KeyInputHandlerService : IKeyInputHandlerService
|
||||
private readonly IAppKeyService<Key> _appKeyService;
|
||||
private GuiPanel _activePanel;
|
||||
|
||||
public event EventHandler? UnhandledEsc;
|
||||
|
||||
private readonly Dictionary<(GuiPanel, Key), GuiPanel> _panelMovements = new()
|
||||
{
|
||||
[(GuiPanel.FileBrowser, Key.Up)] = GuiPanel.Timeline,
|
||||
@@ -72,6 +74,11 @@ public class KeyInputHandlerService : IKeyInputHandlerService
|
||||
if (e.ToGeneralKeyEventArgs(_appKeyService, specialKeyStatus) is { } args)
|
||||
{
|
||||
await _defaultModeKeyInputHandler.HandleInputKey(args);
|
||||
|
||||
if (!args.Handled && args.Key == Keys.Escape)
|
||||
{
|
||||
UnhandledEsc?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -102,6 +102,7 @@ public partial class MainWindowViewModel : IMainWindowViewModel
|
||||
|
||||
_modalService.AllModalClosed += (_, _) => FocusDefaultElement?.Invoke();
|
||||
_instanceMessageHandler.ShowWindow += () => ShowWindow?.Invoke();
|
||||
_keyInputHandlerService.UnhandledEsc += (_,_) => FocusDefaultElement?.Invoke();
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ public partial class MainWindow : Window, IUiAccessor
|
||||
try
|
||||
{
|
||||
var viewModel = DI.ServiceProvider.GetRequiredService<MainWindowViewModel>();
|
||||
viewModel.FocusDefaultElement = () => Focus();
|
||||
viewModel.FocusDefaultElement = () => Dispatcher.UIThread.Invoke(() => Focus());
|
||||
viewModel.ShowWindow = Activate;
|
||||
ViewModel = viewModel;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive.Subjects;
|
||||
using FileTime.App.Core.ViewModels;
|
||||
using FileTime.Core.Services;
|
||||
using FileTime.GuiApp.App.Models;
|
||||
using FileTime.GuiApp.App.ViewModels;
|
||||
using FileTime.Providers.Local;
|
||||
@@ -18,7 +19,7 @@ public partial class GuiAppState : AppStateBase, IGuiAppState, IDisposable
|
||||
|
||||
public IObservable<GuiPanel> ActivePanel { get; }
|
||||
|
||||
public GuiAppState()
|
||||
public GuiAppState(ITabEvents tabEvents):base(tabEvents)
|
||||
{
|
||||
ActivePanel = _activePanel.AsObservable();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user