diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index c3753f53f..70aed0d19 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -12,7 +12,7 @@ xmlns:vm="clr-namespace:Flow.Launcher.ViewModel" Name="FlowMainWindow" Title="Flow Launcher" - Width="{Binding MainWindowWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" + Width="{Binding MainWindowWidth, Mode=OneTime}" MinWidth="400" MinHeight="30" d:DataContext="{d:DesignInstance Type=vm:MainViewModel}" @@ -30,7 +30,6 @@ PreviewKeyUp="OnKeyUp" ResizeMode="CanResize" ShowInTaskbar="False" - SizeChanged="Window_SizeChanged" SizeToContent="Height" Topmost="True" Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 0a63b1808..c333c4e85 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -45,7 +45,6 @@ namespace Flow.Launcher private MainViewModel _viewModel; private bool _animating; private bool isArrowKeyPressed = false; - private double WindowWidthForSave; private MediaPlayer animationSoundWMP; private SoundPlayer animationSoundWPF; @@ -121,6 +120,8 @@ namespace Flow.Launcher _settings.MaxResultsToShow = Convert.ToInt32(Math.Truncate(itemCount)); } } + + _viewModel.MainWindowWidth = Width; FlowMainWindow.SizeToContent = SizeToContent.Height; } @@ -154,9 +155,6 @@ namespace Flow.Launcher private async void OnClosing(object sender, CancelEventArgs e) { _notifyIcon.Visible = false; - /* In this timing, window alreayd closed and it effect to window size. So at this point, whenever the window changes, - we recall the width we've stored as a variable and specify it in the settings. This way, the existing window size will be recalled on the next run.*/ - _settings.WindowSize = WindowWidthForSave; App.API.SaveAppAllSettings(); e.Cancel = true; await PluginManager.DisposePluginsAsync(); @@ -834,10 +832,5 @@ namespace Flow.Launcher be.UpdateSource(); } } - - private void Window_SizeChanged(object sender, SizeChangedEventArgs e) - { - WindowWidthForSave = Width; - } } }