Eigenes Main (Programm.cs) mit AppInstance.FindOrRegisterForKey: der zweite Prozess reicht seine Aktivierung weiter und endet; das erste kommt nach vorn und klappt die Pille aus. Geprueft: zwei Starts -> ein Prozess. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using Microsoft.UI.Xaml;
|
|
|
|
namespace Pokerfreak.Cockpit;
|
|
|
|
/// <summary>Start: ein Fenster, eine Verbindung zum Server (Kern/Verbindung.cs).</summary>
|
|
public partial class App : Application
|
|
{
|
|
private static App? _laufend;
|
|
private MainWindow? _fenster;
|
|
|
|
/// <summary>Ein zweiter Start wurde hierher gereicht (Programm.cs): das Cockpit nach vorn holen.</summary>
|
|
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;
|
|
}
|
|
}
|
|
}
|