mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
One-time binding for main window width
This commit is contained in:
parent
b87237fd6c
commit
52d142cb16
2 changed files with 3 additions and 11 deletions
|
|
@ -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}"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue