将CNC相关的事件合并,简化
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
using Prism.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using XplorePlane.Models;
|
||||
|
||||
namespace XplorePlane.Events
|
||||
{
|
||||
// =========================================================================
|
||||
// CNC 业务域事件定义
|
||||
// 包含:CNC 程序变更、ROI 编辑请求/取消、矩阵执行进度
|
||||
// =========================================================================
|
||||
|
||||
#region CNC 程序变更
|
||||
|
||||
/// <summary>
|
||||
/// CNC 程序状态变更事件。
|
||||
/// 当 CNC 程序被新建、加载或修改时,由 CncProgramService 通过 IEventAggregator 发布。
|
||||
/// 订阅方:CncEditorViewModel(刷新标题栏修改标记)、MainViewModel(更新工具栏状态)。
|
||||
/// </summary>
|
||||
public class CncProgramChangedEvent : PubSubEvent<CncProgramChangedPayload>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CNC 程序变更载荷。
|
||||
/// </summary>
|
||||
/// <param name="ProgramName">当前程序名称(不含路径)。</param>
|
||||
/// <param name="IsModified">是否存在未保存的修改。</param>
|
||||
public record CncProgramChangedPayload(string ProgramName, bool IsModified);
|
||||
|
||||
#endregion
|
||||
|
||||
#region ROI 编辑
|
||||
|
||||
/// <summary>
|
||||
/// 请求在主视口画布上激活 ROI 编辑模式的事件。
|
||||
/// 由 CNC 流水线编辑器(CncEditorViewModel)发布,
|
||||
/// ViewportPanelView 订阅后操作 PolygonRoiCanvas 进入交互编辑状态。
|
||||
/// </summary>
|
||||
public sealed class CncRoiEditRequestedEvent : PubSubEvent<CncRoiEditRequestedPayload>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ROI 编辑请求载荷,携带初始顶点及回调委托。
|
||||
/// </summary>
|
||||
public class CncRoiEditRequestedPayload
|
||||
{
|
||||
/// <summary>
|
||||
/// 已保存的 ROI 多边形顶点(图像坐标系)。
|
||||
/// 为 null 或空集合时表示新建 ROI。
|
||||
/// </summary>
|
||||
public IReadOnlyList<Point> ExistingPoints { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ROI 顶点发生变化时的回调,参数为最新的顶点列表。
|
||||
/// 每次用户添加或移动顶点后触发,用于实时写回参数并刷新预览。
|
||||
/// </summary>
|
||||
public Action<IReadOnlyList<Point>> OnPointsChanged { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ROI 编辑结束(用户确认或取消)时的回调,用于清理编辑状态。
|
||||
/// </summary>
|
||||
public Action OnEditFinished { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求停止 ROI 编辑模式的事件。
|
||||
/// 由 CncEditorViewModel 在编辑取消或完成后发布,
|
||||
/// ViewportPanelView 订阅后清理画布上的临时绘制状态。
|
||||
/// </summary>
|
||||
public sealed class CncRoiEditCancelledEvent : PubSubEvent
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 矩阵执行进度
|
||||
|
||||
/// <summary>
|
||||
/// 矩阵扫描执行进度事件。
|
||||
/// 矩阵执行过程中由 MatrixScanService 周期性发布,
|
||||
/// 订阅方:CncEditorViewModel(进度条)、MainViewModel(状态栏)。
|
||||
/// </summary>
|
||||
public class MatrixExecutionProgressEvent : PubSubEvent<MatrixExecutionProgressPayload>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 矩阵执行进度载荷。
|
||||
/// </summary>
|
||||
/// <param name="CurrentRow">当前执行行(0-based)。</param>
|
||||
/// <param name="CurrentColumn">当前执行列(0-based)。</param>
|
||||
/// <param name="TotalCells">矩阵总格数。</param>
|
||||
/// <param name="CompletedCells">已完成格数。</param>
|
||||
/// <param name="Status">当前格的执行状态。</param>
|
||||
public record MatrixExecutionProgressPayload(
|
||||
int CurrentRow,
|
||||
int CurrentColumn,
|
||||
int TotalCells,
|
||||
int CompletedCells,
|
||||
MatrixCellStatus Status
|
||||
);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using Prism.Events;
|
||||
|
||||
namespace XplorePlane.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// CNC 程序状态变更事件 | CNC program changed event
|
||||
/// 当 CNC 程序被修改时通过 IEventAggregator 发布 | Published via IEventAggregator when CNC program is modified
|
||||
/// </summary>
|
||||
public class CncProgramChangedEvent : PubSubEvent<CncProgramChangedPayload>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>CNC 程序变更载荷 | CNC program changed payload</summary>
|
||||
public record CncProgramChangedPayload(string ProgramName, bool IsModified);
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using Prism.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
namespace XplorePlane.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求在主视口画布上激活 ROI 编辑模式的事件。
|
||||
/// 由 CNC 流水线编辑器发布,ViewportPanelView 订阅并操作 PolygonRoiCanvas。
|
||||
/// </summary>
|
||||
public sealed class CncRoiEditRequestedEvent : PubSubEvent<CncRoiEditRequestedPayload>
|
||||
{
|
||||
}
|
||||
|
||||
public class CncRoiEditRequestedPayload
|
||||
{
|
||||
/// <summary>已保存的 ROI 多边形顶点(图像坐标)。为空表示新建 ROI。</summary>
|
||||
public IReadOnlyList<Point> ExistingPoints { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ROI 顶点变化时的回调,参数为最新的顶点列表。
|
||||
/// 每次用户添加/移动顶点后调用,用于实时写回参数并触发预览。
|
||||
/// </summary>
|
||||
public Action<IReadOnlyList<Point>> OnPointsChanged { get; set; }
|
||||
|
||||
/// <summary>ROI 编辑结束(用户完成或取消)时的回调。</summary>
|
||||
public Action OnEditFinished { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求停止 ROI 编辑模式(清理画布状态)。
|
||||
/// </summary>
|
||||
public sealed class CncRoiEditCancelledEvent : PubSubEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using Prism.Events;
|
||||
using XplorePlane.Models;
|
||||
|
||||
namespace XplorePlane.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// 矩阵执行进度事件 | Matrix execution progress event
|
||||
/// 矩阵执行过程中通过 IEventAggregator 发布进度更新 | Published via IEventAggregator during matrix execution
|
||||
/// </summary>
|
||||
public class MatrixExecutionProgressEvent : PubSubEvent<MatrixExecutionProgressPayload>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>矩阵执行进度载荷 | Matrix execution progress payload</summary>
|
||||
public record MatrixExecutionProgressPayload(
|
||||
int CurrentRow,
|
||||
int CurrentColumn,
|
||||
int TotalCells,
|
||||
int CompletedCells,
|
||||
MatrixCellStatus Status
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user