MeasureMsgManage.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using MeasureThread;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Drawing;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows.Forms;
  9. namespace HOZProject
  10. {
  11. public class MeasureMsgManage
  12. {
  13. /// <summary>
  14. /// 线程消息处理,显示内容
  15. /// </summary>
  16. /// <param name="formHOZ">主窗体对象</param>
  17. /// <param name="args">消息对象</param>
  18. public static void ShowMsgContent(FormHOZMain formHOZ, ThreadStatusEventArgs args)
  19. {
  20. switch (args.Step_Code)
  21. {
  22. case "1-3":
  23. //设置图像
  24. formHOZ.pbImage.Image = new Bitmap(args.Picture_Information.Picture_FullPath);
  25. //流程内容
  26. string semParaContent = "电压:"+args.Picture_Information.Work_Voltage;
  27. semParaContent = " 放大倍数:" + args.Picture_Information.Magnification;
  28. semParaContent = " 工作距离:" + args.Picture_Information.Work_Distance;
  29. formHOZ.lblFlowContent.Text = semParaContent;
  30. break;
  31. default:
  32. //设置图像
  33. formHOZ.pbImage.Image = null;
  34. //流程内容
  35. formHOZ.lblFlowContent.Text = "1";
  36. break;
  37. }
  38. //修改切孔中流程状态
  39. ChageCutHoleFlowNodeState(formHOZ, args);
  40. }
  41. #region 修改切孔中流程状态
  42. /// <summary>
  43. /// 修改切孔中流程状态
  44. /// </summary>
  45. /// <param name="formHOZ">主窗体对象</param>
  46. /// <param name="cutHoleName">切孔名称</param>
  47. /// <param name="Code">流程编号</param>
  48. /// <param name="state">状态</param>
  49. /// <returns></returns>
  50. public static bool ChageCutHoleFlowNodeState(FormHOZMain formHOZ, ThreadStatusEventArgs args)
  51. {
  52. if (formHOZ.plPrarInfo.Controls.Count > 0)
  53. {
  54. foreach (Control item in formHOZ.plPrarInfo.Controls)
  55. {
  56. if (item is UserControl)
  57. {
  58. if (item.Name == args.HoleName)
  59. {
  60. UControl_ParaInfo uControl_ParaInfo = (UControl_ParaInfo)item;
  61. TimeLineItem[] ParaItem = uControl_ParaInfo.TlItem;
  62. foreach (TimeLineItem tlItem in ParaItem)
  63. {
  64. if (tlItem.Code == args.Step_Code)
  65. {
  66. tlItem.State = Convert.ToInt32(args.State);
  67. break;
  68. }
  69. }
  70. //重新绘制
  71. uControl_ParaInfo.TimeLineInvalidate();
  72. return true;
  73. }
  74. }
  75. }
  76. }
  77. return false;
  78. }
  79. #endregion
  80. }
  81. }