mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
修复统计面板数据变动时UI线程错误
This commit is contained in:
parent
99cd13b21a
commit
9c2988362a
@ -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<StatInfo> StatList { get; set; } = new();
|
||||
|
Loading…
x
Reference in New Issue
Block a user