From d469dda7ab3b8d705912887acfd4eb997273ea75 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Tue, 31 Oct 2023 14:34:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=A4=9A=E5=BC=80=E6=97=B6?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=A4=9A=E5=BC=80=E7=9B=B8=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E5=92=8C=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Windows/MainWindow.cs | 1 + VPet-Simulator.Windows/MainWindow.xaml.cs | 4 ++++ VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml | 2 +- VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml.cs | 4 +++- VPet-Simulator.Windows/WinDesign/winConsole.xaml | 2 +- VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs | 6 ++++++ VPet-Simulator.Windows/WinDesign/winReport.xaml | 3 ++- VPet-Simulator.Windows/WinDesign/winReport.xaml.cs | 6 ++++++ 8 files changed, 24 insertions(+), 4 deletions(-) diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 43f2066..d75b43a 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -47,6 +47,7 @@ namespace VPet_Simulator.Windows public List Pets { get; set; } = new List(); public List CoreMODs = new List(); public GameCore Core { get; set; } = new GameCore(); + public List Windows { get; set; } = new List(); public Main Main { get; set; } public UIElement TalkBox; public winGameSetting winSetting { get; set; } diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 186636e..19db9ba 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -279,6 +279,10 @@ namespace VPet_Simulator.Windows } else { + while (Windows.Count != 0) + { + Windows[0].Close(); + } winSetting?.Close(); winBetterBuy?.Close(); App.MainWindows.Remove(this); diff --git a/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml b/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml index f9c2274..f63c7fe 100644 --- a/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml +++ b/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml @@ -5,7 +5,7 @@ xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF" xmlns:local="clr-namespace:VPet_Simulator.Windows" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Title="{ll:Str 面板}" Width="500" Height="500" + xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Title="面板" Width="500" Height="500" Style="{DynamicResource BaseWindowXStyle}" WindowStartupLocation="CenterScreen" mc:Ignorable="d" Closed="WindowX_Closed"> diff --git a/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml.cs b/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml.cs index 8a2c5cb..0a0c802 100644 --- a/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml.cs @@ -22,7 +22,8 @@ namespace VPet_Simulator.Windows { this.mw = mw; InitializeComponent(); - + Title = "面板".Translate() + ' ' + mw.PrefixSave; + mw.Windows.Add(this); foreach (var v in mw.GameSavesData.Statistics.Data) { StatList.Add(new StatInfo(v.Key, v.Value.GetDouble())); @@ -203,6 +204,7 @@ namespace VPet_Simulator.Windows private void WindowX_Closed(object sender, EventArgs e) { mw.GameSavesData.Statistics.StatisticChanged -= Statistics_StatisticChanged; + mw.Windows.Remove(this); } } } diff --git a/VPet-Simulator.Windows/WinDesign/winConsole.xaml b/VPet-Simulator.Windows/WinDesign/winConsole.xaml index 9c1b9c8..57783d9 100644 --- a/VPet-Simulator.Windows/WinDesign/winConsole.xaml +++ b/VPet-Simulator.Windows/WinDesign/winConsole.xaml @@ -5,7 +5,7 @@ xmlns:local="clr-namespace:VPet_Simulator.Windows" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Width="450" Height="450" FontSize="16" - mc:Ignorable="d"> + mc:Ignorable="d" Closed="Window_Closed"> diff --git a/VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs b/VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs index 1a5f6e8..dba303c 100644 --- a/VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs @@ -22,6 +22,7 @@ namespace VPet_Simulator.Windows MainWindow mw; public winConsole(MainWindow mw) { + mw.Windows.Add(this); InitializeComponent(); Title = "桌宠管理开发控制台".Translate() + ' ' + mw.PrefixSave; this.mw = mw; @@ -173,6 +174,11 @@ namespace VPet_Simulator.Windows { mw.Core.Graph.GraphConfig.Moves[9].Display(mw.Main); } + + private void Window_Closed(object sender, EventArgs e) + { + mw.Windows.Remove(this); + } //private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) //{ // switch(((TabControl)sender).SelectedIndex) diff --git a/VPet-Simulator.Windows/WinDesign/winReport.xaml b/VPet-Simulator.Windows/WinDesign/winReport.xaml index a8be99b..e7e47f8 100644 --- a/VPet-Simulator.Windows/WinDesign/winReport.xaml +++ b/VPet-Simulator.Windows/WinDesign/winReport.xaml @@ -6,7 +6,8 @@ xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" xmlns:system="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" Style="{DynamicResource BaseWindowXStyle}" WindowStartupLocation="CenterScreen" Width="500" MinHeight="250" - Height="Auto" ResizeMode="NoResize" WindowState="Normal" Icon="../vpeticon.ico" SizeToContent="Height"> + Height="Auto" ResizeMode="NoResize" WindowState="Normal" Icon="../vpeticon.ico" SizeToContent="Height" + Closed="WindowX_Closed">