From 2bd31b6bd285a40646e2e5148774a5aac0dcedbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8D=E7=BE=BD=E9=9D=92=E7=A9=BA?= Date: Fri, 21 Mar 2025 13:11:15 +0800 Subject: [PATCH] Delete ServerLauncher/Window1.xaml.cs --- ServerLauncher/Window1.xaml.cs | 51 ---------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 ServerLauncher/Window1.xaml.cs diff --git a/ServerLauncher/Window1.xaml.cs b/ServerLauncher/Window1.xaml.cs deleted file mode 100644 index 53b1c7f..0000000 --- a/ServerLauncher/Window1.xaml.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Diagnostics; -using System.Windows; -using System.Windows.Media; -using System.Windows.Threading; - -namespace ServerLauncher -{ - public partial class NewWindow : Window - { - private DispatcherTimer timer; - - public NewWindow() - { - InitializeComponent(); - - // 初始化定时器 - timer = new DispatcherTimer(); - timer.Interval = TimeSpan.FromSeconds(5); // 每 5 秒检测一次 - timer.Tick += Timer_Tick; - timer.Start(); - - // 初始检测 - CheckTslGameProcess(); - } - - private void Timer_Tick(object sender, EventArgs e) - { - // 定时检测进程状态 - CheckTslGameProcess(); - } - - private void CheckTslGameProcess() - { - // 获取所有名为 "TslGame" 的进程 - Process[] processes = Process.GetProcessesByName("TslGame"); - - if (processes.Length > 0) - { - // 如果进程存在,更新界面为“运行”,并设置为绿色 - StatusText.Text = "运行"; - StatusText.Foreground = new SolidColorBrush(Colors.Green); - } - else - { - // 如果进程不存在,更新界面为“未运行”,并设置为红色 - StatusText.Text = "未运行"; - StatusText.Foreground = new SolidColorBrush(Colors.Red); - } - } - } -} \ No newline at end of file