终端一体化运控平台
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ManualControlViewModel.cs 3.5 KiB

2 år sedan
2 år sedan
2 år sedan
2 år sedan
2 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Microsoft.Toolkit.Mvvm.ComponentModel;
  7. using System.Collections.ObjectModel;
  8. using Microsoft.Toolkit.Mvvm.Input;
  9. using BPASmartClient.Helper;
  10. namespace BPASmartClient.JXJFoodSmallStation.ViewModel
  11. {
  12. public class ManualControlViewModel : ObservableObject
  13. {
  14. public ManualControlViewModel()
  15. {
  16. for (int i = 0; i < 15; i++)
  17. {
  18. cylinderModels.Add(new CylinderModel()
  19. {
  20. Name = $"升降气缸 {i + 1}",
  21. LeftTog = false,
  22. RightTog = false,
  23. });
  24. BlockCylinders.Add(new CylinderModel()
  25. {
  26. Name = $"阻挡气缸 {i + 1}",
  27. LeftTog = false,
  28. RightTog = false,
  29. });
  30. }
  31. for (int i = 1; i < 3; i++)
  32. {
  33. PalletCylinders.Add(new CylinderModel()
  34. {
  35. Name = $"托盘气缸1_{(i + 1)%2 +1}",
  36. LeftTog = false,
  37. RightTog = false,
  38. });
  39. }
  40. for (int i = 1; i < 3; i++)
  41. {
  42. PalletCylinders.Add(new CylinderModel()
  43. {
  44. Name = $"托盘气缸2_{(i + 1) % 2 + 1}",
  45. LeftTog = false,
  46. RightTog = false,
  47. });
  48. }
  49. PalletCylinders.Add(new CylinderModel()
  50. {
  51. Name = $"进料桶顶升气缸",
  52. LeftTog = false,
  53. RightTog = false,
  54. });
  55. for (int i = 0; i < 3; i++)
  56. {
  57. PalletCylinders.Add(new CylinderModel()
  58. {
  59. Name = $"出料桶顶升气缸{i+1}",
  60. LeftTog = false,
  61. RightTog = true,
  62. });
  63. }
  64. Open = new RelayCommand<object>((o) =>
  65. {
  66. ActionManage.GetInstance.Send("ManualOpen", o);
  67. });
  68. Close = new RelayCommand<object>((o) =>
  69. {
  70. ActionManage.GetInstance.Send("ManualClose", o);
  71. });
  72. }
  73. /// <summary>
  74. /// 升降气缸
  75. /// </summary>
  76. public ObservableCollection<CylinderModel> cylinderModels { get; set; } = new ObservableCollection<CylinderModel>();
  77. /// <summary>
  78. /// 阻挡气缸
  79. /// </summary>
  80. public ObservableCollection<CylinderModel> BlockCylinders { get; set; } = new ObservableCollection<CylinderModel>();
  81. /// <summary>
  82. /// 托盘气缸
  83. /// </summary>
  84. public ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>();
  85. public RelayCommand<object> Open { get; set; }
  86. public RelayCommand<object> Close { get; set; }
  87. }
  88. public class CylinderModel : ObservableObject
  89. {
  90. public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } }
  91. private bool _mLeftTog;
  92. public bool RightTog { get { return _mRightTog; } set { _mRightTog = value; OnPropertyChanged(); } }
  93. private bool _mRightTog;
  94. public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } }
  95. private string _mName;
  96. }
  97. }