|
|
|
@ -152,7 +152,7 @@ public sealed class App : Application
|
|
|
|
|
|
|
|
|
|
var settingsManager = Services.GetRequiredService<ISettingsManager>(); |
|
|
|
|
var windowSettings = settingsManager.Settings.WindowSettings; |
|
|
|
|
if (windowSettings != null) |
|
|
|
|
if (windowSettings != null && !Program.Args.ResetWindowPosition) |
|
|
|
|
{ |
|
|
|
|
mainWindow.Position = new PixelPoint(windowSettings.X, windowSettings.Y); |
|
|
|
|
mainWindow.Width = windowSettings.Width; |
|
|
|
@ -165,12 +165,16 @@ public sealed class App : Application
|
|
|
|
|
|
|
|
|
|
mainWindow.Closing += (_, _) => |
|
|
|
|
{ |
|
|
|
|
var validWindowPosition = |
|
|
|
|
mainWindow.Screens.All.Any(screen => screen.Bounds.Contains(mainWindow.Position)); |
|
|
|
|
|
|
|
|
|
settingsManager.Transaction(s => |
|
|
|
|
{ |
|
|
|
|
s.WindowSettings = new WindowSettings( |
|
|
|
|
mainWindow.Width, mainWindow.Height, |
|
|
|
|
mainWindow.Position.X, mainWindow.Position.Y); |
|
|
|
|
}, ignoreMissingLibraryDir: true); |
|
|
|
|
{ |
|
|
|
|
s.WindowSettings = new WindowSettings( |
|
|
|
|
mainWindow.Width, mainWindow.Height, |
|
|
|
|
validWindowPosition ? mainWindow.Position.X : 0, |
|
|
|
|
validWindowPosition ? mainWindow.Position.Y : 0); |
|
|
|
|
}, ignoreMissingLibraryDir: true); |
|
|
|
|
}; |
|
|
|
|
mainWindow.Closed += (_, _) => Shutdown(); |
|
|
|
|
|
|
|
|
|