mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
优化退出线程
This commit is contained in:
parent
3ad01e4782
commit
2157095823
@ -356,8 +356,6 @@ namespace VPet_Simulator.Core
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
EventTimer.Stop();
|
||||
MoveTimer.Enabled = false;
|
||||
EventTimer.Dispose();
|
||||
MoveTimer.Dispose();
|
||||
MsgBar.Dispose();
|
||||
|
@ -267,9 +267,7 @@ namespace VPet_Simulator.Windows
|
||||
if (App.MainWindows.Count <= 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (IsSteamUser)
|
||||
SteamClient.Shutdown();//关掉和Steam的连线
|
||||
{
|
||||
if (Core != null && Core.Graph != null)
|
||||
{
|
||||
foreach (var igs in Core.Graph.GraphsList.Values)
|
||||
@ -283,17 +281,18 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Main != null)
|
||||
while (Windows.Count != 0)
|
||||
{
|
||||
Main.Dispose();
|
||||
}
|
||||
if (winSetting != null)
|
||||
{
|
||||
winSetting.Close();
|
||||
Windows[0].Close();
|
||||
}
|
||||
Main?.Dispose();
|
||||
AutoSaveTimer?.Stop();
|
||||
MusicTimer?.Stop();
|
||||
petHelper?.Close();
|
||||
winSetting?.Close();
|
||||
winBetterBuy?.Close();
|
||||
if (IsSteamUser)
|
||||
SteamClient.Shutdown();//关掉和Steam的连线
|
||||
if (notifyIcon != null)
|
||||
{
|
||||
notifyIcon.Visible = false;
|
||||
@ -310,10 +309,27 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Core != null && Core.Graph != null)
|
||||
{
|
||||
foreach (var igs in Core.Graph.GraphsList.Values)
|
||||
{
|
||||
foreach (var ig2 in igs.Values)
|
||||
{
|
||||
foreach (var ig3 in ig2)
|
||||
{
|
||||
ig3.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (Windows.Count != 0)
|
||||
{
|
||||
Windows[0].Close();
|
||||
}
|
||||
Main?.Dispose();
|
||||
AutoSaveTimer?.Stop();
|
||||
MusicTimer?.Stop();
|
||||
petHelper?.Close();
|
||||
winSetting?.Close();
|
||||
winBetterBuy?.Close();
|
||||
App.MainWindows.Remove(this);
|
||||
|
Loading…
Reference in New Issue
Block a user