refactor:删除MqttServerDto,将使用MqttServerDto的全部转为使用MqttServer

This commit is contained in:
2025-10-06 19:32:45 +08:00
parent c85f89db33
commit 94ad940e03
17 changed files with 174 additions and 222 deletions

View File

@@ -1,6 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using DMS.Application.DTOs;
using DMS.Application.Interfaces;
using DMS.WPF.ItemViewModel;
using System;
@@ -36,27 +36,27 @@ namespace DMS.WPF.ViewModels.Dialogs
{
try
{
var mqttServerDtos = await _mqttAppService.GetAllMqttServersAsync();
var mqttServers = await _mqttAppService.GetAllMqttServersAsync();
MqttServers.Clear();
foreach (var dto in mqttServerDtos)
foreach (var mqttServer in mqttServers)
{
MqttServers.Add(new MqttServerItem
{
Id = dto.Id,
ServerName = dto.ServerName,
ServerUrl = dto.ServerUrl,
Port = dto.Port,
Username = dto.Username,
Password = dto.Password,
IsActive = dto.IsActive,
SubscribeTopic = dto.SubscribeTopic,
PublishTopic = dto.PublishTopic,
ClientId = dto.ClientId,
CreatedAt = dto.CreatedAt,
ConnectedAt = dto.ConnectedAt,
ConnectionDuration = dto.ConnectionDuration,
MessageFormat = dto.MessageFormat
Id = mqttServer.Id,
ServerName = mqttServer.ServerName,
ServerUrl = mqttServer.ServerUrl,
Port = mqttServer.Port,
Username = mqttServer.Username,
Password = mqttServer.Password,
IsActive = mqttServer.IsActive,
SubscribeTopic = mqttServer.SubscribeTopic,
PublishTopic = mqttServer.PublishTopic,
ClientId = mqttServer.ClientId,
CreatedAt = mqttServer.CreatedAt,
ConnectedAt = mqttServer.ConnectedAt,
ConnectionDuration = mqttServer.ConnectionDuration,
MessageFormat = mqttServer.MessageFormat
});
}
}