diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index 65df72878..fe28dfb20 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -235,6 +235,11 @@ namespace Tango.PPC.UI.ViewModels /// </summary> public RelayCommand ResetCommand { get; set; } + /// <summary> + /// Gets or sets the stand by command. + /// </summary> + public RelayCommand StandByCommand { get; set; } + #endregion #region Constructors @@ -262,6 +267,7 @@ namespace Tango.PPC.UI.ViewModels RestartApplicationCommand = new RelayCommand(RestartApplication); PowerOffCommand = new RelayCommand(PowerOffMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); ResetCommand = new RelayCommand(ResetMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); + StandByCommand = new RelayCommand(StandBy, () => MachineProvider.MachineOperator.CanPrint); } #endregion @@ -403,6 +409,22 @@ namespace Tango.PPC.UI.ViewModels } } + private async void StandBy() + { + IsMenuOpened = false; + + try + { + LogManager.Log("Executing stand-by command."); + await MachineProvider.MachineOperator.StandBy(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error switching to stand-by mode."); + await NotificationProvider.ShowError($"Error switching to stand-by mode.\n{ex.FlattenMessage()}"); + } + } + #endregion #region Override Methods @@ -464,6 +486,7 @@ namespace Tango.PPC.UI.ViewModels { PowerOffCommand.RaiseCanExecuteChanged(); ResetCommand.RaiseCanExecuteChanged(); + StandByCommand.RaiseCanExecuteChanged(); }); } |
