- Fix Window Width Save

- Removed Unused code
- Adjust MinWidth
This commit is contained in:
DB p 2024-05-28 16:27:25 +09:00
parent c9061a4303
commit b87237fd6c
3 changed files with 11 additions and 9 deletions

View file

@ -13,7 +13,7 @@
Name="FlowMainWindow"
Title="Flow Launcher"
Width="{Binding MainWindowWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
MinWidth="430"
MinWidth="400"
MinHeight="30"
d:DataContext="{d:DesignInstance Type=vm:MainViewModel}"
AllowDrop="True"
@ -30,6 +30,7 @@
PreviewKeyUp="OnKeyUp"
ResizeMode="CanResize"
ShowInTaskbar="False"
SizeChanged="Window_SizeChanged"
SizeToContent="Height"
Topmost="True"
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

View file

@ -45,6 +45,7 @@ namespace Flow.Launcher
private MainViewModel _viewModel;
private bool _animating;
private bool isArrowKeyPressed = false;
private double WindowWidthForSave;
private MediaPlayer animationSoundWMP;
private SoundPlayer animationSoundWPF;
@ -120,8 +121,6 @@ namespace Flow.Launcher
_settings.MaxResultsToShow = Convert.ToInt32(Math.Truncate(itemCount));
}
}
_viewModel.MainWindowWidth = Width;
FlowMainWindow.SizeToContent = SizeToContent.Height;
}
@ -155,6 +154,9 @@ 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();
@ -832,5 +834,10 @@ namespace Flow.Launcher
be.UpdateSource();
}
}
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
{
WindowWidthForSave = Width;
}
}
}

View file

@ -173,12 +173,6 @@ public partial class SettingsPaneThemeViewModel : BaseModel
public string DateText => DateTime.Now.ToString(DateFormat, CultureInfo.CurrentCulture);
public double WindowWidthSize
{
get => Settings.WindowSize;
set => Settings.WindowSize = value;
}
public bool UseGlyphIcons
{
get => Settings.UseGlyphIcons;