mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
为夹层动画添加内存回收
This commit is contained in:
parent
0f5cd6a26a
commit
765b359840
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using static VPet_Simulator.Core.IGraph;
|
||||
|
||||
namespace VPet_Simulator.Core
|
||||
@ -280,7 +281,14 @@ namespace VPet_Simulator.Core
|
||||
var BL = GraphCore.FindGraph(Back_Lay, GraphInfo.Animat, GraphInfo.ModeType);
|
||||
var t1 = FL?.Run(FoodGrid.Front);
|
||||
var t2 = BL?.Run(FoodGrid.Back);
|
||||
if (FoodGrid.Food.Source != image)
|
||||
{
|
||||
if (FoodGrid.Food.Source is BitmapImage bitmapImage)
|
||||
{//内存回收
|
||||
bitmapImage.StreamSource?.Dispose();
|
||||
}
|
||||
FoodGrid.Food.Source = image;
|
||||
}
|
||||
t1?.Start();
|
||||
t2?.Start();
|
||||
Task.Run(() => Animations[0].Run(FoodGrid.Food, EndAction));
|
||||
|
Loading…
Reference in New Issue
Block a user