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