关闭多开时关闭多开相应的面板和窗口

This commit is contained in:
ZouJin 2023-10-31 14:34:57 +08:00
parent b11c5b736f
commit d469dda7ab
8 changed files with 24 additions and 4 deletions

View File

@ -47,6 +47,7 @@ namespace VPet_Simulator.Windows
public List<PetLoader> Pets { get; set; } = new List<PetLoader>(); public List<PetLoader> Pets { get; set; } = new List<PetLoader>();
public List<CoreMOD> CoreMODs = new List<CoreMOD>(); public List<CoreMOD> CoreMODs = new List<CoreMOD>();
public GameCore Core { get; set; } = new GameCore(); public GameCore Core { get; set; } = new GameCore();
public List<Window> Windows { get; set; } = new List<Window>();
public Main Main { get; set; } public Main Main { get; set; }
public UIElement TalkBox; public UIElement TalkBox;
public winGameSetting winSetting { get; set; } public winGameSetting winSetting { get; set; }

View File

@ -279,6 +279,10 @@ namespace VPet_Simulator.Windows
} }
else else
{ {
while (Windows.Count != 0)
{
Windows[0].Close();
}
winSetting?.Close(); winSetting?.Close();
winBetterBuy?.Close(); winBetterBuy?.Close();
App.MainWindows.Remove(this); App.MainWindows.Remove(this);

View File

@ -5,7 +5,7 @@
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF" xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:local="clr-namespace:VPet_Simulator.Windows" xmlns:local="clr-namespace:VPet_Simulator.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 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" Style="{DynamicResource BaseWindowXStyle}" WindowStartupLocation="CenterScreen" mc:Ignorable="d"
Closed="WindowX_Closed"> Closed="WindowX_Closed">
<Window.Resources> <Window.Resources>

View File

@ -22,7 +22,8 @@ namespace VPet_Simulator.Windows
{ {
this.mw = mw; this.mw = mw;
InitializeComponent(); InitializeComponent();
Title = "面板".Translate() + ' ' + mw.PrefixSave;
mw.Windows.Add(this);
foreach (var v in mw.GameSavesData.Statistics.Data) foreach (var v in mw.GameSavesData.Statistics.Data)
{ {
StatList.Add(new StatInfo(v.Key, v.Value.GetDouble())); 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) private void WindowX_Closed(object sender, EventArgs e)
{ {
mw.GameSavesData.Statistics.StatisticChanged -= Statistics_StatisticChanged; mw.GameSavesData.Statistics.StatisticChanged -= Statistics_StatisticChanged;
mw.Windows.Remove(this);
} }
} }
} }

View File

@ -5,7 +5,7 @@
xmlns:local="clr-namespace:VPet_Simulator.Windows" xmlns:local="clr-namespace:VPet_Simulator.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 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" 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">
<TabControl pu:TabControlHelper.HeaderPanelBackground="{DynamicResource PrimaryLight}" <TabControl pu:TabControlHelper.HeaderPanelBackground="{DynamicResource PrimaryLight}"
pu:TabControlHelper.ItemsSelectedBackground="White"> pu:TabControlHelper.ItemsSelectedBackground="White">
<TabItem Header="{ll:Str 动画列表}"> <TabItem Header="{ll:Str 动画列表}">

View File

@ -22,6 +22,7 @@ namespace VPet_Simulator.Windows
MainWindow mw; MainWindow mw;
public winConsole(MainWindow mw) public winConsole(MainWindow mw)
{ {
mw.Windows.Add(this);
InitializeComponent(); InitializeComponent();
Title = "桌宠管理开发控制台".Translate() + ' ' + mw.PrefixSave; Title = "桌宠管理开发控制台".Translate() + ' ' + mw.PrefixSave;
this.mw = mw; this.mw = mw;
@ -173,6 +174,11 @@ namespace VPet_Simulator.Windows
{ {
mw.Core.Graph.GraphConfig.Moves[9].Display(mw.Main); 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) //private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
//{ //{
// switch(((TabControl)sender).SelectedIndex) // switch(((TabControl)sender).SelectedIndex)

View File

@ -6,7 +6,8 @@
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
xmlns:system="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" xmlns:system="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d"
Style="{DynamicResource BaseWindowXStyle}" WindowStartupLocation="CenterScreen" Width="500" MinHeight="250" 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">
<StackPanel x:Name="MainGrid" Margin="10,10,15,10" VerticalAlignment="Top"> <StackPanel x:Name="MainGrid" Margin="10,10,15,10" VerticalAlignment="Top">
<Label Background="{x:Null}" VerticalAlignment="Top" HorizontalAlignment="Left" Content="{ll:Str 反馈与错误提交}" <Label Background="{x:Null}" VerticalAlignment="Top" HorizontalAlignment="Left" Content="{ll:Str 反馈与错误提交}"
FontSize="24" Margin="10,0,0,0" /> FontSize="24" Margin="10,0,0,0" />

View File

@ -20,6 +20,7 @@ namespace VPet_Simulator.Windows
public bool StoreSize => false; public bool StoreSize => false;
public winReport(MainWindow mainw, string errmsg = null) public winReport(MainWindow mainw, string errmsg = null)
{ {
mainw.Windows.Add(this);
InitializeComponent(); InitializeComponent();
mw = mainw; mw = mainw;
Title = "反馈中心".Translate() + ' ' + mw.PrefixSave; Title = "反馈中心".Translate() + ' ' + mw.PrefixSave;
@ -134,5 +135,10 @@ namespace VPet_Simulator.Windows
tUpload.IsChecked = false; tUpload.IsChecked = false;
} }
} }
private void WindowX_Closed(object sender, EventArgs e)
{
mw.Windows.Remove(this);
}
} }
} }