Form1.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Windows.Forms;
  3. using BenQGuru.eMES.DLLService;
  4. using System.Collections.Generic;
  5. namespace UAS_AutoPast
  6. {
  7. public partial class Form1 : Form
  8. {
  9. MESHelper helper;
  10. DataHelper dh;
  11. List<string> Data = new List<string>();
  12. //Queue<string> que = new Queue<string>();
  13. /// <summary>
  14. /// 一次采集运行的时间
  15. /// </summary>
  16. int SecondCount = 0;
  17. /// <summary>
  18. /// 设置是否开始采集
  19. /// </summary>
  20. bool StartCount = false;
  21. public Form1()
  22. {
  23. InitializeComponent();
  24. }
  25. private void Form1_Load(object sender, EventArgs e)
  26. {
  27. //dh = new DataHelper();
  28. helper = new MESHelper();
  29. AutoPastTimer.Interval = 1000;
  30. AutoPastTimer.Tick += AutoPastTimer_Tick;
  31. }
  32. private void AutoPastTimer_Tick(object sender, EventArgs e)
  33. {
  34. //从采集到第一个数据开始计算秒数
  35. if (StartCount)
  36. {
  37. SecondCount = SecondCount + 1;
  38. }
  39. }
  40. private void CollectData_KeyDown(object sender, KeyEventArgs e)
  41. {
  42. if (e.KeyCode == Keys.Enter)
  43. {
  44. //设置开始计时本次采集
  45. if (Data.Count == 0)
  46. {
  47. StartCount = true;
  48. }
  49. if (Data.Count < CollectNum.Value)
  50. {
  51. if (CollectData.Text != "")
  52. Data.Add(CollectData.Text);
  53. }
  54. }
  55. }
  56. private void Start_Click(object sender, EventArgs e)
  57. {
  58. AutoPastTimer.Start();
  59. Status_label.Text = "运行中";
  60. }
  61. private void Stop_Click(object sender, EventArgs e)
  62. {
  63. AutoPastTimer.Stop();
  64. Status_label.Text = "未开始";
  65. }
  66. }
  67. }