终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ManualControlViewModel.cs 2.7 KiB

2 jaren geleden
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 = 0; i < 2; 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. }