mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 18:29:24 +08:00
Fixed process executing on clicking enter if no text in search box
This commit is contained in:
parent
65cda38cc8
commit
d0822ab1fe
@ -152,35 +152,38 @@ namespace Wox.ViewModel
|
|||||||
results.SelectedIndex = int.Parse(index.ToString());
|
results.SelectedIndex = int.Parse(index.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
//If there is a context button selected fire the action for that button before the main command.
|
if(results.SelectedItem != null)
|
||||||
bool didExecuteContextButton = results.SelectedItem?.ExecuteSelectedContextButton() ?? false;
|
|
||||||
|
|
||||||
if (!didExecuteContextButton)
|
|
||||||
{
|
{
|
||||||
var result = results.SelectedItem?.Result;
|
//If there is a context button selected fire the action for that button before the main command.
|
||||||
if (result != null) // SelectedItem returns null if selection is empty.
|
bool didExecuteContextButton = results.SelectedItem?.ExecuteSelectedContextButton() ?? false;
|
||||||
{
|
|
||||||
bool hideWindow = result.Action != null && result.Action(new ActionContext
|
if (!didExecuteContextButton)
|
||||||
{
|
{
|
||||||
SpecialKeyState = GlobalHotkey.Instance.CheckModifiers()
|
var result = results.SelectedItem?.Result;
|
||||||
});
|
if (result != null) // SelectedItem returns null if selection is empty.
|
||||||
|
{
|
||||||
if (hideWindow)
|
bool hideWindow = result.Action != null && result.Action(new ActionContext
|
||||||
{
|
{
|
||||||
MainWindowVisibility = Visibility.Collapsed;
|
SpecialKeyState = GlobalHotkey.Instance.CheckModifiers()
|
||||||
}
|
});
|
||||||
|
|
||||||
if (SelectedIsFromQueryResults())
|
if (hideWindow)
|
||||||
{
|
{
|
||||||
_userSelectedRecord.Add(result);
|
MainWindowVisibility = Visibility.Collapsed;
|
||||||
_history.Add(result.OriginQuery.RawQuery);
|
}
|
||||||
}
|
|
||||||
else
|
if (SelectedIsFromQueryResults())
|
||||||
{
|
{
|
||||||
SelectedResults = Results;
|
_userSelectedRecord.Add(result);
|
||||||
}
|
_history.Add(result.OriginQuery.RawQuery);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
SelectedResults = Results;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
LoadContextMenuCommand = new RelayCommand(_ =>
|
LoadContextMenuCommand = new RelayCommand(_ =>
|
||||||
@ -419,7 +422,8 @@ namespace Wox.ViewModel
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Results.Clear();
|
Results.SelectedItem = null;
|
||||||
|
Results.Clear();
|
||||||
Results.Visbility = Visibility.Collapsed;
|
Results.Visbility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,10 @@ namespace Wox.ViewModel
|
|||||||
_selectedItem = value;
|
_selectedItem = value;
|
||||||
_selectedItem.ActivateContextButtons(ResultViewModel.ActivationType.Selection);
|
_selectedItem.ActivateContextButtons(ResultViewModel.ActivationType.Selection);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_selectedItem = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user