using NPOI.SS.Formula.Functions; using Rs.Framework; using Rs.Motion; using Rs.Motion.Base; using Rs.MotionPlat.Flow; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using static Rs.MotionPlat.Commom.SchedulingMessageBox; namespace Rs.MotionPlat.Commom { public static class PromptMessageBox { public static void Show(int id, string message, ETipButton button) { TestCenterMessageBox.Show(id, message, button); } public static SchedulingMessageBox ShowDialog(int id,string message,ETipButton button) { TestCenterMessageBox.Show(id, message, button); return TestCenterMessageBox.WaitResult(id); } public static SchedulingMessageBox ShowDialog(int id, string message, ETipButton button, Dictionary buttonTexts) { TestCenterMessageBox.Show(id, message, button, buttonTexts); return TestCenterMessageBox.WaitResult(id); } public static SchedulingMessageBox ShowAxisAlarmDialog(IAxis axis, string errMsg) { string logInfo = $"轴{axis.Config.AxisName}运动异常 err:{errMsg}"; MessageQueue.Instance.Insert(logInfo); FieldInfo fi = typeof(AlarmConstID).GetField($"{axis.Config.AxisName}MoveFailAlarm"); if (fi != null) { int id = int.Parse(fi.GetValue(null).ToString()); return ShowDialog(id, logInfo, ETipButton.Ok); } else { return ShowDialog(AlarmConstID.NotFoundAxisAlarmID, "未找到对应的轴报警ID", ETipButton.Ok); } } public static SchedulingMessageBox ShowAxisAlarmDialog(IAxis axis,ErrorCode errCode) { string logInfo = $"轴{axis.Config.AxisName}运动异常 errCode:{errCode}"; MessageQueue.Instance.Insert(logInfo); FieldInfo fi = typeof(AlarmConstID).GetField($"{axis.Config.AxisName}MoveFailAlarm"); if(fi!=null) { int id = int.Parse(fi.GetValue(null).ToString()); return ShowDialog(id, logInfo, ETipButton.Ok); } else { return ShowDialog(AlarmConstID.NotFoundAxisAlarmID, "未找到对应的轴报警ID", ETipButton.Ok); } } public static SchedulingMessageBox ShowAxisAlarmDialog(string axisName, ErrorCode errCode) { return ShowAxisAlarmDialog(AxisControl.GetAxis(axisName),errCode); } public static void CloseWindow(int winID,ETipButton button) { SchedulingMessageBox box = new SchedulingMessageBox(); box.Button = button; box.Instruction = EInstruction.CloseMessage; box.TurnoverID = 0; box.GroupID = 0; box.ID = winID; TestCenter.Instance.ReportToTestCenter(box); } } }