using MainShell.Manual.ViewModel.State; using Stylet; using System; using System.Collections.ObjectModel; using System.Windows.Input; namespace MainShell.DeviceMaintance.ViewModel.State { public class CylinderPageState : PropertyChangedBase { private DateTime _lastActionTime = DateTime.MinValue; private string _lastActionMessage = "等待气缸控制操作"; public DateTime LastActionTime { get { return _lastActionTime; } set { SetAndNotify(ref _lastActionTime, value); } } public string LastActionMessage { get { return _lastActionMessage; } set { SetAndNotify(ref _lastActionMessage, value); } } public ObservableCollection Cylinders { get; } = new ObservableCollection(); } public class CylinderItemState : PropertyChangedBase { private bool _isBusy; public string Name { get; set; } public string Description { get; set; } public string Module { get; set; } public string ControlTypeText { get; set; } public bool IsBusy { get { return _isBusy; } set { SetAndNotify(ref _isBusy, value); } } public ObservableCollection OutputSignals { get; } = new ObservableCollection(); public ObservableCollection FeedbackSignals { get; } = new ObservableCollection(); public ICommand ExtendCommand { get; set; } public ICommand RetractCommand { get; set; } } public class CylinderSignalState : PropertyChangedBase { private bool _isOn; public string PointReference { get; set; } public string PointKey { get; set; } public string Name { get; set; } public string LineNo { get; set; } public bool IsOutput { get; set; } public string IoNameText { get { return string.IsNullOrWhiteSpace(PointReference) ? string.Empty : "IO Name:" + PointReference; } } public bool IsOn { get { return _isOn; } set { if (SetAndNotify(ref _isOn, value)) { OnPropertyChanged(nameof(StateText)); } } } public string StateText { get { return IsOn ? "ON" : "OFF"; } } } }