refactor:完成重构设备的添加,删除,更新。
This commit is contained in:
@@ -17,7 +17,7 @@ public class DeviceMonitoringService : IDeviceMonitoringService, IDisposable
|
||||
{
|
||||
private readonly ILogger<DeviceMonitoringService> _logger;
|
||||
private readonly IEventService _eventService;
|
||||
private readonly IAppStorageService _appStorageService;
|
||||
private readonly IAppDataService _appDataService;
|
||||
private readonly IAppCenterService _appCenterService;
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@ public class DeviceMonitoringService : IDeviceMonitoringService, IDisposable
|
||||
/// <param name="logger">日志记录器</param>
|
||||
/// <param name="deviceAppService">设备应用服务</param>
|
||||
public DeviceMonitoringService(ILogger<DeviceMonitoringService> logger, IEventService eventService,
|
||||
IAppStorageService appStorageService,
|
||||
IAppDataService appStorageService,
|
||||
IAppCenterService appCenterService)
|
||||
{
|
||||
_logger = logger;
|
||||
_eventService = eventService;
|
||||
_appStorageService = appStorageService;
|
||||
_appDataService = appStorageService;
|
||||
_appCenterService = appCenterService;
|
||||
_eventService.OnDeviceStateChanged += OnDeviceStateChanged;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class DeviceMonitoringService : IDeviceMonitoringService, IDisposable
|
||||
// 只处理激活状态变化事件
|
||||
if (e.StateType == Core.Enums.DeviceStateType.Active)
|
||||
{
|
||||
if (_appStorageService.Devices.TryGetValue(e.DeviceId, out var device))
|
||||
if (_appDataService.Devices.TryGetValue(e.DeviceId, out var device))
|
||||
{
|
||||
// 更新设备激活状态 - 同时更新数据库和内存
|
||||
_ = Task.Run(async () =>
|
||||
|
||||
Reference in New Issue
Block a user