重构MQTT事件处理和激活状态管理功能

This commit is contained in:
2025-10-05 14:45:41 +08:00
parent b96101dea6
commit 80ea47e627
13 changed files with 70 additions and 198 deletions

View File

@@ -85,15 +85,6 @@ public class EventService : IEventService
}
/// <summary>
/// 变量启停改变事件
/// </summary>
public event EventHandler<VariablesActiveChangedEventArgs> OnVariableActiveChanged;
public void RaiseVariableActiveChanged(object sender, VariablesActiveChangedEventArgs e)
{
OnVariableActiveChanged?.Invoke(sender, e);
}
/// <summary>
/// 批量导入变量事件
/// </summary>
@@ -128,22 +119,6 @@ public class EventService : IEventService
#endregion
#region MQTT事件
/// <summary>
/// MQTT连接状态改变事件
/// </summary>
public event EventHandler<MqttConnectionChangedEventArgs> MqttConnectionChanged;
/// <summary>
/// 触发MQTT连接状态改变事件
/// </summary>
/// <param name="sender">事件发送者</param>
/// <param name="e">MQTT连接状态改变事件参数</param>
public void RaiseMqttConnectionChanged(object sender, MqttConnectionChangedEventArgs e)
{
MqttConnectionChanged?.Invoke(sender, e);
}
/// <summary>
/// MQTT服务器改变事件
/// </summary>

View File

@@ -105,12 +105,6 @@ public class MqttManagementService : IMqttManagementService
this, new MqttServerChangedEventArgs(ActionChangeType.Updated, mMqttServerDto, property));
}
// 如果没有任何属性发生变化,至少触发一次更新事件
if (changedProperties.Count == 0)
{
_eventService.RaiseMqttServerChanged(
this, new MqttServerChangedEventArgs(ActionChangeType.Updated, mMqttServerDto, MqttServerPropertyType.All));
}
}
else
{