From 9c2988362a8b543e4d76fd8473a55efba9638d1a Mon Sep 17 00:00:00 2001 From: ZouJin Date: Fri, 29 Dec 2023 03:29:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=9F=E8=AE=A1=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=95=B0=E6=8D=AE=E5=8F=98=E5=8A=A8=E6=97=B6UI?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WinDesign/winCharacterPanel.xaml.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml.cs b/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml.cs index 0a0c802..1a3cd89 100644 --- a/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winCharacterPanel.xaml.cs @@ -34,15 +34,18 @@ namespace VPet_Simulator.Windows private void Statistics_StatisticChanged(Interface.Statistics sender, string name, LinePutScript.SetObject value) { - var v = StatList.FirstOrDefault(x => x.StatId == name); - if (v != null) + Dispatcher.Invoke(() => { - v.StatCount = value.GetDouble(); - } - else - { - StatList.Add(new StatInfo(name, value.GetDouble())); - } + var v = StatList.FirstOrDefault(x => x.StatId == name); + if (v != null) + { + v.StatCount = value.GetDouble(); + } + else + { + StatList.Add(new StatInfo(name, value.GetDouble())); + } + }); } private ObservableCollection StatList { get; set; } = new();