mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
Merge branch 'dev/PowerLauncher' into dev/traies/merge-powerlauncher
This commit is contained in:
@@ -33,11 +33,11 @@
|
||||
<Border
|
||||
x:Name="SearchBoxBorder"
|
||||
Grid.Row="0"
|
||||
Margin="8"
|
||||
Margin="24,24,24,8"
|
||||
BorderThickness="4"
|
||||
CornerRadius="4">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="12" Opacity="0.4" ShadowDepth="4" />
|
||||
<DropShadowEffect BlurRadius="16" Opacity="0.8" ShadowDepth="0" />
|
||||
</Border.Effect>
|
||||
<xaml:WindowsXamlHost
|
||||
InitialTypeName="PowerLauncher.UI.LauncherControl"
|
||||
@@ -46,12 +46,12 @@
|
||||
<Border
|
||||
x:Name="ListBoxBorder"
|
||||
Grid.Row="1"
|
||||
Margin="8"
|
||||
Margin="24,8,24,24"
|
||||
BorderThickness="4"
|
||||
CornerRadius="4"
|
||||
Visibility="{Binding Results.Visbility}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="12" Opacity="0.4" ShadowDepth="4" />
|
||||
<DropShadowEffect BlurRadius="16" Opacity="0.8" ShadowDepth="0" />
|
||||
</Border.Effect>
|
||||
<xaml:WindowsXamlHost
|
||||
InitialTypeName="PowerLauncher.UI.ResultList"
|
||||
|
||||
@@ -152,8 +152,8 @@ namespace PowerLauncher
|
||||
_launcher = (PowerLauncher.UI.LauncherControl)host.Child;
|
||||
_launcher.DataContext = _viewModel;
|
||||
_launcher.KeyDown += _launcher_KeyDown;
|
||||
_launcher.TextBox.TextChanging += QueryTextBox_TextChanging;
|
||||
_launcher.TextBox.Loaded += TextBox_Loaded;
|
||||
_launcher.QueryTextBox.TextChanging += QueryTextBox_TextChanging;
|
||||
_launcher.QueryTextBox.Loaded += TextBox_Loaded;
|
||||
_launcher.PropertyChanged += UserControl_PropertyChanged;
|
||||
_viewModel.PropertyChanged += (o, e) =>
|
||||
{
|
||||
@@ -170,16 +170,16 @@ namespace PowerLauncher
|
||||
}
|
||||
|
||||
// to select the text so that the user can continue to type
|
||||
if(!String.IsNullOrEmpty(_launcher.TextBox.Text))
|
||||
if(!String.IsNullOrEmpty(_launcher.QueryTextBox.Text))
|
||||
{
|
||||
_launcher.TextBox.SelectAll();
|
||||
_launcher.QueryTextBox.SelectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(e.PropertyName == nameof(MainViewModel.SystemQueryText))
|
||||
{
|
||||
this._isTextSetProgramatically = true;
|
||||
_launcher.TextBox.Text = _viewModel.SystemQueryText;
|
||||
_launcher.QueryTextBox.Text = _viewModel.SystemQueryText;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -317,31 +317,7 @@ namespace PowerLauncher
|
||||
|
||||
// To populate the AutoCompleteTextBox as soon as the selection is changed or set.
|
||||
// Setting it here instead of when the text is changed as there is a delay in executing the query and populating the result
|
||||
_launcher.AutoCompleteTextBox.PlaceholderText = ListView_FirstItem(_viewModel.QueryText);
|
||||
|
||||
}
|
||||
|
||||
private void ResultsList_ItemClick(object sender, ItemClickEventArgs e)
|
||||
{
|
||||
ResultViewModel result = e?.ClickedItem as ResultViewModel;
|
||||
if(result != null)
|
||||
{
|
||||
_viewModel.Results.SelectedItem = result;
|
||||
_viewModel.OpenResultCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
|
||||
{
|
||||
if (args != null && args.ChosenSuggestion != null)
|
||||
{
|
||||
ResultViewModel result = (ResultViewModel)args.ChosenSuggestion;
|
||||
if (result != null)
|
||||
{
|
||||
_viewModel.Results.SelectedItem = result;
|
||||
_viewModel.OpenResultCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
_launcher.AutoCompleteTextBlock.Text = ListView_FirstItem(_viewModel.QueryText);
|
||||
}
|
||||
|
||||
private const int millisecondsToWait = 200;
|
||||
@@ -371,18 +347,18 @@ namespace PowerLauncher
|
||||
|
||||
if(this._isTextSetProgramatically)
|
||||
{
|
||||
this._launcher.TextBox.TextChanged += QueryTextBox_TextChangedProgramatically;
|
||||
this._launcher.QueryTextBox.TextChanged += QueryTextBox_TextChangedProgramatically;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._launcher.TextBox.TextChanged += QueryTextBox_TextChangedByUserInput;
|
||||
this._launcher.QueryTextBox.TextChanged += QueryTextBox_TextChangedByUserInput;
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearAllQueryTextChangedHanlders()
|
||||
{
|
||||
this._launcher.TextBox.TextChanged -= QueryTextBox_TextChangedProgramatically;
|
||||
this._launcher.TextBox.TextChanged -= QueryTextBox_TextChangedByUserInput;
|
||||
this._launcher.QueryTextBox.TextChanged -= QueryTextBox_TextChangedProgramatically;
|
||||
this._launcher.QueryTextBox.TextChanged -= QueryTextBox_TextChangedByUserInput;
|
||||
}
|
||||
|
||||
private void QueryTextBox_TextChangedProgramatically(object sender, Windows.UI.Xaml.Controls.TextChangedEventArgs e)
|
||||
@@ -400,7 +376,7 @@ namespace PowerLauncher
|
||||
//To clear the auto-suggest immediately instead of waiting for selection changed
|
||||
if (text == String.Empty)
|
||||
{
|
||||
_launcher.AutoCompleteTextBox.PlaceholderText = String.Empty;
|
||||
_launcher.AutoCompleteTextBlock.Text = String.Empty;
|
||||
}
|
||||
|
||||
_viewModel.QueryText = text;
|
||||
@@ -422,7 +398,7 @@ namespace PowerLauncher
|
||||
}
|
||||
}
|
||||
|
||||
private void WindowsXamlHost_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
private void WindowsXamlHost_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
// if (sender != null && e.OriginalSource != null)
|
||||
// {
|
||||
|
||||
Reference in New Issue
Block a user