为投喂面板添加内存回收

This commit is contained in:
ZouJin 2024-03-21 14:36:31 +08:00
parent e3ff6fb564
commit abd339c222
6 changed files with 24 additions and 10 deletions

View File

@ -23,7 +23,7 @@
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="LinePutScript" Version="1.11.5" />
<PackageReference Include="LinePutScript" Version="1.11.6" />
<PackageReference Include="LinePutScript.Localization.WPF" Version="1.0.6" />
<PackageReference Include="Panuon.WPF" Version="1.1.0" />
<PackageReference Include="Panuon.WPF.UI" Version="1.2.1" />

View File

@ -16,7 +16,7 @@
<ProjectReference Include="..\VPet-Simulator.Core\VPet-Simulator.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="LinePutScript" Version="1.11.5" />
<PackageReference Include="LinePutScript" Version="1.11.6" />
<PackageReference Include="LinePutScript.Localization.WPF" Version="1.0.6" />
<PackageReference Include="Panuon.WPF" Version="1.1.0" />
<PackageReference Include="Panuon.WPF.UI" Version="1.2.1" />

View File

@ -326,28 +326,41 @@ public partial class MPFriends : WindowX, IMPFriend
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "吃饭".Translate(), () =>
{
new winMPBetterBuy(this).Show(Food.FoodType.Meal);
ShowBetterBuy(Food.FoodType.Meal);
});
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "喝水".Translate(), () =>
{
new winMPBetterBuy(this).Show(Food.FoodType.Drink);
ShowBetterBuy(Food.FoodType.Drink);
});
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "收藏".Translate(), () =>
{
new winMPBetterBuy(this).Show(Food.FoodType.Star);
ShowBetterBuy(Food.FoodType.Star);
});
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "药品".Translate(), () =>
{
new winMPBetterBuy(this).Show(Food.FoodType.Drug);
ShowBetterBuy(Food.FoodType.Drug);
});
Main.ToolBar.AddMenuButton(ToolBar.MenuType.Feed, "礼品".Translate(), () =>
{
new winMPBetterBuy(this).Show(Food.FoodType.Gift);
ShowBetterBuy(Food.FoodType.Gift);
});
Loaded = true;
}));
}
public winMPBetterBuy winMPBetterBuy;
public void ShowBetterBuy(Food.FoodType foodType)
{
if (winMPBetterBuy != null)
winMPBetterBuy.Show(foodType);
else
{
winMPBetterBuy = new winMPBetterBuy(this);
winMPBetterBuy.Show(foodType);
}
}
public new bool Loaded = false;
/// <summary>
@ -618,6 +631,7 @@ public partial class MPFriends : WindowX, IMPFriend
}
}
}
winMPBetterBuy.Close();
Main?.Dispose();
mw.Windows.Remove(this);
}

View File

@ -267,7 +267,7 @@ namespace VPet_Simulator.Windows
private void WindowX_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
mf.winMPBetterBuy = null;
}
private void Switch_Loaded(object sender, RoutedEventArgs e)

View File

@ -214,7 +214,7 @@
<ItemGroup>
<PackageReference Include="Facepunch.Steamworks" Condition="'$(Platform)' == 'x64'" Version="2.3.3" />
<PackageReference Include="Facepunch.Steamworks.win32" Condition="'$(Platform)' == 'x86'" Version="2.3.3" />
<PackageReference Include="LinePutScript" Version="1.11.5" />
<PackageReference Include="LinePutScript" Version="1.11.6" />
<PackageReference Include="LinePutScript.Localization.WPF" Version="1.0.6" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="NAudio" Version="2.2.1" />

View File

@ -20,7 +20,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="FastMember" Version="1.5.0" />
<PackageReference Include="LinePutScript" Version="1.11.5" />
<PackageReference Include="LinePutScript" Version="1.11.6" />
<PackageReference Include="LinePutScript.Localization.WPF" Version="1.0.6" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Panuon.WPF" Version="1.1.0" />