终端一体化运控平台
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

94 wiersze
2.7 KiB

  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.DosingHKProject.ViewModel
  11. {
  12. public class ManualControlViewModel : ObservableObject
  13. {
  14. public ManualControlViewModel()
  15. {
  16. for (int i = 0; i < 6; i++)
  17. {
  18. cylinderModels.Add(new CylinderModel()
  19. {
  20. Name = $"顶升气缸 {i + 1}",
  21. LeftTog = false,
  22. RightTog = false,
  23. });
  24. }
  25. PalletCylinders.Add(new CylinderModel()
  26. {
  27. Name = $"进料桶顶升气缸",
  28. LeftTog = false,
  29. RightTog = false,
  30. });
  31. for (int i = 0; i < 3; i++)
  32. {
  33. PalletCylinders.Add(new CylinderModel()
  34. {
  35. Name = $"出料桶顶升气缸{i+1}",
  36. LeftTog = false,
  37. RightTog = false,
  38. });
  39. }
  40. Open = new RelayCommand<object>((o) =>
  41. {
  42. ActionManage.GetInstance.Send("ManualOpen", o);
  43. });
  44. Close = new RelayCommand<object>((o) =>
  45. {
  46. ActionManage.GetInstance.Send("ManualClose", o);
  47. });
  48. }
  49. /// <summary>
  50. /// 升降气缸
  51. /// </summary>
  52. public ObservableCollection<CylinderModel> cylinderModels { get; set; } = new ObservableCollection<CylinderModel>();
  53. /// <summary>
  54. /// 阻挡气缸
  55. /// </summary>
  56. public ObservableCollection<CylinderModel> BlockCylinders { get; set; } = new ObservableCollection<CylinderModel>();
  57. /// <summary>
  58. /// 托盘气缸
  59. /// </summary>
  60. public ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>();
  61. public RelayCommand<object> Open { get; set; }
  62. public RelayCommand<object> Close { get; set; }
  63. }
  64. public class CylinderModel : ObservableObject
  65. {
  66. public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } }
  67. private bool _mLeftTog;
  68. public bool RightTog { get { return _mRightTog; } set { _mRightTog = value; OnPropertyChanged(); } }
  69. private bool _mRightTog;
  70. public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } }
  71. private string _mName;
  72. }
  73. }