refactor:完成重构设备的添加,删除,更新。

This commit is contained in:
2025-10-22 14:06:16 +08:00
parent e995ec7207
commit 54d040b45f
76 changed files with 1028 additions and 1161 deletions

View File

@@ -21,26 +21,26 @@ namespace DMS.WPF.Services;
public class DataEventService : IDataEventService
{
private readonly IMapper _mapper;
private readonly IWpfDataService _dataStorageService;
private readonly IViewDataService _viewDataService;
private readonly IEventService _eventService;
private readonly INotificationService _notificationService;
private readonly IAppCenterService _appCenterService;
private readonly IWPFDataService _wpfDataService;
private readonly IViewCenterService _wpfDataService;
private readonly ILogger<DataEventService> _logger;
/// <summary>
/// DataEventService类的构造函数。
/// </summary>
public DataEventService(IMapper mapper,
IWpfDataService dataStorageService,
IViewDataService dataStorageService,
IEventService eventService,
INotificationService notificationService,
IAppCenterService appCenterService,
IWPFDataService wpfDataService,
IViewCenterService wpfDataService,
ILogger<DataEventService> logger)
{
_mapper = mapper;
_dataStorageService = dataStorageService;
_viewDataService = dataStorageService;
_eventService = eventService;
_notificationService = notificationService;
_appCenterService = appCenterService;
@@ -68,7 +68,7 @@ public class DataEventService : IDataEventService
App.Current.Dispatcher.BeginInvoke(new Action(() =>
{
//// 查找并更新对应的变量
if (_dataStorageService.MqttServers.TryGetValue(e.MqttServer.Id, out var mqttServerItem))
if (_viewDataService.MqttServers.TryGetValue(e.MqttServer.Id, out var mqttServerItem))
{
if (e.ChangeType == ActionChangeType.Updated)
{
@@ -170,7 +170,7 @@ public class DataEventService : IDataEventService
App.Current.Dispatcher.BeginInvoke(new Action(() =>
{
// 查找并更新对应的变量
if (_dataStorageService.Variables.TryGetValue(e.Variable.Id,out var variableToUpdate))
if (_viewDataService.Variables.TryGetValue(e.Variable.Id,out var variableToUpdate))
{
variableToUpdate.DataValue = e.Variable.DataValue;
variableToUpdate.DisplayValue = e.Variable.DisplayValue;