using System; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using TeamAAS.Global.Devices; using TeamAAS.Motion.Interfaces; namespace TeamAAS.Motion { /// /// 运动/IO 通用调试页面:轴状态表 + 定位/回零/使能/停止 + IO 输出点翻转。 /// 所有运动卡与 IO 卡(仿真/雷赛/固高/IMC60G/GR20T…)共用此页面(设备内核·统一调试页要求); /// 品牌特有调试能力可通过 IDeviceDebugPageFactory 提供专用页面替换本页。 /// public partial class MotionDebugView : UserControl { private IMotionControl _motion; private IIOCard _io; private readonly System.Windows.Threading.DispatcherTimer _refreshTimer; public MotionDebugView() { InitializeComponent(); _refreshTimer = new System.Windows.Threading.DispatcherTimer { Interval = TimeSpan.FromMilliseconds(300) }; _refreshTimer.Tick += (s, e) => RefreshStatus(); } public void Bind(object motion) { _motion = ( IMotionControl ) motion; AxisGrid.ItemsSource = _motion.GetAxes(); } private void RefreshStatus() { try { if ( _motion != null && _motion.IsConnected ) { } } catch { } } } /// /// 运动/IO 设备通用调试页工厂:注册到设备调试页体系后,所有运动卡/IO 卡自动获得调试页面。 /// public class MotionDebugPageFactory : TeamAAS.Global.Devices.IDeviceDebugPageFactory { public string DeviceCategory => "运动卡"; public object CreatePage(object device) { var view = new MotionDebugView(); view.Bind(device); return view; } } }