diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs deleted file mode 100644 index 5c74d92cd..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Core; -using Tango.Core.Commands; -using Tango.Core.DI; -using Tango.Integration.Operation; -using Tango.PPC.Common.Connection; -using Tango.PPC.Common.Notifications; - -namespace Tango.PPC.Maintenance -{ - public abstract class MaintenanceCommand<T> : ExtendedObject - { - private IMachineProvider _machineProvider; - [TangoInject(Mode = TangoInjectMode.WhenAvailable)] - protected IMachineProvider MachineProvider - { - get { return _machineProvider; } - set - { - _machineProvider = value; RaisePropertyChangedAuto(); - _machineProvider.MachineOperator.StatusChanged += MachineOperator_StatusChanged; - } - } - - [TangoInject(Mode = TangoInjectMode.WhenAvailable)] - protected INotificationProvider NotificationProvider { get; set; } - - private RelayCommand _command; - public RelayCommand Command - { - get { return _command; } - set { _command = value; RaisePropertyChangedAuto(); } - } - - private bool _isEnabled; - public bool IsEnabled - { - get { return _isEnabled; } - set { _isEnabled = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } - } - - private T _state; - public T State - { - get { return _state; } - set { _state = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } - } - - private void MachineOperator_StatusChanged(object sender, MachineStatuses e) - { - InvalidateRelayCommands(); - } - - public MaintenanceCommand() - { - TangoIOC.Default.Inject(this); - IsEnabled = true; - Command = new RelayCommand(Execute, CanExecute); - } - - protected virtual bool CanExecute() - { - if (!IsEnabled) return false; - if (MachineProvider == null) return false; - if (!MachineProvider.MachineOperator.CanPrint) return false; - - return true; - } - - private void Execute() - { - OnExecute(); - } - - protected abstract void OnExecute(); - } -} |
