WIP
This commit is contained in:
@@ -5,6 +5,7 @@ using DMS.Application.Interfaces.Database;
|
|||||||
using DMS.Core.Enums;
|
using DMS.Core.Enums;
|
||||||
using DMS.Core.Interfaces;
|
using DMS.Core.Interfaces;
|
||||||
using DMS.Core.Models;
|
using DMS.Core.Models;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace DMS.Application.Services.Database;
|
namespace DMS.Application.Services.Database;
|
||||||
|
|
||||||
@@ -61,59 +62,38 @@ public class DeviceAppService : IDeviceAppService
|
|||||||
{
|
{
|
||||||
await _repoManager.BeginTranAsync();
|
await _repoManager.BeginTranAsync();
|
||||||
|
|
||||||
var addDevice = await _repoManager.Devices.AddAsync(dto.Device);
|
dto.Device = await _repoManager.Devices.AddAsync(dto.Device);
|
||||||
if (addDevice == null || addDevice.Id == 0)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"添加设备失败:{addDevice}");
|
|
||||||
}
|
|
||||||
|
|
||||||
_mapper.Map(addDevice,dto.Device);
|
|
||||||
MenuBean addDeviceMenu = null;
|
|
||||||
|
|
||||||
// 假设有设备菜单
|
// 假设有设备菜单
|
||||||
if (dto.DeviceMenu != null)
|
if (dto.DeviceMenu is not null)
|
||||||
{
|
{
|
||||||
var deviceMenu = _mapper.Map<MenuBean>(dto.DeviceMenu);
|
dto.DeviceMenu = await _repoManager.Menus.AddAsync(dto.DeviceMenu);
|
||||||
deviceMenu.ParentId = 2; // 假设父菜单ID为2
|
|
||||||
deviceMenu.MenuType = MenuType.DeviceMenu;
|
|
||||||
deviceMenu.TargetId = addDevice.Id;
|
|
||||||
addDeviceMenu = await _repoManager.Menus.AddAsync(deviceMenu);
|
|
||||||
if (addDeviceMenu == null || addDeviceMenu.Id == 0)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"添加设备菜单失败:{addDeviceMenu}");
|
|
||||||
}
|
|
||||||
_mapper.Map(addDeviceMenu,dto.DeviceMenu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 假设 CreateDeviceWithDetailsDto 包含了变量表和菜单信息
|
// 假设 CreateDeviceWithDetailsDto 包含了变量表和菜单信息
|
||||||
if (dto.VariableTable != null)
|
if (dto.VariableTable is not null)
|
||||||
{
|
{
|
||||||
var variableTable = _mapper.Map<VariableTable>(dto.VariableTable);
|
dto.VariableTable.DeviceId = dto.Device.Id; // 关联新设备ID
|
||||||
variableTable.DeviceId = dto.Device.Id; // 关联新设备ID
|
dto.VariableTable.Protocol = dto.Device.Protocol;
|
||||||
variableTable.Protocol = dto.Device.Protocol;
|
dto.VariableTable = await _repoManager.VariableTables.AddAsync(dto.VariableTable);
|
||||||
var addVariableTable = await _repoManager.VariableTables.AddAsync(variableTable);
|
if (dto.VariableTable == null || dto.VariableTable.Id == 0)
|
||||||
if (addVariableTable == null || addVariableTable.Id == 0)
|
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException($"添加设备变量表失败,设备:{dto.Device.Name},变量表:{variableTable.Name}");
|
throw new InvalidOperationException($"添加设备变量表失败,设备:{dto.Device.Name},变量表:{dto?.VariableTable?.Name}");
|
||||||
}
|
}
|
||||||
_mapper.Map(addVariableTable,dto.VariableTable);
|
|
||||||
dto.VariableTable.Device = dto.Device;
|
|
||||||
|
|
||||||
// 假设有设备菜单
|
// 假设有设备菜单
|
||||||
if (dto.VariableTableMenu != null)
|
if (dto.VariableTableMenu is not null && dto.VariableTableMenu is not null)
|
||||||
{
|
{
|
||||||
var menu = _mapper.Map<MenuBean>(dto.VariableTableMenu);
|
dto.VariableTableMenu.ParentId = dto.DeviceMenu.Id; // 关联设备菜单作为父级
|
||||||
menu.ParentId = addDeviceMenu.Id; // 关联设备菜单作为父级
|
dto.VariableTableMenu.TargetId = dto.VariableTable.Id;
|
||||||
menu.MenuType = MenuType.VariableTableMenu;
|
dto.VariableTableMenu = await _repoManager.Menus.AddAsync(dto.VariableTableMenu);
|
||||||
menu.TargetId = addVariableTable.Id;
|
if (dto.VariableTableMenu == null || dto.VariableTableMenu.Id == 0)
|
||||||
var addVariableTableMenu = await _repoManager.Menus.AddAsync(menu);
|
|
||||||
if (addVariableTableMenu == null || addVariableTableMenu.Id == 0)
|
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
$"添加设备变量表菜单失败,变量表:{variableTable.Name},变量表菜单:{menu.Header}");
|
$"添加设备变量表菜单失败,变量表:{dto.VariableTable.Name},变量表菜单:{dto.VariableTableMenu.Header}");
|
||||||
}
|
}
|
||||||
_mapper.Map(menu,dto.VariableTableMenu);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -302,16 +302,16 @@ public partial class App : System.Windows.Application
|
|||||||
services.AddSingleton<DMS.Application.Interfaces.IEventService, DMS.Application.Services.EventService>();
|
services.AddSingleton<DMS.Application.Interfaces.IEventService, DMS.Application.Services.EventService>();
|
||||||
|
|
||||||
// 注册新的数据服务
|
// 注册新的数据服务
|
||||||
services.AddSingleton<IDeviceDataService, DeviceDataService>();
|
services.AddSingleton<IDeviceDataService, DeviceWpfService>();
|
||||||
services.AddSingleton<IVariableDataService, VariableDataService>();
|
services.AddSingleton<IVariableDataService, VariableDataService>();
|
||||||
services.AddSingleton<IVariableTableDataService, VariableTableDataService>();
|
services.AddSingleton<IVariableTableDataService, VariableTableDataService>();
|
||||||
services.AddSingleton<IMenuDataService, MenuDataService>();
|
services.AddSingleton<IMenuWpfService, MenuWpfService>();
|
||||||
services.AddSingleton<IMqttDataService, MqttDataService>();
|
services.AddSingleton<IMqttDataService, MqttDataService>();
|
||||||
services.AddSingleton<IMqttAliasDataService, MqttAliasDataService>();
|
services.AddSingleton<IMqttAliasDataService, MqttAliasDataService>();
|
||||||
services.AddSingleton<ILogDataService, LogDataService>();
|
services.AddSingleton<ILogDataService, LogDataService>();
|
||||||
services.AddSingleton<ITriggerDataService, TriggerDataService>(); // 注册触发器数据服务
|
services.AddSingleton<ITriggerDataService, TriggerDataService>(); // 注册触发器数据服务
|
||||||
services.AddSingleton<IDataEventService, DataEventService>();
|
services.AddSingleton<IDataEventService, DataEventService>();
|
||||||
services.AddSingleton<IDataStorageService, DataStorageService>();
|
services.AddSingleton<IWpfDataService, WpfDataService>();
|
||||||
services.AddSingleton<IEmailDataService, EmailDataService>();
|
services.AddSingleton<IEmailDataService, EmailDataService>();
|
||||||
|
|
||||||
// 注册主数据服务
|
// 注册主数据服务
|
||||||
|
|||||||
@@ -33,4 +33,5 @@ public interface IDeviceDataService
|
|||||||
/// 更新设备。
|
/// 更新设备。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<bool> UpdateDevice(DeviceItem device);
|
Task<bool> UpdateDevice(DeviceItem device);
|
||||||
|
Task<CreateDeviceWithDetailsDto?> AddDevice(CreateDeviceWithDetailsDto dto);
|
||||||
}
|
}
|
||||||
@@ -6,14 +6,14 @@ namespace DMS.WPF.Interfaces;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 菜单数据服务接口。
|
/// 菜单数据服务接口。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IMenuDataService
|
public interface IMenuWpfService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加菜单项。
|
/// 添加菜单项。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task AddMenuItem(MenuItem MenuItem);
|
void AddMenuToView(MenuItem MenuItem);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除菜单项。
|
/// 删除菜单项。
|
||||||
@@ -24,7 +24,7 @@ public interface IWPFDataService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 菜单数据服务。
|
/// 菜单数据服务。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IMenuDataService MenuDataService { get; }
|
IMenuWpfService MenuDataService { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MQTT数据服务。
|
/// MQTT数据服务。
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using ObservableCollections;
|
|||||||
|
|
||||||
namespace DMS.WPF.Interfaces;
|
namespace DMS.WPF.Interfaces;
|
||||||
|
|
||||||
public interface IDataStorageService
|
public interface IWpfDataService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备列表。
|
/// 设备列表。
|
||||||
@@ -21,7 +21,7 @@ namespace DMS.WPF.Services;
|
|||||||
public class DataEventService : IDataEventService
|
public class DataEventService : IDataEventService
|
||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly IEventService _eventService;
|
private readonly IEventService _eventService;
|
||||||
private readonly INotificationService _notificationService;
|
private readonly INotificationService _notificationService;
|
||||||
private readonly IAppCenterService _appCenterService;
|
private readonly IAppCenterService _appCenterService;
|
||||||
@@ -32,7 +32,7 @@ public class DataEventService : IDataEventService
|
|||||||
/// DataEventService类的构造函数。
|
/// DataEventService类的构造函数。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataEventService(IMapper mapper,
|
public DataEventService(IMapper mapper,
|
||||||
IDataStorageService dataStorageService,
|
IWpfDataService dataStorageService,
|
||||||
IEventService eventService,
|
IEventService eventService,
|
||||||
INotificationService notificationService,
|
INotificationService notificationService,
|
||||||
IAppCenterService appCenterService,
|
IAppCenterService appCenterService,
|
||||||
|
|||||||
@@ -15,16 +15,16 @@ namespace DMS.WPF.Services;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备数据服务类,负责管理设备相关的数据和操作。
|
/// 设备数据服务类,负责管理设备相关的数据和操作。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DeviceDataService : IDeviceDataService
|
public class DeviceWpfService : IDeviceDataService
|
||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IAppCenterService _appCenterService;
|
private readonly IAppCenterService _appCenterService;
|
||||||
private readonly IAppStorageService _appStorageService;
|
private readonly IAppStorageService _appStorageService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly IVariableTableDataService _variableTableDataService;
|
private readonly IVariableTableDataService _variableTableDataService;
|
||||||
private readonly IEventService _eventService;
|
private readonly IEventService _eventService;
|
||||||
private readonly INotificationService _notificationService;
|
private readonly INotificationService _notificationService;
|
||||||
private readonly IMenuDataService _menuDataService;
|
private readonly IMenuWpfService _menuDataService;
|
||||||
private readonly IVariableDataService _variableDataService;
|
private readonly IVariableDataService _variableDataService;
|
||||||
private readonly Dispatcher _uiDispatcher;
|
private readonly Dispatcher _uiDispatcher;
|
||||||
|
|
||||||
@@ -33,11 +33,12 @@ public class DeviceDataService : IDeviceDataService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mapper">AutoMapper 实例。</param>
|
/// <param name="mapper">AutoMapper 实例。</param>
|
||||||
/// <param name="appCenterService">数据服务中心实例。</param>
|
/// <param name="appCenterService">数据服务中心实例。</param>
|
||||||
public DeviceDataService(IMapper mapper, IAppCenterService appCenterService,
|
public DeviceWpfService(IMapper mapper, IAppCenterService appCenterService,
|
||||||
IAppStorageService appStorageService, IDataStorageService dataStorageService,IVariableTableDataService variableTableDataService,
|
IAppStorageService appStorageService, IWpfDataService dataStorageService, IVariableTableDataService variableTableDataService,
|
||||||
IEventService eventService, INotificationService notificationService,
|
IEventService eventService, INotificationService notificationService,
|
||||||
IMenuDataService menuDataService, IVariableDataService variableDataService)
|
IMenuWpfService menuDataService, IVariableDataService variableDataService)
|
||||||
{
|
{
|
||||||
|
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_appCenterService = appCenterService;
|
_appCenterService = appCenterService;
|
||||||
_appStorageService = appStorageService;
|
_appStorageService = appStorageService;
|
||||||
@@ -91,19 +92,15 @@ public class DeviceDataService : IDeviceDataService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加设备。
|
/// 添加设备。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<CreateDeviceWithDetailsDto> AddDevice(CreateDeviceWithDetailsDto dto)
|
public async Task<CreateDeviceWithDetailsDto?> AddDevice(CreateDeviceWithDetailsDto dto)
|
||||||
{
|
{
|
||||||
// 添加null检查
|
// 添加null检查
|
||||||
if (dto == null)
|
if (dto is null) return null;
|
||||||
return null;
|
|
||||||
|
|
||||||
var addDto = await _appCenterService.DeviceManagementService.CreateDeviceWithDetailsAsync(dto);
|
var addDto = await _appCenterService.DeviceManagementService.CreateDeviceWithDetailsAsync(dto);
|
||||||
|
|
||||||
// 添加null检查
|
// 添加null检查
|
||||||
if (addDto == null && addDto.Device == null)
|
if (addDto is null) return null;
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//给界面添加设备
|
//给界面添加设备
|
||||||
_dataStorageService.Devices.Add(addDto.Device.Id, _mapper.Map<DeviceItem>(addDto.Device));
|
_dataStorageService.Devices.Add(addDto.Device.Id, _mapper.Map<DeviceItem>(addDto.Device));
|
||||||
@@ -111,7 +108,7 @@ public class DeviceDataService : IDeviceDataService
|
|||||||
// 给界面添加设备菜单
|
// 给界面添加设备菜单
|
||||||
if (addDto.DeviceMenu != null)
|
if (addDto.DeviceMenu != null)
|
||||||
{
|
{
|
||||||
await _menuDataService.AddMenuItem(_mapper.Map<MenuItem>(addDto.DeviceMenu));
|
_menuDataService.AddMenuToView(_mapper.Map<MenuItem>(addDto.DeviceMenu));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +121,7 @@ public class DeviceDataService : IDeviceDataService
|
|||||||
|
|
||||||
if (addDto.VariableTable != null && addDto.VariableTableMenu != null)
|
if (addDto.VariableTable != null && addDto.VariableTableMenu != null)
|
||||||
{
|
{
|
||||||
await _menuDataService.AddMenuItem(_mapper.Map<MenuItem>(addDto.VariableTableMenu));
|
_menuDataService.AddMenuToView(_mapper.Map<MenuItem>(addDto.VariableTableMenu));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ namespace DMS.WPF.Services;
|
|||||||
public class LogDataService : ILogDataService
|
public class LogDataService : ILogDataService
|
||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly IAppStorageService _appStorageService;
|
private readonly IAppStorageService _appStorageService;
|
||||||
|
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ public class LogDataService : ILogDataService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mapper">AutoMapper 实例。</param>
|
/// <param name="mapper">AutoMapper 实例。</param>
|
||||||
/// <param name="appStorageService">数据服务中心实例。</param>
|
/// <param name="appStorageService">数据服务中心实例。</param>
|
||||||
public LogDataService(IMapper mapper,IDataStorageService dataStorageService, IAppStorageService appStorageService)
|
public LogDataService(IMapper mapper,IWpfDataService dataStorageService, IAppStorageService appStorageService)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_dataStorageService = dataStorageService;
|
_dataStorageService = dataStorageService;
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ namespace DMS.WPF.Services;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 菜单数据服务类,负责管理菜单相关的数据和操作。
|
/// 菜单数据服务类,负责管理菜单相关的数据和操作。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MenuDataService : IMenuDataService
|
public class MenuWpfService : IMenuWpfService
|
||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _wpfDataService;
|
||||||
private readonly IAppStorageService _appStorageService;
|
private readonly IAppStorageService _appStorageService;
|
||||||
private readonly IMenuManagementService _menuManagementService;
|
private readonly IMenuManagementService _menuManagementService;
|
||||||
|
|
||||||
@@ -27,17 +27,17 @@ public class MenuDataService : IMenuDataService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mapper">AutoMapper 实例。</param>
|
/// <param name="mapper">AutoMapper 实例。</param>
|
||||||
/// <param name="appStorageService">数据服务中心实例。</param>
|
/// <param name="appStorageService">数据服务中心实例。</param>
|
||||||
public MenuDataService(IMapper mapper, IDataStorageService dataStorageService, IAppStorageService appStorageService, IMenuManagementService menuManagementService)
|
public MenuWpfService(IMapper mapper, IWpfDataService dataStorageService, IAppStorageService appStorageService, IMenuManagementService menuManagementService)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_dataStorageService = dataStorageService;
|
_wpfDataService = dataStorageService;
|
||||||
_appStorageService = appStorageService;
|
_appStorageService = appStorageService;
|
||||||
_menuManagementService = menuManagementService;
|
_menuManagementService = menuManagementService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadAllMenus()
|
public void LoadAllMenus()
|
||||||
{
|
{
|
||||||
_dataStorageService.Menus = _mapper.Map<ObservableCollection<MenuItem>>(_appStorageService.Menus.Values);
|
_wpfDataService.Menus = _mapper.Map<ObservableCollection<MenuItem>>(_appStorageService.Menus.Values);
|
||||||
BuildMenuTrees();
|
BuildMenuTrees();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,11 +46,11 @@ public class MenuDataService : IMenuDataService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void BuildMenuTrees()
|
public void BuildMenuTrees()
|
||||||
{
|
{
|
||||||
_dataStorageService.MenuTrees.Clear();
|
_wpfDataService.MenuTrees.Clear();
|
||||||
// 遍历所有菜单项,构建树形结构
|
// 遍历所有菜单项,构建树形结构
|
||||||
foreach (var menu in _dataStorageService.Menus)
|
foreach (var menu in _wpfDataService.Menus)
|
||||||
{
|
{
|
||||||
var parentMenu = _dataStorageService.Menus.FirstOrDefault(m => m.Id == menu.ParentId);
|
var parentMenu = _wpfDataService.Menus.FirstOrDefault(m => m.Id == menu.ParentId);
|
||||||
// 检查是否有父ID,并且父ID不为0(通常0或null表示根节点)
|
// 检查是否有父ID,并且父ID不为0(通常0或null表示根节点)
|
||||||
if (parentMenu != null && menu.ParentId != 0)
|
if (parentMenu != null && menu.ParentId != 0)
|
||||||
{
|
{
|
||||||
@@ -63,7 +63,7 @@ public class MenuDataService : IMenuDataService
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 如果没有父ID,则这是一个根菜单
|
// 如果没有父ID,则这是一个根菜单
|
||||||
_dataStorageService.MenuTrees.Add(menu);
|
_wpfDataService.MenuTrees.Add(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,22 +71,17 @@ public class MenuDataService : IMenuDataService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加菜单项。
|
/// 添加菜单项。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task AddMenuItem(MenuItem MenuItem)
|
public void AddMenuToView(MenuItem MenuItem)
|
||||||
{
|
{
|
||||||
if (MenuItem is null) return;
|
if (MenuItem is null) return;
|
||||||
|
|
||||||
var deviceMenu = _dataStorageService.Menus.FirstOrDefault(m => m.Id == MenuItem.ParentId);
|
var deviceMenu = _wpfDataService.Menus.FirstOrDefault(m => m.Id == MenuItem.ParentId);
|
||||||
if (deviceMenu is not null)
|
if (deviceMenu is not null)
|
||||||
{
|
{
|
||||||
|
|
||||||
var menuId = await _menuManagementService.CreateMenuAsync(_mapper.Map<MenuBean>(MenuItem));
|
|
||||||
if (menuId > 0)
|
|
||||||
{
|
|
||||||
MenuItem.Id = menuId;
|
|
||||||
deviceMenu.Children.Add(MenuItem);
|
deviceMenu.Children.Add(MenuItem);
|
||||||
_dataStorageService.Menus.Add(MenuItem);
|
_wpfDataService.Menus.Add(MenuItem);
|
||||||
BuildMenuTrees();
|
BuildMenuTrees();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +93,7 @@ public class MenuDataService : IMenuDataService
|
|||||||
{
|
{
|
||||||
if (MenuItem is null) return;
|
if (MenuItem is null) return;
|
||||||
|
|
||||||
var menu = _dataStorageService.Menus.FirstOrDefault(m => m.Id == MenuItem.Id);
|
var menu = _wpfDataService.Menus.FirstOrDefault(m => m.Id == MenuItem.Id);
|
||||||
if (menu is not null)
|
if (menu is not null)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -122,19 +117,19 @@ public class MenuDataService : IMenuDataService
|
|||||||
await _menuManagementService.DeleteMenuAsync(MenuItem.Id);
|
await _menuManagementService.DeleteMenuAsync(MenuItem.Id);
|
||||||
|
|
||||||
// 从扁平菜单列表中移除
|
// 从扁平菜单列表中移除
|
||||||
_dataStorageService.Menus.Remove(MenuItem);
|
_wpfDataService.Menus.Remove(MenuItem);
|
||||||
|
|
||||||
//// 从树形结构中移除
|
//// 从树形结构中移除
|
||||||
if (MenuItem.ParentId.HasValue && MenuItem.ParentId.Value != 0)
|
if (MenuItem.ParentId.HasValue && MenuItem.ParentId.Value != 0)
|
||||||
{
|
{
|
||||||
// 如果有父菜单,从父菜单的Children中移除
|
// 如果有父菜单,从父菜单的Children中移除
|
||||||
var parentMenu = _dataStorageService.Menus.FirstOrDefault(m => m.Id == MenuItem.ParentId.Value);
|
var parentMenu = _wpfDataService.Menus.FirstOrDefault(m => m.Id == MenuItem.ParentId.Value);
|
||||||
parentMenu?.Children.Remove(MenuItem);
|
parentMenu?.Children.Remove(MenuItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 如果是根菜单,从MenuTrees中移除
|
// 如果是根菜单,从MenuTrees中移除
|
||||||
_dataStorageService.MenuTrees.Remove(MenuItem);
|
_wpfDataService.MenuTrees.Remove(MenuItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
//BuildMenuTrees();
|
//BuildMenuTrees();
|
||||||
@@ -15,7 +15,7 @@ public class MqttAliasDataService : IMqttAliasDataService
|
|||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IAppStorageService _appStorageService;
|
private readonly IAppStorageService _appStorageService;
|
||||||
private readonly IMqttAliasManagementService _mqttAliasManagementService;
|
private readonly IMqttAliasManagementService _mqttAliasManagementService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MqttAliasDataService类的构造函数。
|
/// MqttAliasDataService类的构造函数。
|
||||||
@@ -27,7 +27,7 @@ public class MqttAliasDataService : IMqttAliasDataService
|
|||||||
public MqttAliasDataService(IMapper mapper,
|
public MqttAliasDataService(IMapper mapper,
|
||||||
IAppStorageService appStorageService,
|
IAppStorageService appStorageService,
|
||||||
IMqttAliasManagementService mqttAliasManagementService,
|
IMqttAliasManagementService mqttAliasManagementService,
|
||||||
IDataStorageService dataStorageService)
|
IWpfDataService dataStorageService)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_appStorageService = appStorageService;
|
_appStorageService = appStorageService;
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ public class MqttDataService : IMqttDataService
|
|||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IAppStorageService _appStorageService;
|
private readonly IAppStorageService _appStorageService;
|
||||||
private readonly IMqttManagementService _mqttManagementService;
|
private readonly IMqttManagementService _mqttManagementService;
|
||||||
private readonly IMenuDataService _menuDataService;
|
private readonly IMenuWpfService _menuDataService;
|
||||||
private readonly IMenuManagementService _menuManagementServiceImpl;
|
private readonly IMenuManagementService _menuManagementServiceImpl;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -29,7 +29,7 @@ public class MqttDataService : IMqttDataService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mapper">AutoMapper 实例。</param>
|
/// <param name="mapper">AutoMapper 实例。</param>
|
||||||
/// <param name="mqttAppService">MQTT应用服务实例。</param>
|
/// <param name="mqttAppService">MQTT应用服务实例。</param>
|
||||||
public MqttDataService(IMapper mapper, IAppStorageService appStorageService, IMqttManagementService mqttManagementService, IMenuDataService menuDataService, IMenuManagementService menuManagementServiceImpl, IDataStorageService dataStorageService)
|
public MqttDataService(IMapper mapper, IAppStorageService appStorageService, IMqttManagementService mqttManagementService, IMenuWpfService menuDataService, IMenuManagementService menuManagementServiceImpl, IWpfDataService dataStorageService)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_appStorageService = appStorageService;
|
_appStorageService = appStorageService;
|
||||||
@@ -87,7 +87,7 @@ public class MqttDataService : IMqttDataService
|
|||||||
MenuType = MenuType.MqttServerMenu,
|
MenuType = MenuType.MqttServerMenu,
|
||||||
TargetViewKey = nameof(MqttServerDetailViewModel),
|
TargetViewKey = nameof(MqttServerDetailViewModel),
|
||||||
};
|
};
|
||||||
await _menuDataService.AddMenuItem(_mapper.Map<MenuItem>(mqttServerMenu));
|
await _menuDataService.AddMenuToView(_mapper.Map<MenuItem>(mqttServerMenu));
|
||||||
}
|
}
|
||||||
|
|
||||||
return mqttServerItem;
|
return mqttServerItem;
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ public class TriggerDataService : ITriggerDataService
|
|||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IAppCenterService _appCenterService;
|
private readonly IAppCenterService _appCenterService;
|
||||||
private readonly IMenuDataService _menuDataService;
|
private readonly IMenuWpfService _menuDataService;
|
||||||
private readonly IAppStorageService _appStorageService;
|
private readonly IAppStorageService _appStorageService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly IEventService _eventService;
|
private readonly IEventService _eventService;
|
||||||
private readonly INotificationService _notificationService;
|
private readonly INotificationService _notificationService;
|
||||||
private readonly Dispatcher _uiDispatcher;
|
private readonly Dispatcher _uiDispatcher;
|
||||||
@@ -41,8 +41,8 @@ public class TriggerDataService : ITriggerDataService
|
|||||||
/// <param name="eventService">事件服务实例。</param>
|
/// <param name="eventService">事件服务实例。</param>
|
||||||
/// <param name="notificationService">通知服务实例。</param>
|
/// <param name="notificationService">通知服务实例。</param>
|
||||||
public TriggerDataService(IMapper mapper, IAppCenterService appCenterService,
|
public TriggerDataService(IMapper mapper, IAppCenterService appCenterService,
|
||||||
IMenuDataService menuDataService,
|
IMenuWpfService menuDataService,
|
||||||
IAppStorageService appStorageService, IDataStorageService dataStorageService,
|
IAppStorageService appStorageService, IWpfDataService dataStorageService,
|
||||||
IEventService eventService, INotificationService notificationService)
|
IEventService eventService, INotificationService notificationService)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
@@ -111,7 +111,7 @@ public class TriggerDataService : ITriggerDataService
|
|||||||
Icon = "\uE945", // 使用触发器图标
|
Icon = "\uE945", // 使用触发器图标
|
||||||
TargetViewKey = nameof(TriggerDetailViewModel),
|
TargetViewKey = nameof(TriggerDetailViewModel),
|
||||||
};
|
};
|
||||||
await _menuDataService.AddMenuItem(menuItem);
|
await _menuDataService.AddMenuToView(menuItem);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace DMS.WPF.Services;
|
|||||||
public class VariableDataService : IVariableDataService
|
public class VariableDataService : IVariableDataService
|
||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly IAppCenterService _appCenterService;
|
private readonly IAppCenterService _appCenterService;
|
||||||
|
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ public class VariableDataService : IVariableDataService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mapper">AutoMapper 实例。</param>
|
/// <param name="mapper">AutoMapper 实例。</param>
|
||||||
/// <param name="appCenterService">数据服务中心实例。</param>
|
/// <param name="appCenterService">数据服务中心实例。</param>
|
||||||
public VariableDataService(IMapper mapper, IDataStorageService dataStorageService, IAppCenterService appCenterService)
|
public VariableDataService(IMapper mapper, IWpfDataService dataStorageService, IAppCenterService appCenterService)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_dataStorageService = dataStorageService;
|
_dataStorageService = dataStorageService;
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ namespace DMS.WPF.Services;
|
|||||||
public class VariableTableDataService : IVariableTableDataService
|
public class VariableTableDataService : IVariableTableDataService
|
||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly IAppCenterService _appCenterService;
|
private readonly IAppCenterService _appCenterService;
|
||||||
private readonly IMenuDataService _menuDataService;
|
private readonly IMenuWpfService _menuDataService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public VariableTableDataService(IMapper mapper, IDataStorageService dataStorageService, IAppCenterService appCenterService,
|
public VariableTableDataService(IMapper mapper, IWpfDataService dataStorageService, IAppCenterService appCenterService,
|
||||||
IMenuDataService menuDataService)
|
IMenuWpfService menuDataService)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_dataStorageService = dataStorageService;
|
_dataStorageService = dataStorageService;
|
||||||
@@ -53,7 +53,7 @@ public class VariableTableDataService : IVariableTableDataService
|
|||||||
createDto.Menu = menuDto;
|
createDto.Menu = menuDto;
|
||||||
var resDto = await _appCenterService.VariableTableManagementService.CreateVariableTableAsync(createDto);
|
var resDto = await _appCenterService.VariableTableManagementService.CreateVariableTableAsync(createDto);
|
||||||
|
|
||||||
await _menuDataService.AddMenuItem(_mapper.Map<MenuItem>(resDto.Menu));
|
await _menuDataService.AddMenuToView(_mapper.Map<MenuItem>(resDto.Menu));
|
||||||
return resDto.VariableTable.Id;
|
return resDto.VariableTable.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class WPFDataService : IWPFDataService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 菜单数据服务。
|
/// 菜单数据服务。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IMenuDataService MenuDataService { get; }
|
public IMenuWpfService MenuDataService { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MQTT数据服务。
|
/// MQTT数据服务。
|
||||||
@@ -62,7 +62,7 @@ public class WPFDataService : IWPFDataService
|
|||||||
IAppCenterService appCenterService,
|
IAppCenterService appCenterService,
|
||||||
IDeviceDataService deviceDataService,
|
IDeviceDataService deviceDataService,
|
||||||
IVariableDataService variableDataService,
|
IVariableDataService variableDataService,
|
||||||
IMenuDataService menuDataService,
|
IMenuWpfService menuDataService,
|
||||||
IMqttDataService mqttDataService,
|
IMqttDataService mqttDataService,
|
||||||
ILogDataService logDataService,
|
ILogDataService logDataService,
|
||||||
IVariableTableDataService variableTableDataService,
|
IVariableTableDataService variableTableDataService,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using ObservableCollections;
|
|||||||
|
|
||||||
namespace DMS.WPF.Services;
|
namespace DMS.WPF.Services;
|
||||||
|
|
||||||
public class DataStorageService : IDataStorageService
|
public class WpfDataService : IWpfDataService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ public class DataStorageService : IDataStorageService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ObservableDictionary<int, TriggerItem> Triggers { get; set; }
|
public ObservableDictionary<int, TriggerItem> Triggers { get; set; }
|
||||||
|
|
||||||
public DataStorageService()
|
public WpfDataService()
|
||||||
{
|
{
|
||||||
Devices=new ObservableDictionary<int,DeviceItem>();
|
Devices=new ObservableDictionary<int,DeviceItem>();
|
||||||
VariableTables = new ObservableDictionary<int,VariableTableItem>();
|
VariableTables = new ObservableDictionary<int,VariableTableItem>();
|
||||||
@@ -20,7 +20,7 @@ public partial class DeviceDetailViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly INavigationService _navigationService;
|
private readonly INavigationService _navigationService;
|
||||||
private readonly IWPFDataService _wpfDataService;
|
private readonly IWPFDataService _wpfDataService;
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ public partial class DeviceDetailViewModel : ViewModelBase
|
|||||||
private readonly INotificationService _notificationService;
|
private readonly INotificationService _notificationService;
|
||||||
|
|
||||||
|
|
||||||
public DeviceDetailViewModel(IMapper mapper, IDialogService dialogService, IDataStorageService dataStorageService,
|
public DeviceDetailViewModel(IMapper mapper, IDialogService dialogService, IWpfDataService dataStorageService,
|
||||||
INavigationService navigationService,
|
INavigationService navigationService,
|
||||||
IWPFDataService wpfDataService, INotificationService notificationService)
|
IWPFDataService wpfDataService, INotificationService notificationService)
|
||||||
{
|
{
|
||||||
@@ -207,7 +207,7 @@ public partial class DeviceDetailViewModel : ViewModelBase
|
|||||||
public void NavigateToVariableTable()
|
public void NavigateToVariableTable()
|
||||||
{
|
{
|
||||||
if (SelectedVariableTable == null) return;
|
if (SelectedVariableTable == null) return;
|
||||||
// var menu = _dataStorageService.Menus.FirstOrDefault(m => m.MenuType == MenuType.VariableTableMenu &&
|
// var menu = _wpfDataService.Menus.FirstOrDefault(m => m.MenuType == MenuType.VariableTableMenu &&
|
||||||
// m.TargetId == SelectedVariableTable.Id);
|
// m.TargetId == SelectedVariableTable.Id);
|
||||||
// if (menu == null) return;
|
// if (menu == null) return;
|
||||||
_navigationService.NavigateToAsync(
|
_navigationService.NavigateToAsync(
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public partial class DevicesViewModel : ViewModelBase, INavigatable
|
|||||||
private readonly IWPFDataService _wpfDataService;
|
private readonly IWPFDataService _wpfDataService;
|
||||||
private readonly IDeviceAppService _deviceAppService;
|
private readonly IDeviceAppService _deviceAppService;
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly INavigationService _navigationService;
|
private readonly INavigationService _navigationService;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ public partial class DevicesViewModel : ViewModelBase, INavigatable
|
|||||||
/// <param name="wpfDataService">主数据服务。</param>
|
/// <param name="wpfDataService">主数据服务。</param>
|
||||||
/// <param name="deviceAppService">设备应用服务。</param>
|
/// <param name="deviceAppService">设备应用服务。</param>
|
||||||
/// <param name="notificationService">通知服务。</param>
|
/// <param name="notificationService">通知服务。</param>
|
||||||
public DevicesViewModel(IMapper mapper, IDataStorageService dataStorageService,
|
public DevicesViewModel(IMapper mapper, IWpfDataService dataStorageService,
|
||||||
IDialogService dialogService, INavigationService navigationService,
|
IDialogService dialogService, INavigationService navigationService,
|
||||||
IWPFDataService wpfDataService, IDeviceAppService deviceAppService,
|
IWPFDataService wpfDataService, IDeviceAppService deviceAppService,
|
||||||
INotificationService notificationService)
|
INotificationService notificationService)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace DMS.WPF.ViewModels.Dialogs
|
|||||||
{
|
{
|
||||||
|
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly INotificationService _notificationService;
|
private readonly INotificationService _notificationService;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
@@ -39,7 +39,7 @@ namespace DMS.WPF.ViewModels.Dialogs
|
|||||||
|
|
||||||
public TriggerDialogViewModel(
|
public TriggerDialogViewModel(
|
||||||
IDialogService dialogService,
|
IDialogService dialogService,
|
||||||
IDataStorageService dataStorageService,
|
IWpfDataService dataStorageService,
|
||||||
INotificationService notificationService)
|
INotificationService notificationService)
|
||||||
{
|
{
|
||||||
_dialogService = dialogService ?? throw new ArgumentNullException(nameof(dialogService));
|
_dialogService = dialogService ?? throw new ArgumentNullException(nameof(dialogService));
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ public partial class VariableDialogViewModel : DialogViewModelBase<VariableItem>
|
|||||||
private bool _hasError;
|
private bool _hasError;
|
||||||
|
|
||||||
private readonly IWPFDataService _wpfDataService;
|
private readonly IWPFDataService _wpfDataService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly IVariableAppService _variableAppService;
|
private readonly IVariableAppService _variableAppService;
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
public VariableDialogViewModel(IWPFDataService wpfDataService,IDataStorageService dataStorageService, IVariableAppService variableAppService, IMapper mapper)
|
public VariableDialogViewModel(IWPFDataService wpfDataService,IWpfDataService dataStorageService, IVariableAppService variableAppService, IMapper mapper)
|
||||||
{
|
{
|
||||||
|
|
||||||
Variable = new VariableItem();
|
Variable = new VariableItem();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ partial class LogHistoryViewModel : ViewModelBase,IDisposable
|
|||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly INlogAppService _nlogAppService;
|
private readonly INlogAppService _nlogAppService;
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly INotificationService _notificationService;
|
private readonly INotificationService _notificationService;
|
||||||
private readonly IAppCenterService _appCenterService;
|
private readonly IAppCenterService _appCenterService;
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ partial class LogHistoryViewModel : ViewModelBase,IDisposable
|
|||||||
|
|
||||||
public ObservableCollection<string> LogLevels { get; } = new ObservableCollection<string> { "Trace", "Debug", "Info", "Warn", "Error", "Fatal" };
|
public ObservableCollection<string> LogLevels { get; } = new ObservableCollection<string> { "Trace", "Debug", "Info", "Warn", "Error", "Fatal" };
|
||||||
|
|
||||||
public LogHistoryViewModel(IMapper mapper, INlogAppService nlogAppService, IDialogService dialogService, IDataStorageService dataStorageService
|
public LogHistoryViewModel(IMapper mapper, INlogAppService nlogAppService, IDialogService dialogService, IWpfDataService dataStorageService
|
||||||
, INotificationService notificationService, IWPFDataService wpfDataService, IAppCenterService appCenterService)
|
, INotificationService notificationService, IWPFDataService wpfDataService, IAppCenterService appCenterService)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public partial class MainViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly IWPFDataService _wpfDataService;
|
private readonly IWPFDataService _wpfDataService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly INavigationService _navigationService;
|
private readonly INavigationService _navigationService;
|
||||||
private readonly ILogger<MainViewModel> _logger;
|
private readonly ILogger<MainViewModel> _logger;
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public partial class MainViewModel : ViewModelBase
|
|||||||
/// <param name="dialogService">对话框服务。</param>
|
/// <param name="dialogService">对话框服务。</param>
|
||||||
/// <param name="logger">日志记录器。</param>
|
/// <param name="logger">日志记录器。</param>
|
||||||
/// <param name="wpfDataService"></param>
|
/// <param name="wpfDataService"></param>
|
||||||
public MainViewModel(IWPFDataService wpfDataService ,IDataStorageService dataStorageService,INavigationService navigationService,
|
public MainViewModel(IWPFDataService wpfDataService ,IWpfDataService dataStorageService,INavigationService navigationService,
|
||||||
ILogger<MainViewModel> logger)
|
ILogger<MainViewModel> logger)
|
||||||
{
|
{
|
||||||
_wpfDataService = wpfDataService;
|
_wpfDataService = wpfDataService;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace DMS.WPF.ViewModels
|
|||||||
private readonly IMqttManagementService _mqttManagementService;
|
private readonly IMqttManagementService _mqttManagementService;
|
||||||
private readonly IMqttAliasDataService _mqttAliasDataService;
|
private readonly IMqttAliasDataService _mqttAliasDataService;
|
||||||
private readonly IWPFDataService _wpfDataService;
|
private readonly IWPFDataService _wpfDataService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly INavigationService _navigationService;
|
private readonly INavigationService _navigationService;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -61,7 +61,7 @@ namespace DMS.WPF.ViewModels
|
|||||||
IMqttManagementService mqttManagementService,
|
IMqttManagementService mqttManagementService,
|
||||||
IMqttAliasDataService mqttAliasDataService,
|
IMqttAliasDataService mqttAliasDataService,
|
||||||
IWPFDataService wpfDataService,
|
IWPFDataService wpfDataService,
|
||||||
IDataStorageService dataStorageService,
|
IWpfDataService dataStorageService,
|
||||||
INavigationService navigationService)
|
INavigationService navigationService)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public partial class MqttsViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
private readonly IWPFDataService _wpfDataService;
|
private readonly IWPFDataService _wpfDataService;
|
||||||
private readonly IMqttAppService _mqttAppService;
|
private readonly IMqttAppService _mqttAppService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly INavigationService _navigationService;
|
private readonly INavigationService _navigationService;
|
||||||
@@ -49,7 +49,7 @@ public partial class MqttsViewModel : ViewModelBase
|
|||||||
IDialogService dialogService,
|
IDialogService dialogService,
|
||||||
IWPFDataService wpfDataService,
|
IWPFDataService wpfDataService,
|
||||||
IMqttAppService mqttAppService,
|
IMqttAppService mqttAppService,
|
||||||
IDataStorageService dataStorageService,
|
IWpfDataService dataStorageService,
|
||||||
IMapper mapper,
|
IMapper mapper,
|
||||||
INavigationService navigationService,
|
INavigationService navigationService,
|
||||||
INotificationService notificationService
|
INotificationService notificationService
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace DMS.WPF.ViewModels
|
|||||||
private readonly INotificationService _notificationService;
|
private readonly INotificationService _notificationService;
|
||||||
private readonly ITriggerManagementService _triggerManagementService;
|
private readonly ITriggerManagementService _triggerManagementService;
|
||||||
private readonly ITriggerDataService _triggerDataService;
|
private readonly ITriggerDataService _triggerDataService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly INavigationService _navigationService;
|
private readonly INavigationService _navigationService;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -52,7 +52,7 @@ namespace DMS.WPF.ViewModels
|
|||||||
INotificationService notificationService,
|
INotificationService notificationService,
|
||||||
ITriggerManagementService triggerManagementService,
|
ITriggerManagementService triggerManagementService,
|
||||||
ITriggerDataService triggerDataService,
|
ITriggerDataService triggerDataService,
|
||||||
IDataStorageService dataStorageService,
|
IWpfDataService dataStorageService,
|
||||||
INavigationService navigationService)
|
INavigationService navigationService)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace DMS.WPF.ViewModels
|
|||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly ITriggerDataService _triggerDataService;
|
private readonly ITriggerDataService _triggerDataService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly INotificationService _notificationService;
|
private readonly INotificationService _notificationService;
|
||||||
private readonly INavigationService _navigationService;
|
private readonly INavigationService _navigationService;
|
||||||
@@ -38,7 +38,7 @@ namespace DMS.WPF.ViewModels
|
|||||||
public TriggersViewModel(
|
public TriggersViewModel(
|
||||||
IMapper mapper,
|
IMapper mapper,
|
||||||
ITriggerDataService triggerDataService,
|
ITriggerDataService triggerDataService,
|
||||||
IDataStorageService dataStorageService,
|
IWpfDataService dataStorageService,
|
||||||
IDialogService dialogService,
|
IDialogService dialogService,
|
||||||
INotificationService notificationService,
|
INotificationService notificationService,
|
||||||
INavigationService navigationService)
|
INavigationService navigationService)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ partial class VariableHistoryViewModel : ViewModelBase, INavigatable
|
|||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly IHistoryAppService _historyAppService;
|
private readonly IHistoryAppService _historyAppService;
|
||||||
private readonly IWPFDataService _wpfDataService;
|
private readonly IWPFDataService _wpfDataService;
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
private readonly IEventService _eventService;
|
private readonly IEventService _eventService;
|
||||||
private readonly INotificationService _notificationService;
|
private readonly INotificationService _notificationService;
|
||||||
private readonly INavigationService _navigationService;
|
private readonly INavigationService _navigationService;
|
||||||
@@ -85,7 +85,7 @@ partial class VariableHistoryViewModel : ViewModelBase, INavigatable
|
|||||||
private List<VariableHistoryDto> _allVariableHistories;
|
private List<VariableHistoryDto> _allVariableHistories;
|
||||||
|
|
||||||
public VariableHistoryViewModel(IMapper mapper, IDialogService dialogService, IHistoryAppService historyAppService,
|
public VariableHistoryViewModel(IMapper mapper, IDialogService dialogService, IHistoryAppService historyAppService,
|
||||||
IWPFDataService wpfDataService, IDataStorageService dataStorageService,
|
IWPFDataService wpfDataService, IWpfDataService dataStorageService,
|
||||||
IEventService eventService, INotificationService notificationService,
|
IEventService eventService, INotificationService notificationService,
|
||||||
INavigationService navigationService)
|
INavigationService navigationService)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ partial class VariableTableViewModel : ViewModelBase, INavigatable
|
|||||||
/// <param name="dialogService">对话服务接口的实例。</param>
|
/// <param name="dialogService">对话服务接口的实例。</param>
|
||||||
private readonly IWPFDataService _wpfDataService;
|
private readonly IWPFDataService _wpfDataService;
|
||||||
|
|
||||||
private readonly IDataStorageService _dataStorageService;
|
private readonly IWpfDataService _dataStorageService;
|
||||||
|
|
||||||
private readonly ObservableList<VariableItem> _variableItemList;
|
private readonly ObservableList<VariableItem> _variableItemList;
|
||||||
private readonly ISynchronizedView<VariableItem, VariableItem> _synchronizedView;
|
private readonly ISynchronizedView<VariableItem, VariableItem> _synchronizedView;
|
||||||
@@ -99,7 +99,7 @@ partial class VariableTableViewModel : ViewModelBase, INavigatable
|
|||||||
public VariableTableViewModel(IMapper mapper, IDialogService dialogService, IVariableManagementService variableManagementService,
|
public VariableTableViewModel(IMapper mapper, IDialogService dialogService, IVariableManagementService variableManagementService,
|
||||||
IEventService eventService,
|
IEventService eventService,
|
||||||
IMqttAliasAppService mqttAliasAppService, IMqttAppService mqttAppService,
|
IMqttAliasAppService mqttAliasAppService, IMqttAppService mqttAppService,
|
||||||
IWPFDataService wpfDataService, IDataStorageService dataStorageService,
|
IWPFDataService wpfDataService, IWpfDataService dataStorageService,
|
||||||
INotificationService notificationService, ITriggerAppService triggerAppService,
|
INotificationService notificationService, ITriggerAppService triggerAppService,
|
||||||
ITriggerVariableAppService triggerVariableAppService)
|
ITriggerVariableAppService triggerVariableAppService)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user