using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System; using static TeamAAS.Motion.Enums.MotionEnums; namespace TeamAAS.Motion.Events { public class CardAxisEventArgs { // ========== 轴事件基类 ========== public class AxisEventArgs : EventArgs { public int AxisNo { get; } public AxisEventArgs(int axisNo) => AxisNo = axisNo; } // ========== 轴运动事件参数 ========== public class AxisMotionEventArgs : AxisEventArgs { /// 目标位置(对于点动或回零,可能为 NaN 或 0) public double TargetPosition { get; } /// 实际到达位置(或当前停止位置) public double ActualPosition { get; } public AxisMotionEventArgs(int axisNo, double target, double actual) : base(axisNo) { TargetPosition = target; ActualPosition = actual; } } // ========== 轴状态变化事件参数 ========== public class AxisStateChangedEventArgs : AxisEventArgs { public AxisState OldState { get; } public AxisState NewState { get; } public AxisStateChangedEventArgs(int axisNo, AxisState oldState, AxisState newState) : base(axisNo) { OldState = oldState; NewState = newState; } } // ========== 轴错误事件参数 ========== public class AxisErrorEventArgs : AxisEventArgs { public string ErrorMessage { get; } public AxisErrorEventArgs(int axisNo, string message) : base(axisNo) { ErrorMessage = message; } } // ========== 控制卡连接状态变化事件参数 ========== public class ConnectionStateChangedEventArgs : EventArgs { public bool Connected { get; } public ConnectionStateChangedEventArgs(bool connected) => Connected = connected; } // ========== 控制卡错误事件参数 ========== public class ErrorOccurredEventArgs : EventArgs { public string ErrorMessage { get; } public ErrorOccurredEventArgs(string message) => ErrorMessage = message; } } }