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 settingsManager = Services.GetRequiredService<ISettingsManager>();
var windowSettings = settingsManager.Settings.WindowSettings; var windowSettings = settingsManager.Settings.WindowSettings;
if (windowSettings != null) if (windowSettings != null && !Program.Args.ResetWindowPosition)
{ {
mainWindow.Position = new PixelPoint(windowSettings.X, windowSettings.Y); mainWindow.Position = new PixelPoint(windowSettings.X, windowSettings.Y);
mainWindow.Width = windowSettings.Width; mainWindow.Width = windowSettings.Width;

5
StabilityMatrix.Avalonia/Models/AppArgs.cs

@ -25,4 +25,9 @@ public class AppArgs
/// Whether to disable window chrome effects /// Whether to disable window chrome effects
/// </summary> /// </summary>
public bool NoWindowChromeEffects { get; set; } 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;
using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Threading; using Avalonia.Threading;
using Microsoft.Extensions.DependencyInjection;
using NLog; using NLog;
using Polly.Contrib.WaitAndRetry; using Polly.Contrib.WaitAndRetry;
using Projektanker.Icons.Avalonia; using Projektanker.Icons.Avalonia;
@ -44,6 +45,7 @@ public class Program
Args.DebugSentry = args.Contains("--debug-sentry"); Args.DebugSentry = args.Contains("--debug-sentry");
Args.NoSentry = args.Contains("--no-sentry"); Args.NoSentry = args.Contains("--no-sentry");
Args.NoWindowChromeEffects = args.Contains("--no-window-chrome-effects"); Args.NoWindowChromeEffects = args.Contains("--no-window-chrome-effects");
Args.ResetWindowPosition = args.Contains("--reset-window-position");
SetDebugBuild(); SetDebugBuild();

Loading…
Cancel
Save