主要变更:
1. 创建了 DeviceStateType 枚举来区分状态类型(激活/连接) 2. 创建了 DeviceStateChangedEventArgs 统一事件类 3. 更新了 IEventService 接口,将两个事件合并为一个 4. 更新了 EventService 实现以支持新事件 5. 更新了所有相关服务(DeviceMonitoringService, OpcUaServiceManager, S7ServiceManager, DeviceDataService, DeviceItemViewModel) 关键优点: - 减少了事件类型的数量,简化了事件系统 - 为设备状态变化提供了一致的处理方式 - 保持了向后兼容性,将旧类标记为 [Obsolete]
This commit is contained in:
@@ -91,8 +91,8 @@ public partial class DeviceItemViewModel : ObservableObject
|
||||
// 只有当设备ID有效且事件服务已初始化时才发布事件
|
||||
if (Id > 0 && EventService != null )
|
||||
{
|
||||
// 发布设备状态改变事件
|
||||
EventService.RaiseDeviceActiveChanged(this, new DeviceActiveChangedEventArgs(Id, Name, newValue));
|
||||
// 发布设备状态改变事件(使用统一的事件类型)
|
||||
EventService.RaiseDeviceStateChanged(this, new DeviceStateChangedEventArgs(Id, Name, newValue, Core.Enums.DeviceStateType.Active));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user