mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
"Clear the previous query on launch" has a flicker (#10291)
This commit is contained in:
@@ -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