From cb200e0d842759e9fd0d53697bec3984f1da0c8f Mon Sep 17 00:00:00 2001 From: ZouJin Date: Thu, 17 Aug 2023 18:39:26 +1000 Subject: [PATCH] =?UTF-8?q?=E5=BC=BA=E9=80=80=E6=97=B6=E4=B8=8D=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Windows/MainWindow.xaml.cs | 51 +++++++++++++---------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index fd40589..4521461 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -165,38 +165,45 @@ namespace VPet_Simulator.Windows } private void Exit() { - if (IsSteamUser) - SteamClient.Shutdown();//关掉和Steam的连线 - if (Core != null) + try { - foreach (var igs in Core.Graph.GraphsList.Values) + if (IsSteamUser) + SteamClient.Shutdown();//关掉和Steam的连线 + if (Core != null) { - foreach (var ig2 in igs.Values) + foreach (var igs in Core.Graph.GraphsList.Values) { - foreach (var ig3 in ig2) + foreach (var ig2 in igs.Values) { - ig3.Stop(); + foreach (var ig3 in ig2) + { + ig3.Stop(); + } } } } + if (Main != null) + { + Main.Dispose(); + } + if (winSetting != null) + { + winSetting.Close(); + } + AutoSaveTimer?.Stop(); + MusicTimer?.Stop(); + petHelper?.Close(); + if (notifyIcon != null) + { + notifyIcon.Visible = false; + notifyIcon.Dispose(); + } + notifyIcon?.Dispose(); } - if (Main != null) + finally { - Main.Dispose(); + Environment.Exit(0); } - if (winSetting != null) - { - winSetting.Close(); - } - AutoSaveTimer?.Stop(); - MusicTimer?.Stop(); - petHelper?.Close(); - if (notifyIcon != null) - { - notifyIcon.Visible = false; - notifyIcon.Dispose(); - } - notifyIcon?.Dispose(); while (true) Environment.Exit(0); }