private void Exit() { if (Connection.CurJudgingCnt != 0) { MessageBox.Show($"仍有 {Connection.CurJudgingCnt} 项评测任务正在进行,不能退出程序", "提示", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (MessageBox.Show("退出程序后已连接的所有客户端将被断开,确定继续?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No) { return; } _notifyIcon.Visible = false; Connection.IsExited = true; new Thread(() => { Connection.LogoutAll(); Environment.Exit(0); }).Start(); }