diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2019-12-18 13:27:02 +0200 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2019-12-18 13:27:02 +0200 |
| commit | 41129873d38034c5679eeaf46f48e4f67fd38ba2 (patch) | |
| tree | 94109a9602e91bcf7f114e3491bc8018e60bef4c /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | |
| parent | 70e3f2699a500666d1ca4e4d5db2dbaafb339e80 (diff) | |
| parent | a61a911d1ebde107ba7bf210af7e753e692d93e2 (diff) | |
| download | Tango-41129873d38034c5679eeaf46f48e4f67fd38ba2.tar.gz Tango-41129873d38034c5679eeaf46f48e4f67fd38ba2.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
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 | 26 |
1 files changed, 26 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 9e8a9fe34..d7717e6db 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -10,6 +10,7 @@ using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; +using Tango.PPC.UI.Views; using Tango.PPC.UI.ViewsContracts; using Tango.SharedUI; @@ -121,6 +122,11 @@ namespace Tango.PPC.UI.ViewModels /// </summary> public RelayCommand RestartApplicationCommand { get; set; } + /// <summary> + /// Gets or sets the power off command. + /// </summary> + public RelayCommand PowerOffCommand { get; set; } + #endregion #region Constructors @@ -146,6 +152,7 @@ namespace Tango.PPC.UI.ViewModels PowerCommand = new RelayCommand(() => IsPowerOpened = true); RestartApplicationCommand = new RelayCommand(RestartApplication); + PowerOffCommand = new RelayCommand(PowerOffMachine); } #endregion @@ -239,6 +246,25 @@ namespace Tango.PPC.UI.ViewModels } } + /// <summary> + /// Powers off the machine. + /// </summary> + private async void PowerOffMachine() + { + IsMenuOpened = false; + if (await NotificationProvider.ShowQuestion("Are you sure you wish to turn off the machine?")) + { + try + { + await MachineProvider.MachineOperator.PowerDown(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error triggering power down."); + } + } + } + #endregion #region Override Methods |
