diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-10-16 00:45:34 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-10-16 00:45:34 +0300 |
| commit | 43895ee9f170f68e7383e39ce089532a257f2d6d (patch) | |
| tree | 871fa248582de3779f1c293b5177feb137f7aa2f /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels | |
| parent | b0bfa02de917d23271c15d2516e26f951c7e41e0 (diff) | |
| download | Tango-43895ee9f170f68e7383e39ce089532a257f2d6d.tar.gz Tango-43895ee9f170f68e7383e39ce089532a257f2d6d.zip | |
Implemented PPC standby.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
| -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(); }); } |
