diff --git a/src/modules/launcher/Wox/ViewModel/MainViewModel.cs b/src/modules/launcher/Wox/ViewModel/MainViewModel.cs index 2e29b60877..a9de73ce6b 100644 --- a/src/modules/launcher/Wox/ViewModel/MainViewModel.cs +++ b/src/modules/launcher/Wox/ViewModel/MainViewModel.cs @@ -114,8 +114,8 @@ namespace Wox.ViewModel SelectPrevItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevResult(); - }); - + }); + SelectNextTabItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextTabItem(); @@ -152,37 +152,37 @@ namespace Wox.ViewModel results.SelectedIndex = int.Parse(index.ToString()); } - if(results.SelectedItem != null) - { - //If there is a context button selected fire the action for that button before the main command. - bool didExecuteContextButton = results.SelectedItem.ExecuteSelectedContextButton(); - - if (!didExecuteContextButton) - { - var result = results.SelectedItem.Result; - if (result != null) // SelectedItem returns null if selection is empty. - { - bool hideWindow = result.Action != null && result.Action(new ActionContext - { - SpecialKeyState = GlobalHotkey.Instance.CheckModifiers() - }); - - if (hideWindow) - { - MainWindowVisibility = Visibility.Collapsed; - } - - if (SelectedIsFromQueryResults()) - { - _userSelectedRecord.Add(result); - _history.Add(result.OriginQuery.RawQuery); - } - else - { - SelectedResults = Results; - } - } - } + if(results.SelectedItem != null) + { + //If there is a context button selected fire the action for that button before the main command. + bool didExecuteContextButton = results.SelectedItem.ExecuteSelectedContextButton(); + + if (!didExecuteContextButton) + { + var result = results.SelectedItem.Result; + if (result != null && result.Action != null) // SelectedItem returns null if selection is empty. + { + MainWindowVisibility = Visibility.Collapsed; + + Task.Run(() => + { + result.Action(new ActionContext + { + SpecialKeyState = GlobalHotkey.Instance.CheckModifiers() + }); + }); + + if (SelectedIsFromQueryResults()) + { + _userSelectedRecord.Add(result); + _history.Add(result.OriginQuery.RawQuery); + } + else + { + SelectedResults = Results; + } + } + } } }); @@ -289,8 +289,8 @@ namespace Wox.ViewModel public ICommand EscCommand { get; set; } public ICommand SelectNextItemCommand { get; set; } - public ICommand SelectPrevItemCommand { get; set; } - + public ICommand SelectPrevItemCommand { get; set; } + public ICommand SelectNextTabItemCommand { get; set; } public ICommand SelectPrevTabItemCommand { get; set; }