修复可能的窗口大小不正确问题
This commit is contained in:
@@ -142,12 +142,13 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
private void SaveLastState()
|
private void SaveLastState()
|
||||||
{
|
{
|
||||||
|
var rb = RestoreBounds;
|
||||||
var m = new LastStateModel()
|
var m = new LastStateModel()
|
||||||
{
|
{
|
||||||
WindowLeft = Left,
|
WindowLeft = rb.Left,
|
||||||
WindowTop = Top,
|
WindowTop = rb.Top,
|
||||||
WindowWidth = Width,
|
WindowWidth = rb.Width,
|
||||||
WindowHeight = Height,
|
WindowHeight = rb.Height,
|
||||||
WindowState = WindowState,
|
WindowState = WindowState,
|
||||||
|
|
||||||
RootGridCol0Width = _rootGrid.ColumnDefinitions[0].Width.Value,
|
RootGridCol0Width = _rootGrid.ColumnDefinitions[0].Width.Value,
|
||||||
@@ -226,9 +227,8 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
private void MainWindow_Closing(object? sender, CancelEventArgs e)
|
private void MainWindow_Closing(object? sender, CancelEventArgs e)
|
||||||
{
|
{
|
||||||
if (_vm.IsShuttingDownFromTray)
|
if (!_vm.IsShuttingDownFromTray)
|
||||||
return;
|
{
|
||||||
|
|
||||||
if (_vm.CloseToTray is null)
|
if (_vm.CloseToTray is null)
|
||||||
{
|
{
|
||||||
_vm.PreferenceViewModel.CloseToTray = MessagePopupService.YesNo(AppResource.Str_CloseToTrayQuest);
|
_vm.PreferenceViewModel.CloseToTray = MessagePopupService.YesNo(AppResource.Str_CloseToTrayQuest);
|
||||||
@@ -238,15 +238,17 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
Hide();
|
Hide();
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SaveLastState();
|
||||||
|
_vm.SFMLRendererViewModel.StopRender();
|
||||||
|
}
|
||||||
|
|
||||||
private void MainWindow_Closed(object? sender, EventArgs e)
|
private void MainWindow_Closed(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SaveLastState();
|
|
||||||
|
|
||||||
var vm = _vm.SFMLRendererViewModel;
|
|
||||||
vm.StopRender();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user