private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { ModemSocketClient.Stop(); SocketServer.StopServer(); ProcessUtils.QuitAll(); Application.Current.Shutdown(0); }
static void Main(string[] args) { LogUtils.SetupLogger(); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += Application_ThreadException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (!IsAdministrator()) { MessageBox.Show("请使用管理员权限运行本软件!"); return; } //Application.Run(new WhatAppForm()); HandleStartupArgs(args); MakeAppSquirrelAware(); Task.Run(async() => { await CheckUpdate(); }); ModemSocketClient.Connect(); SocketServer.Init(); Application.Run(new AuthForm()); }