[PTRun]Fix always hiding even when an action fails (#21259)

Hide PowerToys Run if the result action returns true, otherwise keep it open
This commit is contained in:
Henrik Lau Eriksson
2022-10-25 21:46:40 +02:00
committed by GitHub
parent 778bb7ad9f
commit aa6910acb1
2 changed files with 9 additions and 3 deletions

View File

@@ -192,16 +192,21 @@ namespace PowerLauncher.ViewModel
// SelectedItem returns null if selection is empty.
if (result != null && result.Action != null)
{
Hide();
bool hideWindow = true;
Application.Current.Dispatcher.Invoke(() =>
{
result.Action(new ActionContext
hideWindow = result.Action(new ActionContext
{
SpecialKeyState = KeyboardHelper.CheckModifiers(),
});
});
if (hideWindow)
{
Hide();
}
if (SelectedIsFromQueryResults())
{
_userSelectedRecord.Add(result);