Browse Source

add argument to reset window position on startup

pull/55/head
JT 1 year ago
parent
commit
a380cd6a38
  1. 2
      StabilityMatrix.Avalonia/App.axaml.cs
  2. 5
      StabilityMatrix.Avalonia/Models/AppArgs.cs
  3. 2
      StabilityMatrix.Avalonia/Program.cs

2
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;

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