添加 MX-PD-盘古 项目文件
将 MX-PD-盘古 - new 目录下的所有文件添加到主仓库
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
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<CylinderItemState> Cylinders { get; } = new ObservableCollection<CylinderItemState>();
|
||||
}
|
||||
|
||||
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<CylinderSignalState> OutputSignals { get; } = new ObservableCollection<CylinderSignalState>();
|
||||
public ObservableCollection<CylinderSignalState> FeedbackSignals { get; } = new ObservableCollection<CylinderSignalState>();
|
||||
|
||||
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"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
using Stylet;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace MainShell.DeviceMaintance.ViewModel.State
|
||||
{
|
||||
public class DeviceIoPageState : PropertyChangedBase
|
||||
{
|
||||
private DateTime _lastRefreshTime = DateTime.MinValue;
|
||||
private DateTime _lastWriteTime = DateTime.MinValue;
|
||||
private bool _isOnline;
|
||||
private bool _isWriteSuccess;
|
||||
private string _lastWriteMessage = "等待写入操作";
|
||||
|
||||
public DateTime LastRefreshTime
|
||||
{
|
||||
get { return _lastRefreshTime; }
|
||||
set { SetAndNotify(ref _lastRefreshTime, value); }
|
||||
}
|
||||
|
||||
public DateTime LastWriteTime
|
||||
{
|
||||
get { return _lastWriteTime; }
|
||||
set { SetAndNotify(ref _lastWriteTime, value); }
|
||||
}
|
||||
|
||||
public bool IsOnline
|
||||
{
|
||||
get { return _isOnline; }
|
||||
set
|
||||
{
|
||||
if (SetAndNotify(ref _isOnline, value))
|
||||
{
|
||||
OnPropertyChanged(nameof(OnlineText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsWriteSuccess
|
||||
{
|
||||
get { return _isWriteSuccess; }
|
||||
set { SetAndNotify(ref _isWriteSuccess, value); }
|
||||
}
|
||||
|
||||
public string LastWriteMessage
|
||||
{
|
||||
get { return _lastWriteMessage; }
|
||||
set { SetAndNotify(ref _lastWriteMessage, value); }
|
||||
}
|
||||
|
||||
public string OnlineText
|
||||
{
|
||||
get { return IsOnline ? "在线" : "离线/模拟"; }
|
||||
}
|
||||
|
||||
public ObservableCollection<DeviceIoModuleState> Modules { get; } = new ObservableCollection<DeviceIoModuleState>();
|
||||
}
|
||||
|
||||
public class DeviceIoModuleState : PropertyChangedBase
|
||||
{
|
||||
private string _name;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { SetAndNotify(ref _name, value); }
|
||||
}
|
||||
|
||||
public ObservableCollection<DeviceIoPointItemState> InputPoints { get; } = new ObservableCollection<DeviceIoPointItemState>();
|
||||
public ObservableCollection<DeviceIoPointItemState> OutputPoints { get; } = new ObservableCollection<DeviceIoPointItemState>();
|
||||
|
||||
public bool HasInputs
|
||||
{
|
||||
get { return InputPoints.Count > 0; }
|
||||
}
|
||||
|
||||
public bool HasOutputs
|
||||
{
|
||||
get { return OutputPoints.Count > 0; }
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceIoPointItemState : PropertyChangedBase
|
||||
{
|
||||
private bool _isOn;
|
||||
private bool _canWrite;
|
||||
|
||||
public int Id { get; set; }
|
||||
public string PointKey { get; set; }
|
||||
public string Module { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int StationNo { get; set; }
|
||||
public string LineNo { get; set; }
|
||||
public string Description { get; set; }
|
||||
public bool IsOutput { get; set; }
|
||||
public bool IsInverse { get; set; }
|
||||
|
||||
public bool IsOn
|
||||
{
|
||||
get { return _isOn; }
|
||||
set
|
||||
{
|
||||
if (SetAndNotify(ref _isOn, value))
|
||||
{
|
||||
OnPropertyChanged(nameof(StateText));
|
||||
OnPropertyChanged(nameof(ToggleText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanWrite
|
||||
{
|
||||
get { return _canWrite; }
|
||||
set { SetAndNotify(ref _canWrite, value); }
|
||||
}
|
||||
|
||||
public string StateText
|
||||
{
|
||||
get { return IsOn ? "ON" : "OFF"; }
|
||||
}
|
||||
|
||||
public string ToggleText
|
||||
{
|
||||
get { return IsOn ? "ON" : "OFF"; }
|
||||
}
|
||||
|
||||
public ICommand ToggleCommand { get; set; }
|
||||
}
|
||||
|
||||
public class ActionCommand : ICommand
|
||||
{
|
||||
private readonly Action _execute;
|
||||
private readonly Func<bool> _canExecute;
|
||||
|
||||
public ActionCommand(Action execute, Func<bool> canExecute = null)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return _canExecute == null || _canExecute();
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_execute();
|
||||
}
|
||||
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
var handler = CanExecuteChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user