Files
DMS/DMS.Application/Services/Processors/UpdateViewProcessor.cs
David P.G 3958275367 重构:修改 VariableValueChangedEventArgs 以包含 VariableDto 对象
- 修改 VariableValueChangedEventArgs 类:
     - 移除了 VariableId、VariableName、NewValue 和 UpdateTime 属性
     - 添加了 Variable(VariableDto 类型)和 OldValue 属性
     - 更新了构造函数以接收 VariableDto 对象和旧值

   - 更新事件触发代码:
     - 修改了 UpdateViewProcessor.cs 中的事件触发代码,改为传递 VariableDto 对象和旧值

   - 更新事件处理代码:
     - 修改了 DataEventService.cs 中的事件处理逻辑,改为访问 e.Variable 属性
     - 修改了 VariableHistoryViewModel.cs 中的事件处理逻辑,改为使用 e.Variable 属性
2025-10-02 18:47:45 +08:00

27 lines
699 B
C#

using DMS.Application.Events;
using DMS.Application.Interfaces;
using DMS.Application.Models;
using DMS.Core.Events;
namespace DMS.Application.Services.Processors;
public class UpdateViewProcessor: IVariableProcessor
{
private readonly IEventService _eventService;
public UpdateViewProcessor(IEventService eventService)
{
_eventService = eventService;
}
public async Task ProcessAsync(VariableContext context)
{
// 触发变量值变更事件
var eventArgs = new VariableValueChangedEventArgs(
context.Data,
context.Data.DataValue);
_eventService.RaiseVariableValueChanged(this, eventArgs);
}
}