Use Hacky way to show up windows when width change.

Clear query to prevent large area of window preventing user change width.
This commit is contained in:
Kevin Zhang 2021-10-22 13:41:36 -05:00
parent 08c643adcc
commit 64a489b312
2 changed files with 14 additions and 7 deletions

View file

@ -52,6 +52,7 @@ namespace Flow.Launcher.ViewModel
private ChannelWriter<ResultsForUpdate> _resultsUpdateChannelWriter;
private Task _resultsViewUpdateTask;
private bool _keepVisibility = false;
#endregion
@ -64,10 +65,20 @@ namespace Flow.Launcher.ViewModel
_lastQuery = new Query();
_settings = settings;
_settings.PropertyChanged += (_, args) =>
_settings.PropertyChanged += async (_, args) =>
{
if (args.PropertyName == nameof(Settings.WindowSize))
{
ChangeQueryText("");
if (MainWindowVisibility == Visibility.Collapsed)
{
ToggleFlowLauncher();
_keepVisibility = true;
await Task.Delay(1000);
_keepVisibility = false;
Application.Current.MainWindow.Activate();
}
OnPropertyChanged(nameof(MainWindowWidth));
}
};
@ -742,7 +753,7 @@ namespace Flow.Launcher.ViewModel
public void Hide()
{
if (MainWindowVisibility != Visibility.Collapsed)
if (MainWindowVisibility != Visibility.Collapsed && !_keepVisibility)
{
ToggleFlowLauncher();
}

View file

@ -309,11 +309,7 @@ namespace Flow.Launcher.ViewModel
public double WindowWidthSize
{
get => Settings.WindowSize;
set
{
Settings.WindowSize = value;
Application.Current.MainWindow.Visibility = Visibility.Visible;
}
set => Settings.WindowSize = value;
}
public bool UseGlyphIcons