mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 14:41:21 +08:00
Updated functionality on suggestion chosen in autosuggestbox
This commit is contained in:
parent
1a15a062ef
commit
abbaca3c71
@ -260,26 +260,26 @@ namespace PowerLauncher
|
||||
_launcher = (PowerLauncher.UI.LauncherControl)host.Child;
|
||||
_launcher.DataContext = _viewModel;
|
||||
_launcher.SearchBox.TextChanged += QueryTextBox_TextChanged;
|
||||
//_launcher.SearchBox.SuggestionChosen += SearchBox_SuggestionChosen;
|
||||
//_launcher.SearchBox.Focus(Windows.UI.Xaml.FocusState.Programmatic);
|
||||
_launcher.SearchBox.SuggestionChosen += SearchBox_SuggestionChosen;
|
||||
_launcher.SearchBox.Focus(Windows.UI.Xaml.FocusState.Programmatic);
|
||||
|
||||
//_viewModel.PropertyChanged += (o, e) =>
|
||||
//{
|
||||
// if (e.PropertyName == nameof(MainViewModel.MainWindowVisibility))
|
||||
// {
|
||||
// if (Visibility == System.Windows.Visibility.Visible)
|
||||
// {
|
||||
// Activate();
|
||||
// _launcher.SearchBox.Focus(Windows.UI.Xaml.FocusState.Programmatic);
|
||||
// UpdatePosition();
|
||||
// _settings.ActivateTimes++;
|
||||
// if (!_viewModel.LastQuerySelected)
|
||||
// {
|
||||
// _viewModel.LastQuerySelected = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//};
|
||||
_viewModel.PropertyChanged += (o, e) =>
|
||||
{
|
||||
if (e.PropertyName == nameof(MainViewModel.MainWindowVisibility))
|
||||
{
|
||||
if (Visibility == System.Windows.Visibility.Visible)
|
||||
{
|
||||
Activate();
|
||||
_launcher.SearchBox.Focus(Windows.UI.Xaml.FocusState.Programmatic);
|
||||
UpdatePosition();
|
||||
_settings.ActivateTimes++;
|
||||
if (!_viewModel.LastQuerySelected)
|
||||
{
|
||||
_viewModel.LastQuerySelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void SearchBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
|
||||
@ -287,15 +287,8 @@ namespace PowerLauncher
|
||||
if (args != null)
|
||||
{
|
||||
ResultViewModel result = (ResultViewModel)args.SelectedItem;
|
||||
bool hideWindow = result.Result.Action != null && result.Result.Action(new ActionContext
|
||||
{
|
||||
|
||||
});
|
||||
if (!hideWindow)
|
||||
{
|
||||
Console.WriteLine("here");
|
||||
}
|
||||
}
|
||||
_ = result.Result.Action != null && result.Result.Action(new ActionContext{});
|
||||
}
|
||||
}
|
||||
|
||||
private void QueryTextBox_TextChanged(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxTextChangedEventArgs args)
|
||||
|
Loading…
Reference in New Issue
Block a user