refactor:将DataLoaderService中的LoadAll*Async方法移到对应的管理服务中
- 将LoadAllDevicesAsync方法移到DeviceManagementService - 将LoadAllVariableTablesAsync方法移到VariableTableManagementService - 将LoadAllVariablesAsync方法移到VariableManagementService - 将LoadAllMenusAsync方法移到MenuManagementService - 将LoadAllMqttServersAsync方法移到MqttManagementService - 将LoadAllNlogsAsync方法移到LogManagementService - 更新DataLoaderService以使用管理服务提供的方法 - 修改IDataLoaderService接口以移除这些方法 - 保持与LoadAllTriggersAsync相同的模式 - 遵循单一职责原则,提高代码一致性" (提交修改并添加描述性的提交信息)
This commit is contained in:
@@ -128,7 +128,20 @@ public class DeviceManagementService : IDeviceManagementService
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载所有设备数据到内存中。
|
||||
/// </summary>
|
||||
public async Task LoadAllDevicesAsync()
|
||||
{
|
||||
_appStorageService.Devices.Clear();
|
||||
var devices = await _deviceAppService.GetAllDevicesAsync();
|
||||
|
||||
// 建立设备与变量表的关联
|
||||
foreach (var device in devices)
|
||||
{
|
||||
// 将设备添加到安全字典
|
||||
_appStorageService.Devices.TryAdd(device.Id, device);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user