From af28d96bf98433a47b5aadfe188d2001ba02e5b6 Mon Sep 17 00:00:00 2001 From: Space Time Date: Fri, 20 Dec 2024 11:09:32 +0800 Subject: [PATCH] =?UTF-8?q?1.1.3=20->=201.1.4=20=E7=AC=AC84=E6=AC=A1?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Wins/MainWin.xaml.cs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/Wins/MainWin.xaml.cs b/Wins/MainWin.xaml.cs index d6803d2..18b9c9e 100644 --- a/Wins/MainWin.xaml.cs +++ b/Wins/MainWin.xaml.cs @@ -313,20 +313,21 @@ public partial class MainWin : Window } } else - { foreach (Process nginxProcess in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(MainConst.NginxPath))) { + nginxProcess.Exited += async (_, _) => + { + await NginxCleaner.Clean(); + + NginxHttpPort = 80; + NginxHttpsPort = 443; + NginxConfWatcher_Changed(null!, null!); + }; + nginxProcess.Kill(); - nginxProcess.WaitForExit(); } - - await NginxCleaner.Clean(); - - NginxHttpPort = 80; - NginxHttpsPort = 443; - NginxConfWatcher_Changed(null!, null!); - } } + private void MihomoButton_Click(object sender, RoutedEventArgs e) { if (HoldButtonTimer == null || HoldButtonTimer.IsEnabled) @@ -393,16 +394,16 @@ public partial class MainWin : Window } } else - { foreach (Process mihomoProcess in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(MainConst.MihomoPath))) { - mihomoProcess.Kill(); - mihomoProcess.WaitForExit(); - } + mihomoProcess.Exited += (_, _) => + { + MihomoMixedPort = 7880; + MihomoConfWatcher_Changed(null!, null!); + }; - MihomoMixedPort = 7880; - MihomoConfWatcher_Changed(null!, null!); - } + mihomoProcess.Kill(); + } } private async void EditHostButton_Click(object sender, RoutedEventArgs e)