AGVSingleControl.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using AGV_WPF.Models;
  10. using AGV_WPF_Global;
  11. using AGV_WPF.Tools;
  12. namespace AGV_WPF
  13. {
  14. public partial class AGVSingleControl : Form
  15. {
  16. public AGVSingleControl()
  17. {
  18. InitializeComponent();
  19. }
  20. private void AGVSingleControl_Load(object sender, EventArgs e)
  21. {
  22. int AGVNUM_MAX = Convert.ToByte(System.Configuration.ConfigurationManager.AppSettings["AGVNUM_MAX"]);
  23. for (int i = 1; i <= AGVNUM_MAX; i++)
  24. {
  25. comboBox2.Items.Add(i);
  26. }
  27. comboBox2.SelectedIndex=0;
  28. // comboBox1.Items.Add("休眠"); comboBox1.Items.Add("唤醒");
  29. comboBox1.Items.Add("启动"); comboBox1.Items.Add("停止");
  30. comboBox1.SelectedIndex = 0;
  31. }
  32. private void button1_Click(object sender, EventArgs e)
  33. {
  34. string btnHeader = comboBox1.Text;
  35. int ActionCode = 0;
  36. if (btnHeader.ToString().Contains("休眠"))
  37. {
  38. ActionCode = 0x20;
  39. GlobalPara.isSingleControl = true;
  40. GlobalPara.SingleSWAGVNum = int.Parse(comboBox2.Text);
  41. }
  42. else if (btnHeader.ToString().Contains("唤醒"))
  43. {
  44. ActionCode = 0x30;
  45. GlobalPara.isSingleControl = true;
  46. GlobalPara.SingleSWAGVNum = int.Parse(comboBox2.Text);
  47. }
  48. else if (btnHeader.ToString().Contains("启动"))
  49. {
  50. ActionCode = 0x40;
  51. }
  52. else if (btnHeader.ToString().Contains("停止"))
  53. {
  54. ActionCode = 0x50;
  55. }
  56. DispatcherTool.ControlAllAgv(ActionCode, 0, int.Parse(comboBox2.Text), true);
  57. }
  58. }
  59. }