Browse Source

Merge branch 'fixes' of https://github.com/ionite34/StabilityMatrix into fixes

pull/55/head
Ionite 1 year ago
parent
commit
0643d9f5d7
No known key found for this signature in database
  1. 16
      StabilityMatrix.Avalonia/App.axaml.cs
  2. 5
      StabilityMatrix.Avalonia/Models/AppArgs.cs
  3. 2
      StabilityMatrix.Avalonia/Program.cs

16
StabilityMatrix.Avalonia/App.axaml.cs

@ -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();

5
StabilityMatrix.Avalonia/Models/AppArgs.cs

@ -25,4 +25,9 @@ public class AppArgs
/// Whether to disable window chrome effects
/// </summary>
public bool NoWindowChromeEffects { get; set; }
/// <summary>
/// Flag to indicate if we should reset the saved window position back to (O,0)
/// </summary>
public bool ResetWindowPosition { get; set; }
}

2
StabilityMatrix.Avalonia/Program.cs

@ -12,6 +12,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Threading;
using Microsoft.Extensions.DependencyInjection;
using NLog;
using Polly.Contrib.WaitAndRetry;
using Projektanker.Icons.Avalonia;
@ -44,6 +45,7 @@ public class Program
Args.DebugSentry = args.Contains("--debug-sentry");
Args.NoSentry = args.Contains("--no-sentry");
Args.NoWindowChromeEffects = args.Contains("--no-window-chrome-effects");
Args.ResetWindowPosition = args.Contains("--reset-window-position");
SetDebugBuild();

Loading…
Cancel
Save