Migrate remaining legacy operator workflows

This commit is contained in:
2026-07-12 05:39:27 +09:00
parent ffb8f43c19
commit a01836a2d7
132 changed files with 20566 additions and 720 deletions

View File

@@ -1,3 +1,5 @@
using Microsoft.Windows.AppLifecycle;
namespace MBN_STOCK_WEBVIEW;
/// <summary>
@@ -5,16 +7,53 @@ namespace MBN_STOCK_WEBVIEW;
/// </summary>
public partial class App : Application
{
private const string MainInstanceKey = "Wickedness.MBNStockWebView.Main";
private Window? _window;
private AppInstance? _mainInstance;
public App()
{
InitializeComponent();
}
protected override void OnLaunched(LaunchActivatedEventArgs args)
protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
var registeredInstance = AppInstance.FindOrRegisterForKey(MainInstanceKey);
if (!registeredInstance.IsCurrent)
{
try
{
var activation = AppInstance.GetCurrent().GetActivatedEventArgs();
if (activation is not null)
{
await registeredInstance.RedirectActivationToAsync(activation);
}
}
finally
{
// The secondary process owns no DB, WebView, or playout runtime. End it only
// after the activation has been handed to the registered primary instance.
Exit();
}
return;
}
_mainInstance = registeredInstance;
_mainInstance.Activated += OnMainInstanceActivated;
_window = new MainWindow();
_window.Activate();
}
private void OnMainInstanceActivated(object? sender, AppActivationArguments args)
{
var window = _window;
if (window is null)
{
return;
}
window.DispatcherQueue.TryEnqueue(window.Activate);
}
}