mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 18:29:24 +08:00
Updated program execution to call action on background thread. (#2370)
This commit is contained in:
parent
368640b59b
commit
a6e8cbc50d
@ -114,8 +114,8 @@ namespace Wox.ViewModel
|
|||||||
SelectPrevItemCommand = new RelayCommand(_ =>
|
SelectPrevItemCommand = new RelayCommand(_ =>
|
||||||
{
|
{
|
||||||
SelectedResults.SelectPrevResult();
|
SelectedResults.SelectPrevResult();
|
||||||
});
|
});
|
||||||
|
|
||||||
SelectNextTabItemCommand = new RelayCommand(_ =>
|
SelectNextTabItemCommand = new RelayCommand(_ =>
|
||||||
{
|
{
|
||||||
SelectedResults.SelectNextTabItem();
|
SelectedResults.SelectNextTabItem();
|
||||||
@ -152,37 +152,37 @@ namespace Wox.ViewModel
|
|||||||
results.SelectedIndex = int.Parse(index.ToString());
|
results.SelectedIndex = int.Parse(index.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(results.SelectedItem != null)
|
if(results.SelectedItem != null)
|
||||||
{
|
{
|
||||||
//If there is a context button selected fire the action for that button before the main command.
|
//If there is a context button selected fire the action for that button before the main command.
|
||||||
bool didExecuteContextButton = results.SelectedItem.ExecuteSelectedContextButton();
|
bool didExecuteContextButton = results.SelectedItem.ExecuteSelectedContextButton();
|
||||||
|
|
||||||
if (!didExecuteContextButton)
|
if (!didExecuteContextButton)
|
||||||
{
|
{
|
||||||
var result = results.SelectedItem.Result;
|
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;
|
||||||
{
|
|
||||||
SpecialKeyState = GlobalHotkey.Instance.CheckModifiers()
|
Task.Run(() =>
|
||||||
});
|
{
|
||||||
|
result.Action(new ActionContext
|
||||||
if (hideWindow)
|
{
|
||||||
{
|
SpecialKeyState = GlobalHotkey.Instance.CheckModifiers()
|
||||||
MainWindowVisibility = Visibility.Collapsed;
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
if (SelectedIsFromQueryResults())
|
if (SelectedIsFromQueryResults())
|
||||||
{
|
{
|
||||||
_userSelectedRecord.Add(result);
|
_userSelectedRecord.Add(result);
|
||||||
_history.Add(result.OriginQuery.RawQuery);
|
_history.Add(result.OriginQuery.RawQuery);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SelectedResults = Results;
|
SelectedResults = Results;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -289,8 +289,8 @@ namespace Wox.ViewModel
|
|||||||
|
|
||||||
public ICommand EscCommand { get; set; }
|
public ICommand EscCommand { get; set; }
|
||||||
public ICommand SelectNextItemCommand { get; set; }
|
public ICommand SelectNextItemCommand { get; set; }
|
||||||
public ICommand SelectPrevItemCommand { get; set; }
|
public ICommand SelectPrevItemCommand { get; set; }
|
||||||
|
|
||||||
public ICommand SelectNextTabItemCommand { get; set; }
|
public ICommand SelectNextTabItemCommand { get; set; }
|
||||||
public ICommand SelectPrevTabItemCommand { get; set; }
|
public ICommand SelectPrevTabItemCommand { get; set; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user