Skip other commands if executed

This commit is contained in:
Jack251970 2025-06-26 10:45:01 +08:00
parent b52c7e756c
commit 590ea6184f

View file

@ -251,11 +251,6 @@ internal static class HotKeyMapper
{
return new RelayCommand(() =>
{
if (_windowHotkeyEvents.TryGetValue(hotkey, out var existingCommand))
{
existingCommand.Execute(null);
}
var selectedResult = _mainViewModel.Results.SelectedItem?.Result;
// Check result nullability
if (selectedResult != null)
@ -274,11 +269,20 @@ internal static class HotKeyMapper
if (metadata.Disabled)
continue;
// Invoke action
if (pluginHotkey.Action?.Invoke(selectedResult) ?? false)
// Check action nullability
if (pluginHotkey.Action == null)
continue;
// Invoke action & return to skip other commands
if (pluginHotkey.Action.Invoke(selectedResult))
App.API.HideMainWindow();
}
}
if (_windowHotkeyEvents.TryGetValue(hotkey, out var existingCommand))
{
existingCommand.Execute(null);
}
});
}