using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Toolkit.Mvvm.ComponentModel; using System.Collections.ObjectModel; using Microsoft.Toolkit.Mvvm.Input; using BPASmartClient.Helper; namespace BPASmartClient.DosingHKProject.ViewModel { public class ManualControlViewModel : ObservableObject { public ManualControlViewModel() { for (int i = 0; i < 6; i++) { cylinderModels.Add(new CylinderModel() { Name = $"顶升气缸 {i + 1}", LeftTog = false, RightTog = false, }); } PalletCylinders.Add(new CylinderModel() { Name = $"进料桶顶升气缸", LeftTog = false, RightTog = false, }); for (int i = 0; i < 3; i++) { PalletCylinders.Add(new CylinderModel() { Name = $"出料桶顶升气缸{i+1}", LeftTog = false, RightTog = false, }); } Open = new RelayCommand((o) => { ActionManage.GetInstance.Send("ManualOpen", o); }); Close = new RelayCommand((o) => { ActionManage.GetInstance.Send("ManualClose", o); }); } /// /// 升降气缸 /// public ObservableCollection cylinderModels { get; set; } = new ObservableCollection(); /// /// 阻挡气缸 /// public ObservableCollection BlockCylinders { get; set; } = new ObservableCollection(); /// /// 托盘气缸 /// public ObservableCollection PalletCylinders { get; set; } = new ObservableCollection(); public RelayCommand Open { get; set; } public RelayCommand Close { get; set; } } public class CylinderModel : ObservableObject { public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } } private bool _mLeftTog; public bool RightTog { get { return _mRightTog; } set { _mRightTog = value; OnPropertyChanged(); } } private bool _mRightTog; public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } } private string _mName; } }