Updated program execution to call action on background thread. (#2370)

This commit is contained in:
Divyansh Srivastava 2020-04-24 13:31:36 -07:00 committed by GitHub
parent 368640b59b
commit a6e8cbc50d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -160,17 +160,17 @@ namespace Wox.ViewModel
if (!didExecuteContextButton)
{
var result = results.SelectedItem.Result;
if (result != null) // SelectedItem returns null if selection is empty.
if (result != null && result.Action != null) // SelectedItem returns null if selection is empty.
{
bool hideWindow = result.Action != null && result.Action(new ActionContext
MainWindowVisibility = Visibility.Collapsed;
Task.Run(() =>
{
result.Action(new ActionContext
{
SpecialKeyState = GlobalHotkey.Instance.CheckModifiers()
});
if (hideWindow)
{
MainWindowVisibility = Visibility.Collapsed;
}
});
if (SelectedIsFromQueryResults())
{