MeasureCheckResultInfoWindow.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System;
  2. using System.Collections;
  3. using System.Windows.Forms;
  4. namespace OTSMeasureApp
  5. {
  6. public partial class MeasureCheckResultInfoWindow : Form
  7. {
  8. public string endTime = "";
  9. //国际化
  10. OTSCommon.Language lan;
  11. Hashtable table;
  12. public MeasureCheckResultInfoWindow()
  13. {
  14. InitializeComponent();
  15. CheckForIllegalCrossThreadCalls = false;
  16. //国际化
  17. lan = new OTSCommon.Language(this);
  18. table = lan.GetNameTable(this.Name);
  19. }
  20. /// <summary>
  21. /// 测量状态
  22. /// </summary>
  23. /// <param name="currentMeasureCount"></param>
  24. /// <param name="beginTime"></param>
  25. /// <param name="MeasureTime"></param>
  26. public void SetMeasureStateInfo(string MeasureState,int completeSampleCount, int completeFieldCount, int particleCount, string beginTime, TimeSpan MsrUsedTime, string endTime,ref string measureTimes)
  27. {
  28. //设置测量状态
  29. lblMeasureState.Text = MeasureState;
  30. //设置开始时间
  31. lblBeginTime.Text = beginTime.ToString();
  32. //设置结束时间
  33. lblEndTime.Text = endTime.ToString();
  34. //测量数
  35. lblMeasureCount.Text = completeSampleCount.ToString();
  36. //设置当前帧图数
  37. lblSingleCount.Text = completeFieldCount.ToString();
  38. //设置颗粒数量
  39. lblParticleCount.Text = particleCount.ToString();
  40. //开始与截至时间 相差时间
  41. //TimeSpan tsSub = MsrUsedTime;
  42. TimeSpan tsSub = TimeSpans(Convert.ToDateTime(beginTime), Convert.ToDateTime(endTime)); //为差值显示例准确,于此计算但数值不一定为真实值并且与domeasure中差值会出现不一致
  43. //设置测量时间
  44. string measureTime = string.Empty;
  45. if (tsSub.Days > 0)
  46. {
  47. string str= table["str1"].ToString();
  48. measureTime += tsSub.Days + str;
  49. }
  50. if (tsSub.Hours > 0)
  51. {
  52. string str = table["str2"].ToString();
  53. measureTime += tsSub.Hours + str;
  54. }
  55. if (tsSub.Minutes > 0)
  56. {
  57. string str = table["str3"].ToString();
  58. measureTime += tsSub.Minutes + str;
  59. }
  60. if (tsSub.Seconds > 0)
  61. {
  62. string str = table["str4"].ToString();
  63. measureTime += tsSub.Seconds + str;
  64. }
  65. measureTimes = measureTime;
  66. //默认值
  67. if (measureTime.Equals(""))
  68. {
  69. string str = table["str5"].ToString();
  70. lblMeasureTime.Text = str;
  71. }
  72. else
  73. {
  74. lblMeasureTime.Text = measureTime;
  75. }
  76. }
  77. public TimeSpan TimeSpans(DateTime beginTime ,DateTime endTime)
  78. {
  79. //c#对时间差,有一个专门的类进行封装,TimeSpan.cs;
  80. System.DateTime pauseT = beginTime;
  81. System.DateTime resumeT = endTime;
  82. System.TimeSpan ts1 = new System.TimeSpan(pauseT.Ticks);
  83. System.TimeSpan ts2 = new System.TimeSpan(resumeT.Ticks);
  84. System.TimeSpan tsSub = ts1.Subtract(ts2).Duration();
  85. return tsSub;
  86. }
  87. private void MeasureCheckReportInfoWindow_FormClosing(object sender, FormClosingEventArgs e)
  88. {
  89. this.Close();
  90. }
  91. public void SetEndTime(string endTime)
  92. {
  93. lblEndTime.Text = endTime;
  94. }
  95. private void MeasureCheckReportInfoWindow_Load(object sender, EventArgs e)
  96. {
  97. }
  98. }
  99. }