TrafficWindow.xaml.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Shapes;
  13. using AGV_WPF.TrafficDefine;
  14. namespace AGV_WPF
  15. {
  16. /// <summary>
  17. /// TrafficWindow.xaml 的交互逻辑
  18. /// </summary>
  19. public partial class TrafficWindow : Window
  20. {
  21. public TrafficWindow()
  22. {
  23. InitializeComponent();
  24. }
  25. private void btnTrafficData_Click(object sender, RoutedEventArgs e)
  26. {
  27. List<TrafficArea> list = TrafficManager.Traffic.TrafficAreaList;
  28. string str = "";
  29. for (int i = 0; i < list.Count; i++)
  30. {
  31. str = string.Format("管制区:{0},是否关键点:{1}\r\n", list[i].TrafficNum, list[i].IsNeedKeyMark);
  32. for (int j = 0; j < list[i].StationList.Count;j++ )
  33. {
  34. str += string.Format("当前点:{0},{1},下一点:{2},{3}\r\n", list[i].StationList[j].CurrentMark.WorkLine, list[i].StationList[j].CurrentMark.MarkNum, list[i].StationList[j].NextMark.WorkLine, list[i].StationList[j].NextMark.MarkNum);
  35. }
  36. txtData.AppendText(str);
  37. }
  38. }
  39. private void btnAgvData_Click(object sender, RoutedEventArgs e)
  40. {
  41. //AgvStatus[] list = AGV_WPF.MainWindow.mainWindow.AgvStatusList;
  42. //string str = "";
  43. //for (int i = 0; i < list.Length;i++ )
  44. //{
  45. // str += string.Format("AGV{0},管制区:", list[i].AgvNum);
  46. // for (int j = 0; j < list[i].TrafficNumList.Count;j++ )
  47. // {
  48. // str += string.Format("{0},", list[i].TrafficNumList[j]);
  49. // }
  50. // str += "\r\n";
  51. //}
  52. //txtData.AppendText(str);
  53. }
  54. private void btnClear_Click(object sender, RoutedEventArgs e)
  55. {
  56. txtData.Text = "";
  57. }
  58. private void btnTrafficStatus_Click(object sender, RoutedEventArgs e)
  59. {
  60. List<TrafficArea> list = TrafficManager.Traffic.TrafficAreaList;
  61. string str = "";
  62. for (int i = 0; i < list.Count; i++)
  63. {
  64. str += string.Format("管制区:{0},状态:{1},占领AGV:{2},等待AGV:", list[i].TrafficNum, list[i].Status, list[i].OccupyAgv);
  65. for (int j = 0; j < list[i].WaitAgvList.Count; j++)
  66. {
  67. str += string.Format("{0},", list[i].WaitAgvList[j]);
  68. }
  69. str += "\r\n";
  70. }
  71. txtData.AppendText(str);
  72. }
  73. }
  74. }