mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
优化重启功能
This commit is contained in:
parent
efefbe35eb
commit
c5fdab3647
@ -81,6 +81,33 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
Task.Run(GameLoad);
|
||||
}
|
||||
public new void Close()
|
||||
{
|
||||
if (Main == null)
|
||||
{
|
||||
base.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.DisplayClose(() => Dispatcher.Invoke(base.Close));
|
||||
}
|
||||
}
|
||||
public void Restart()
|
||||
{
|
||||
this.Closed -= Window_Closed;
|
||||
this.Closed += Restart_Closed;
|
||||
base.Close();
|
||||
}
|
||||
|
||||
private void Restart_Closed(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
Main?.Dispose();
|
||||
notifyIcon?.Dispose();
|
||||
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
System.Environment.Exit(0);
|
||||
}
|
||||
|
||||
private List<string> rndtext = new List<string>
|
||||
{
|
||||
"你知道吗? 鼠标右键可以打开菜单栏",
|
||||
|
@ -440,8 +440,7 @@ namespace VPet_Simulator.Windows
|
||||
{
|
||||
if (MessageBoxX.Show("是否退出游戏<虚拟桌宠模拟器>?\n请注意保存游戏", "重启游戏", MessageBoxButton.YesNo, MessageBoxIcon.Warning) == MessageBoxResult.Yes)
|
||||
{
|
||||
mw.Close();
|
||||
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
mw.Restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user