using Microsoft.UI.Xaml;
namespace Pokerfreak.Cockpit;
/// Start: ein Fenster, eine Verbindung zum Server (Kern/Verbindung.cs).
public partial class App : Application
{
private static App? _laufend;
private MainWindow? _fenster;
/// Ein zweiter Start wurde hierher gereicht (Programm.cs): das Cockpit nach vorn holen.
public static void Aktiviert()
{
var f = _laufend?._fenster;
f?.DispatcherQueue.TryEnqueue(f.Hervorholen);
}
public App()
{
InitializeComponent();
_laufend = this;
// Ein Absturz hinterlaesst seinen Grund in %APPDATA%\Pokerfreakbsturz.txt (sonst sieht man nur
// "Microsoft.UI.Xaml.dll" im Ereignisprotokoll).
UnhandledException += (_, e) => Seiten.Merker.Absturz(e.Exception);
}
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
try
{
_fenster = new MainWindow(Kern.Adresse.AusBefehlszeile(Environment.GetCommandLineArgs()));
_fenster.Activate();
}
catch (Exception e)
{
Seiten.Merker.Absturz(e);
throw;
}
}
}