将设备列表,变量表列表,变量列表从ObservableCollection更换为字典类型的ObservableDictionary

This commit is contained in:
2025-09-16 13:05:37 +08:00
parent ffa24f861e
commit 3102938f92
11 changed files with 58 additions and 60 deletions

View File

@@ -70,8 +70,8 @@ public class DataEventService : IDataEventService
App.Current.Dispatcher.BeginInvoke(new Action(() =>
{
// 查找并更新对应的变量
var variableToUpdate = _dataStorageService.Variables.FirstOrDefault(v => v.Id == e.VariableId);
if (variableToUpdate != null)
if (_dataStorageService.Variables.TryGetValue(e.VariableId,out var variableToUpdate))
{
variableToUpdate.DataValue = e.NewValue;
variableToUpdate.DisplayValue = e.NewValue;