|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- 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.JXJFoodSmallStation.ViewModel
- {
- public class ManualControlViewModel : ObservableObject
- {
- public ManualControlViewModel()
- {
- for (int i = 0; i < 15; i++)
- {
- cylinderModels.Add(new CylinderModel()
- {
- Name = $"升降气缸 {i + 1}",
- LeftTog = false,
- RightTog = false,
- });
-
- BlockCylinders.Add(new CylinderModel()
- {
- Name = $"阻挡气缸 {i + 1}",
- LeftTog = false,
- RightTog = false,
- });
- }
-
- for (int i = 1; i < 3; i++)
- {
- PalletCylinders.Add(new CylinderModel()
- {
- Name = $"托盘气缸1_{(i + 1)%2 +1}",
- LeftTog = false,
- RightTog = false,
- });
- }
-
- for (int i = 1; i < 3; i++)
- {
- PalletCylinders.Add(new CylinderModel()
- {
- Name = $"托盘气缸2_{(i + 1) % 2 + 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<object>((o) =>
- {
- ActionManage.GetInstance.Send("ManualOpen", o);
- });
-
-
- Close = new RelayCommand<object>((o) =>
- {
- ActionManage.GetInstance.Send("ManualClose", o);
- });
- SystemStartCommand = new RelayCommand(() =>
- {
- ActionManage.GetInstance.Send("SystemStart");
- });
- SystemStopCommand = new RelayCommand(() =>
- {
- ActionManage.GetInstance.Send("SystemStop");
- });
- SystemPauseCommand = new RelayCommand(() =>
- {
- ActionManage.GetInstance.Send("SystemPause");
- });
- SystemResetCommand = new RelayCommand(() =>
- {
- ActionManage.GetInstance.Send("SystemReset");
- });
-
- DebugMode = new RelayCommand(() =>
- {
- ActionManage.GetInstance.Send("SystemDebugMode");
- });
- AutoMode = new RelayCommand(() =>
- {
- ActionManage.GetInstance.Send("SystemAutoMode");
- });
- }
-
- /// <summary>
- /// 升降气缸
- /// </summary>
- public ObservableCollection<CylinderModel> cylinderModels { get; set; } = new ObservableCollection<CylinderModel>();
-
- /// <summary>
- /// 阻挡气缸
- /// </summary>
- public ObservableCollection<CylinderModel> BlockCylinders { get; set; } = new ObservableCollection<CylinderModel>();
-
- /// <summary>
- /// 托盘气缸
- /// </summary>
- public ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>();
-
-
- public RelayCommand<object> Open { get; set; }
-
- public RelayCommand<object> Close { get; set; }
-
- public RelayCommand SystemStartCommand { get; set; }
- public RelayCommand SystemStopCommand { get; set; }
- public RelayCommand SystemPauseCommand { get; set; }
-
- public RelayCommand SystemResetCommand { get; set; }
-
- public RelayCommand AutoMode { get; set; }
- public RelayCommand DebugMode { 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;
-
-
-
- }
- }
|