Files
2026-11-20 18:44:14 +08:00

36 lines
990 B
C#

using System;
using System.Windows;
using ZNTechClone.Services;
namespace ZNTechClone
{
public partial class App : Application
{
public static LocalServer Server { get; private set; }
public static AppSession Session { get; } = new AppSession();
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
ShutdownMode = ShutdownMode.OnLastWindowClose;
Server = new LocalServer();
try { Server.Start(); }
catch (Exception ex)
{
MessageBox.Show("本地授权服务启动失败:" + ex.Message, "ZNTechClone", MessageBoxButton.OK, MessageBoxImage.Warning);
}
var login = new LoginWindow();
login.Show();
}
protected override void OnExit(ExitEventArgs e)
{
try { Server?.Stop(); } catch { }
MacroEngine.StopAll();
base.OnExit(e);
}
}
}