refactor:将DataLoaderService中的LoadAll*Async方法移到对应的管理服务中

- 将LoadAllDevicesAsync方法移到DeviceManagementService
 - 将LoadAllVariableTablesAsync方法移到VariableTableManagementService
 - 将LoadAllVariablesAsync方法移到VariableManagementService
 - 将LoadAllMenusAsync方法移到MenuManagementService
 - 将LoadAllMqttServersAsync方法移到MqttManagementService
 - 将LoadAllNlogsAsync方法移到LogManagementService
 - 更新DataLoaderService以使用管理服务提供的方法
 - 修改IDataLoaderService接口以移除这些方法
 - 保持与LoadAllTriggersAsync相同的模式
 - 遵循单一职责原则,提高代码一致性" (提交修改并添加描述性的提交信息)
This commit is contained in:
2025-10-18 17:59:21 +08:00
parent 595139fb02
commit 740688d575
16 changed files with 169 additions and 200 deletions

View File

@@ -160,4 +160,19 @@ public class MenuManagementService : IMenuManagementService
{
_eventService.RaiseMenuChanged(this, e);
}
/// <summary>
/// 异步加载所有菜单数据到内存中。
/// </summary>
public async Task LoadAllMenusAsync()
{
_appStorageService.Menus.Clear();
_appStorageService.MenuTrees.Clear();
var menus = await _menuService.GetAllMenusAsync();
// 将菜单添加到安全字典
foreach (var menuBean in menus)
{
_appStorageService.Menus.TryAdd(menuBean.Id, menuBean);
}
}
}