feat: add ui exit on ctrl+c

This commit is contained in:
2026-02-04 15:08:25 +03:00
parent f28e59d8f5
commit d475b05a96
2 changed files with 17 additions and 0 deletions
+15
View File
@@ -1,11 +1,15 @@
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging.Console;
using Avalonia;
using Avalonia.OpenGL.Egl;
using GSS2.Core;
using GSS2.Core.Logging;
using GSS2.Core.Analysis.AmineContent.Database;
using ConsoleFormatter = GSS2.Core.Logging.ConsoleFormatter;
namespace GSS2.Test;
@@ -13,6 +17,7 @@ namespace GSS2.Test;
public class Program
{
public static IHost ApplicationHost { get; } = BuildHostApp();
public static event ConsoleCancelEventHandler? ShutdownRequested;
[STAThread]
public static int Main(string[] args)
@@ -33,9 +38,19 @@ public class Program
Console.WriteLine($"\t--console - in DRM rendering mode do not suppress console output");
return 0;
}
Console.CancelKeyPress += new ConsoleCancelEventHandler(OnProgramShutdown);
Console.WriteLine("Press Ctrl+C to shut down.");
return builder.StartWithClassicDesktopLifetime(args);
}
private static void OnProgramShutdown(object? sender, ConsoleCancelEventArgs ea)
{
ShutdownRequested?.Invoke(sender, ea);
ea.Cancel = true;
}
private static void SilenceConsole()
{
new Thread(() =>