mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
[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:
committed by
GitHub
parent
778bb7ad9f
commit
aa6910acb1
@@ -192,16 +192,21 @@ namespace PowerLauncher.ViewModel
|
|||||||
// SelectedItem returns null if selection is empty.
|
// SelectedItem returns null if selection is empty.
|
||||||
if (result != null && result.Action != null)
|
if (result != null && result.Action != null)
|
||||||
{
|
{
|
||||||
Hide();
|
bool hideWindow = true;
|
||||||
|
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
result.Action(new ActionContext
|
hideWindow = result.Action(new ActionContext
|
||||||
{
|
{
|
||||||
SpecialKeyState = KeyboardHelper.CheckModifiers(),
|
SpecialKeyState = KeyboardHelper.CheckModifiers(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (hideWindow)
|
||||||
|
{
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
|
||||||
if (SelectedIsFromQueryResults())
|
if (SelectedIsFromQueryResults())
|
||||||
{
|
{
|
||||||
_userSelectedRecord.Add(result);
|
_userSelectedRecord.Add(result);
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ namespace Wox.Plugin
|
|||||||
public IconDelegate Icon { get; set; }
|
public IconDelegate Icon { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets return true to hide wox after select result
|
/// Gets or sets the result action.
|
||||||
|
/// Return <c>true</c> to hide PowerToys Run after the result has been selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Func<ActionContext, bool> Action { get; set; }
|
public Func<ActionContext, bool> Action { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user