using CCDCount.DLL; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; namespace CCDCountWpf { public class PlcMessageShowBindingClass : INotifyPropertyChanged { /// /// 使能完成 /// private bool enableCompletion; public bool EnableCompletion { get { return enableCompletion; } set { enableCompletion = value; OnPropertyChanged("EnableCompletion"); } } /// /// 归零完成 /// private bool returnToZeroCompletion; public bool ReturnToZeroCompletion { get { return returnToZeroCompletion; } set { returnToZeroCompletion = value; OnPropertyChanged("ReturnToZeroCompletion"); } } /// /// 停止完成 /// private bool stopCompletion; public bool StopCompletion { get { return stopCompletion; } set { stopCompletion = value; OnPropertyChanged("StopCompletion"); } } /// /// 速度运行 /// private bool speedRunning; public bool SpeedRunning { get { return speedRunning; } set { speedRunning = value; OnPropertyChanged("SpeedRunning"); } } /// /// 回零中 /// private bool returnToZero; public bool ReturnToZero { get { return returnToZero; } set { returnToZero = value; OnPropertyChanged("ReturnToZero"); } } /// /// 中转阀开定位完成 /// private bool transferValveOpenCompletion; public bool TransferValveOpenCompletion { get { return transferValveOpenCompletion; } set { transferValveOpenCompletion = value; OnPropertyChanged("TransferValveOpenCompletion"); } } /// /// 中转阀关定位完成 /// private bool transferValveCloseCompletion; public bool TransferValveCloseCompletion { get { return transferValveCloseCompletion; } set { transferValveCloseCompletion = value; OnPropertyChanged("TransferValveCloseCompletion"); } } /// /// 允许数据交换 /// private bool allowsDataExchange; public bool AllowsDataExchange { get { return allowsDataExchange; } set { allowsDataExchange = value; OnPropertyChanged("AllowsDataExchange"); } } /// /// 暂停数据交换 /// private bool pauseDataExchange; public bool PauseDataExchange { get { return pauseDataExchange; } set { pauseDataExchange = value; OnPropertyChanged("PauseDataExchange"); } } /// /// 缓存计数延迟完成 /// private bool cacheCountDelayed; public bool CacheCountDelayed { get { return cacheCountDelayed; } set { cacheCountDelayed = value; OnPropertyChanged("CacheCountDelayed"); } } /// /// 使能 /// private bool enable; public bool Enable { get { return enable; } set { enable = value; OnPropertyChanged("Enable"); } } /// /// 速度模式运行速度 /// private float speedModeRunningSpeed; public string SpeedModeRunningSpeed { get { return speedModeRunningSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { speedModeRunningSpeed = result; PlcSettingMessageBus.pLCManagement.WriteSpeedModeRunningSpeed(result); OnPropertyChanged("SpeedModeRunningSpeed"); } } } /// /// 点动速度 /// private float jogSpeed; public string JogSpeed { get { return jogSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { jogSpeed = result; PlcSettingMessageBus.pLCManagement.WriteJogSpeed(result); OnPropertyChanged("JogSpeed"); } } } /// /// 瓶装设定值 /// private UInt16 bottValueSet; public UInt16 BottValueSet { get { return bottValueSet; } set { bottValueSet = value; PlcSettingMessageBus.pLCManagement.WriteBottValueSet(value); OnPropertyChanged("BottValueSet"); } } /// /// 中转阀打开速度 /// private float transferValveOpeningSpeed; public string TransferValveOpeningSpeed { get { return transferValveOpeningSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { transferValveOpeningSpeed = result; PlcSettingMessageBus.pLCManagement.WriteTransferValveOpeningSpeed(result); OnPropertyChanged("TransferValveOpeningSpeed"); } } } /// /// 中转阀打开时间 /// private UInt32 transferValveOpeningTime; public UInt32 TransferValveOpeningTime { get { return transferValveOpeningTime; } set { transferValveOpeningTime = value; PlcSettingMessageBus.pLCManagement.WriteTransferValveOpeningTime(value); OnPropertyChanged("TransferValveOpeningTime"); } } /// /// 罐装减速值 /// private UInt16 bottingDecelerationValue; public UInt16 BottingDecelerationValue { get { return bottingDecelerationValue; } set { bottingDecelerationValue = value; PlcSettingMessageBus.pLCManagement.WriteBottingDecelerationValue(value); OnPropertyChanged("BottingDecelerationValue"); } } /// /// 缓存减速值 /// private UInt16 cacheDecelerationValue { get; set;} public UInt16 CacheDecelerationValue { get { return cacheDecelerationValue; } set { cacheDecelerationValue = value; PlcSettingMessageBus.pLCManagement.WriteCacheDecelerationValue(value); OnPropertyChanged("CacheDecelerationValue"); } } /// /// 缓存计数延迟时间 /// private UInt32 cacheCountDelayTiming; public UInt32 CacheCountDelayTiming { get { return cacheCountDelayTiming; } set { cacheCountDelayTiming = value; PlcSettingMessageBus.pLCManagement.WriteCacheCountDelayTiming(value); OnPropertyChanged("CacheCountDelayTiming"); } } /// /// 缓存停机值 /// private UInt16 cacheShutdownValue; public UInt16 CacheShutdownValue { get { return cacheShutdownValue; } set { cacheShutdownValue = value; PlcSettingMessageBus.pLCManagement.WriteCacheShutdownValue(value); OnPropertyChanged("CacheShutdownValue"); } } /// /// 罐装料筒震台高速值 /// private UInt16 bottingMaterialCylinderVibrationTableHighSpeedValue; public UInt16 BottingMaterialCylinderVibrationTableHighSpeedValue { get { return bottingMaterialCylinderVibrationTableHighSpeedValue; } set { bottingMaterialCylinderVibrationTableHighSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteBottingMaterialCylinderVibrationTableHighSpeedValue(value); OnPropertyChanged("BottingMaterialCylinderVibrationTableHighSpeedValue"); } } /// /// 罐装过滤震台高速值 /// private UInt16 bottingFilterVibrationTableHighSpeedValue; public UInt16 BottingFilterVibrationTableHighSpeedValue { get { return bottingFilterVibrationTableHighSpeedValue; } set { bottingFilterVibrationTableHighSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteBottingFilterVibrationTableHighSpeedValue(value); OnPropertyChanged("BottingFilterVibrationTableHighSpeedValue"); } } /// /// 罐装计数震台高速值 /// private UInt16 bottingCountVibrationTableHighSpeedValue; public UInt16 BottingCountVibrationTableHighSpeedValue { get { return bottingCountVibrationTableHighSpeedValue; } set { bottingCountVibrationTableHighSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteBottingCountVibrationTableHighSpeedValue(value); OnPropertyChanged("BottingCountVibrationTableHighSpeedValue"); } } /// /// 罐装料筒震台减速值 /// private UInt16 bottingMaterialCylinderVibrationTableDecelerationSpeedValue; public UInt16 BottingMaterialCylinderVibrationTableDecelerationSpeedValue { get { return bottingMaterialCylinderVibrationTableDecelerationSpeedValue; } set { bottingMaterialCylinderVibrationTableDecelerationSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteBottingMaterialCylinderVibrationTableDecelerationSpeedValue(value); OnPropertyChanged("BottingMaterialCylinderVibrationTableDecelerationSpeedValue"); } } /// /// 罐装过滤震台减速值 /// private UInt16 bottingFilterVibrationTableDecelerationSpeedValue; public UInt16 BottingFilterVibrationTableDecelerationSpeedValue { get { return bottingFilterVibrationTableDecelerationSpeedValue; } set { bottingFilterVibrationTableDecelerationSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteBottingFilterVibrationTableDecelerationSpeedValue(value); OnPropertyChanged("BottingFilterVibrationTableDecelerationSpeedValue"); } } /// /// 罐装计数震台减速值 /// private UInt16 bottingCountVibrationTableDecelerationSpeedValue; public UInt16 BottingCountVibrationTableDecelerationSpeedValue { get { return bottingCountVibrationTableDecelerationSpeedValue; } set { bottingCountVibrationTableDecelerationSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteBottingCountVibrationTableDecelerationSpeedValue(value); OnPropertyChanged("BottingCountVibrationTableDecelerationSpeedValue"); } } /// /// 缓存料筒震台高速值 /// private UInt16 cacheMaterialCylinderVibrationTableHighSpeedValue; public UInt16 CacheMaterialCylinderVibrationTableHighSpeedValue { get { return cacheMaterialCylinderVibrationTableHighSpeedValue; } set { cacheMaterialCylinderVibrationTableHighSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteCacheMaterialCylinderVibrationTableHighSpeedValue(value); OnPropertyChanged("CacheMaterialCylinderVibrationTableHighSpeedValue"); } } /// /// 缓存过滤震台高速值 /// private UInt16 cacheFilterVibrationTableHighSpeedValue; public UInt16 CacheFilterVibrationTableHighSpeedValue { get { return cacheFilterVibrationTableHighSpeedValue; } set { cacheFilterVibrationTableHighSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteCacheFilterVibrationTableHighSpeedValue(value); OnPropertyChanged("CacheFilterVibrationTableHighSpeedValue"); } } /// /// 缓存计数震台高速值 /// private UInt16 cacheCountVibrationTableHighSpeedValue; public UInt16 CacheCountVibrationTableHighSpeedValue { get { return cacheCountVibrationTableHighSpeedValue; } set { cacheCountVibrationTableHighSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteCacheCountVibrationTableHighSpeedValue(value); OnPropertyChanged("CacheCountVibrationTableHighSpeedValue"); } } /// /// 缓存料筒震台减速值 /// private UInt16 cacheMaterialCylinderVibrationTableDecelerationSpeedValue; public UInt16 CacheMaterialCylinderVibrationTableDecelerationSpeedValue { get { return cacheMaterialCylinderVibrationTableDecelerationSpeedValue; } set { cacheMaterialCylinderVibrationTableDecelerationSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteCacheMaterialCylinderVibrationTableDecelerationSpeedValue(value); OnPropertyChanged("CacheMaterialCylinderVibrationTableDecelerationSpeedValue"); } } /// /// 缓存过滤震台减速值 /// private UInt16 cacheFilterVibrationTableDecelerationSpeedValue; public UInt16 CacheFilterVibrationTableDecelerationSpeedValue { get { return cacheFilterVibrationTableDecelerationSpeedValue; } set { cacheFilterVibrationTableDecelerationSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteCacheFilterVibrationTableDecelerationSpeedValue(value); OnPropertyChanged("CacheFilterVibrationTableDecelerationSpeedValue"); } } /// /// 缓存计数震台减速值 /// private UInt16 cacheCountVibrationTableDecelerationSpeedValue; public UInt16 CacheCountVibrationTableDecelerationSpeedValue { get { return cacheCountVibrationTableDecelerationSpeedValue; } set { cacheCountVibrationTableDecelerationSpeedValue = value; PlcSettingMessageBus.pLCManagement.WriteCacheCountVibrationTableDecelerationSpeedValue(value); OnPropertyChanged("CacheCountVibrationTableDecelerationSpeedValue"); } } /// /// 阀门打开延时 /// private UInt32 gateOpeningDelay; public UInt32 GateOpeningDelay { get { return gateOpeningDelay; } set { gateOpeningDelay = value; PlcSettingMessageBus.pLCManagement.WriteGateOpeningDelay(value); OnPropertyChanged("GateOpeningDelay"); } } /// /// 回零偏移值 /// private float returnToZeroOffsetValue; public string ReturnToZeroOffsetValue { get { return returnToZeroOffsetValue.ToString("F2"); } set { if (float.TryParse(value, out float result)) { returnToZeroOffsetValue = result; PlcSettingMessageBus.pLCManagement.WriteReturnToZeroOffsetValue(result); OnPropertyChanged("ReturnToZeroOffsetValue"); } } } /// /// 回零偏移速度 /// private float returnToZeroOffsetSpeed; public string ReturnToZeroOffsetSpeed { get { return returnToZeroOffsetSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { returnToZeroOffsetSpeed = result; PlcSettingMessageBus.pLCManagement.WriteReturnToZeroOffsetSpeed(result); OnPropertyChanged("ReturnToZeroOffsetSpeed"); } } } /// /// 中转阀关闭速度 /// private float transferValveClosingSpeed; public string TransferValveClosingSpeed { get { return transferValveClosingSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { transferValveClosingSpeed = result; PlcSettingMessageBus.pLCManagement.WriteTransferValveClosingSpeed(result); OnPropertyChanged("TransferValveClosingSpeed"); } } } /// /// 中转阀开位置 /// private float transferValveOpenPosition; public string TransferValveOpenPosition { get { return transferValveOpenPosition.ToString("F2"); } set { if (float.TryParse(value, out float result)) { transferValveOpenPosition = result; PlcSettingMessageBus.pLCManagement.WriteTransferValveOpenPosition(result); OnPropertyChanged("TransferValveOpenPosition"); } } } /// /// 中转阀关位置 /// private float transferValveClosePosition; public string TransferValveClosePosition { get { return transferValveClosePosition.ToString("F2"); } set { if (float.TryParse(value, out float result)) { transferValveClosePosition = result; PlcSettingMessageBus.pLCManagement.WriteTransferValveClosePosition(result); OnPropertyChanged("TransferValveClosePosition"); } } } /// /// 气阀开延时 /// private UInt32 airValveOpeningDelay; public UInt32 AirValveOpeningDelay { get { return airValveOpeningDelay; } set { airValveOpeningDelay = value; PlcSettingMessageBus.pLCManagement.WriteAirValveOpeningDelay(value); OnPropertyChanged("AirValveOpeningDelay"); } } /// /// 装瓶停机值 /// private UInt16 bottlingShutdownValue; public UInt16 BottlingShutdownValue { get { return bottlingShutdownValue; } set { bottlingShutdownValue = value; PlcSettingMessageBus.pLCManagement.WriteBottlingShutdownValue(value); OnPropertyChanged("BottlingShutdownValue"); } } /// /// 装瓶停机时间 /// private UInt32 bottlingShutdownTime; public UInt32 BottlingShutdownTime { get { return bottlingShutdownTime; } set { bottlingShutdownTime = value; PlcSettingMessageBus.pLCManagement.WriteBottlingShutdownTime(value); OnPropertyChanged("BottlingShutdownTime"); } } //数据绑定核心实现 public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }