完成S7变量启用和停用更新
This commit is contained in:
30
DMS.Application/Events/DataChangedEventArgs.cs
Normal file
30
DMS.Application/Events/DataChangedEventArgs.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using DMS.Core.Enums;
|
||||
|
||||
namespace DMS.Application.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据变更事件参数基类
|
||||
/// </summary>
|
||||
public class DataChangedEventArgs : System.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 变更类型
|
||||
/// </summary>
|
||||
public DataChangeType ChangeType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 变更时间
|
||||
/// </summary>
|
||||
public DateTime ChangeTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="changeType">变更类型</param>
|
||||
public DataChangedEventArgs(DataChangeType changeType)
|
||||
{
|
||||
ChangeType = changeType;
|
||||
ChangeTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
DMS.Application/Events/DataLoadCompletedEventArgs.cs
Normal file
36
DMS.Application/Events/DataLoadCompletedEventArgs.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace DMS.Application.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据加载完成事件参数
|
||||
/// </summary>
|
||||
public class DataLoadCompletedEventArgs : System.EventArgs
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 加载是否成功
|
||||
/// </summary>
|
||||
public bool IsSuccess { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 加载时间
|
||||
/// </summary>
|
||||
public DateTime LoadTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 错误信息(如果加载失败)
|
||||
/// </summary>
|
||||
public string ErrorMessage { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="isSuccess">是否成功</param>
|
||||
/// <param name="errorMessage">错误信息</param>
|
||||
public DataLoadCompletedEventArgs(bool isSuccess, string errorMessage = null)
|
||||
{
|
||||
IsSuccess = isSuccess;
|
||||
ErrorMessage = errorMessage;
|
||||
LoadTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace DMS.Application.Events;
|
||||
|
||||
/// <summary>
|
||||
/// 设备状态改变事件参数
|
||||
/// </summary>
|
||||
public class DeviceActiveChangedEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备ID
|
||||
/// </summary>
|
||||
public int DeviceId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备名称
|
||||
/// </summary>
|
||||
public string DeviceName { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新状态
|
||||
/// </summary>
|
||||
public bool NewStatus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态改变时间
|
||||
/// </summary>
|
||||
public DateTime ChangeTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始化DeviceStatusChangedEventArgs类的新实例
|
||||
/// </summary>
|
||||
/// <param name="deviceId">设备ID</param>
|
||||
/// <param name="deviceName">设备名称</param>
|
||||
/// <param name="oldStatus">旧状态</param>
|
||||
/// <param name="newStatus">新状态</param>
|
||||
public DeviceActiveChangedEventArgs(int deviceId, string deviceName, bool newStatus)
|
||||
{
|
||||
DeviceId = deviceId;
|
||||
DeviceName = deviceName;
|
||||
NewStatus = newStatus;
|
||||
ChangeTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
38
DMS.Application/Events/DeviceChangedEventArgs.cs
Normal file
38
DMS.Application/Events/DeviceChangedEventArgs.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Core.Enums;
|
||||
|
||||
namespace DMS.Application.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备变更事件参数
|
||||
/// </summary>
|
||||
public class DeviceChangedEventArgs : System.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 变更类型
|
||||
/// </summary>
|
||||
public DataChangeType ChangeType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备DTO
|
||||
/// </summary>
|
||||
public DeviceDto Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 变更时间
|
||||
/// </summary>
|
||||
public DateTime ChangeTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="changeType">变更类型</param>
|
||||
/// <param name="device">设备DTO</param>
|
||||
public DeviceChangedEventArgs(DataChangeType changeType, DeviceDto device)
|
||||
{
|
||||
ChangeType = changeType;
|
||||
Device = device;
|
||||
ChangeTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
namespace DMS.Application.Events;
|
||||
|
||||
public class DeviceConnectChangedEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备ID
|
||||
/// </summary>
|
||||
public int DeviceId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备名称
|
||||
/// </summary>
|
||||
public string DeviceName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 新状态
|
||||
/// </summary>
|
||||
public bool NewStatus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始化DeviceStatusChangedEventArgs类的新实例
|
||||
/// </summary>
|
||||
/// <param name="deviceId">设备ID</param>
|
||||
/// <param name="deviceName">设备名称</param>
|
||||
/// <param name="oldStatus">旧状态</param>
|
||||
/// <param name="newStatus">新状态</param>
|
||||
public DeviceConnectChangedEventArgs(int deviceId, string deviceName, bool newStatus)
|
||||
{
|
||||
DeviceId = deviceId;
|
||||
DeviceName = deviceName;
|
||||
NewStatus = newStatus;
|
||||
}
|
||||
}
|
||||
45
DMS.Application/Events/MenuChangedEventArgs.cs
Normal file
45
DMS.Application/Events/MenuChangedEventArgs.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Core.Enums;
|
||||
|
||||
namespace DMS.Application.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// 菜单变更事件参数
|
||||
/// </summary>
|
||||
public class MenuChangedEventArgs : System.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 变更类型
|
||||
/// </summary>
|
||||
public DataChangeType ChangeType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单DTO
|
||||
/// </summary>
|
||||
public MenuBeanDto Menu { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 父级菜单DTO
|
||||
/// </summary>
|
||||
public MenuBeanDto ParentMenu { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 变更时间
|
||||
/// </summary>
|
||||
public DateTime ChangeTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="changeType">变更类型</param>
|
||||
/// <param name="menu">菜单DTO</param>
|
||||
/// <param name="parentMenu">父级菜单DTO</param>
|
||||
public MenuChangedEventArgs(DataChangeType changeType, MenuBeanDto menu, MenuBeanDto parentMenu)
|
||||
{
|
||||
ChangeType = changeType;
|
||||
Menu = menu;
|
||||
ParentMenu = parentMenu;
|
||||
ChangeTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace DMS.Application.Events;
|
||||
|
||||
/// <summary>
|
||||
/// MQTT连接状态改变事件参数
|
||||
/// </summary>
|
||||
public class MqttConnectionChangedEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// MQTT服务器ID
|
||||
/// </summary>
|
||||
public int MqttServerId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// MQTT服务器名称
|
||||
/// </summary>
|
||||
public string MqttServerName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 旧连接状态
|
||||
/// </summary>
|
||||
public bool OldConnectionStatus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 新连接状态
|
||||
/// </summary>
|
||||
public bool NewConnectionStatus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态改变时间
|
||||
/// </summary>
|
||||
public DateTime ChangeTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始化MqttConnectionChangedEventArgs类的新实例
|
||||
/// </summary>
|
||||
/// <param name="mqttServerId">MQTT服务器ID</param>
|
||||
/// <param name="mqttServerName">MQTT服务器名称</param>
|
||||
/// <param name="oldStatus">旧连接状态</param>
|
||||
/// <param name="newStatus">新连接状态</param>
|
||||
public MqttConnectionChangedEventArgs(int mqttServerId, string mqttServerName, bool oldStatus, bool newStatus)
|
||||
{
|
||||
MqttServerId = mqttServerId;
|
||||
MqttServerName = mqttServerName;
|
||||
OldConnectionStatus = oldStatus;
|
||||
NewConnectionStatus = newStatus;
|
||||
ChangeTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
38
DMS.Application/Events/MqttServerChangedEventArgs.cs
Normal file
38
DMS.Application/Events/MqttServerChangedEventArgs.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Core.Enums;
|
||||
|
||||
namespace DMS.Application.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// MQTT服务器变更事件参数
|
||||
/// </summary>
|
||||
public class MqttServerChangedEventArgs : System.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 变更类型
|
||||
/// </summary>
|
||||
public DataChangeType ChangeType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// MQTT服务器DTO
|
||||
/// </summary>
|
||||
public MqttServerDto MqttServer { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 变更时间
|
||||
/// </summary>
|
||||
public DateTime ChangeTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="changeType">变更类型</param>
|
||||
/// <param name="mqttServer">MQTT服务器DTO</param>
|
||||
public MqttServerChangedEventArgs(DataChangeType changeType, MqttServerDto mqttServer)
|
||||
{
|
||||
ChangeType = changeType;
|
||||
MqttServer = mqttServer;
|
||||
ChangeTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
DMS.Application/Events/NlogChangedEventArgs.cs
Normal file
26
DMS.Application/Events/NlogChangedEventArgs.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Core.Enums;
|
||||
|
||||
namespace DMS.Application.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Nlog日志变更事件参数
|
||||
/// </summary>
|
||||
public class NlogChangedEventArgs : DataChangedEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 变更的日志DTO
|
||||
/// </summary>
|
||||
public NlogDto Nlog { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="changeType">变更类型</param>
|
||||
/// <param name="nlog">变更的日志DTO</param>
|
||||
public NlogChangedEventArgs(DataChangeType changeType, NlogDto nlog) : base(changeType)
|
||||
{
|
||||
Nlog = nlog;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
DMS.Application/Events/VariableChangedEventArgs.cs
Normal file
45
DMS.Application/Events/VariableChangedEventArgs.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Core.Enums;
|
||||
|
||||
namespace DMS.Application.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// 变量变更事件参数
|
||||
/// </summary>
|
||||
public class VariableChangedEventArgs : System.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 变更类型
|
||||
/// </summary>
|
||||
public DataChangeType ChangeType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 变量DTO
|
||||
/// </summary>
|
||||
public VariableDto Variable { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的变量表DTO
|
||||
/// </summary>
|
||||
public VariableTableDto VariableTable { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 变更时间
|
||||
/// </summary>
|
||||
public DateTime ChangeTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="changeType">变更类型</param>
|
||||
/// <param name="variable">变量DTO</param>
|
||||
/// <param name="variableTable">关联的变量表DTO</param>
|
||||
public VariableChangedEventArgs(DataChangeType changeType, VariableDto variable, VariableTableDto variableTable)
|
||||
{
|
||||
ChangeType = changeType;
|
||||
Variable = variable;
|
||||
VariableTable = variableTable;
|
||||
ChangeTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
DMS.Application/Events/VariableTableChangedEventArgs.cs
Normal file
45
DMS.Application/Events/VariableTableChangedEventArgs.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Core.Enums;
|
||||
|
||||
namespace DMS.Application.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// 变量表变更事件参数
|
||||
/// </summary>
|
||||
public class VariableTableChangedEventArgs : System.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 变更类型
|
||||
/// </summary>
|
||||
public DataChangeType ChangeType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 变量表DTO
|
||||
/// </summary>
|
||||
public VariableTableDto VariableTable { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的设备DTO
|
||||
/// </summary>
|
||||
public DeviceDto Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 变更时间
|
||||
/// </summary>
|
||||
public DateTime ChangeTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="changeType">变更类型</param>
|
||||
/// <param name="variableTable">变量表DTO</param>
|
||||
/// <param name="device">关联的设备DTO</param>
|
||||
public VariableTableChangedEventArgs(DataChangeType changeType, VariableTableDto variableTable, DeviceDto device)
|
||||
{
|
||||
ChangeType = changeType;
|
||||
VariableTable = variableTable;
|
||||
Device = device;
|
||||
ChangeTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user