mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
"Clear the previous query on launch" has a flicker (#10291)
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
Closing="OnClosing"
|
||||
Background="Transparent"
|
||||
LocationChanged="OnLocationChanged"
|
||||
Activated="OnActivated"
|
||||
Deactivated="OnDeactivated"
|
||||
IsVisibleChanged="OnVisibilityChanged"
|
||||
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
|
||||
@@ -161,20 +161,12 @@ namespace PowerLauncher
|
||||
_settings.WindowLeft = Left;
|
||||
}
|
||||
|
||||
private void OnActivated(object sender, EventArgs e)
|
||||
{
|
||||
if (_settings.ClearInputOnLaunch)
|
||||
{
|
||||
_viewModel.ClearQueryCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDeactivated(object sender, EventArgs e)
|
||||
{
|
||||
if (_settings.HideWhenDeactivated)
|
||||
{
|
||||
// (this.FindResource("OutroStoryboard") as Storyboard).Begin();
|
||||
Hide();
|
||||
_viewModel.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using interop;
|
||||
using Microsoft.PowerLauncher.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
@@ -154,7 +155,7 @@ namespace PowerLauncher.ViewModel
|
||||
// SelectedItem returns null if selection is empty.
|
||||
if (result != null && result.Action != null)
|
||||
{
|
||||
MainWindowVisibility = Visibility.Collapsed;
|
||||
Hide();
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
@@ -193,7 +194,7 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindowVisibility = Visibility.Collapsed;
|
||||
Hide();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -805,7 +806,7 @@ namespace PowerLauncher.ViewModel
|
||||
});
|
||||
}
|
||||
|
||||
private void ToggleWox()
|
||||
public void ToggleWox()
|
||||
{
|
||||
if (MainWindowVisibility != Visibility.Visible)
|
||||
{
|
||||
@@ -813,7 +814,30 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindowVisibility = Visibility.Collapsed;
|
||||
if (_settings.ClearInputOnLaunch && Results.Visibility == Visibility.Visible)
|
||||
{
|
||||
ClearQueryCommand.Execute(null);
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
|
||||
{
|
||||
MainWindowVisibility = Visibility.Collapsed;
|
||||
}));
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindowVisibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
if (MainWindowVisibility != Visibility.Collapsed)
|
||||
{
|
||||
ToggleWox();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user