diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 38 |
1 files changed, 37 insertions, 1 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 42d947326..d16792ead 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -16,6 +16,7 @@ using Tango.PPC.Common; using Tango.PPC.Common.Connection; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; +using Tango.PPC.UI.Dialogs; using Tango.PPC.UI.Views; using Tango.PPC.UI.ViewsContracts; using Tango.SharedUI; @@ -300,7 +301,7 @@ namespace Tango.PPC.UI.ViewModels SignOutCommand = new RelayCommand(SignOut); UpdateCommand = new RelayCommand(UpdateMachine); - PowerCommand = new RelayCommand(() => IsPowerOpened = true); + PowerCommand = new RelayCommand(OpenPowerOptions); RestartApplicationCommand = new RelayCommand(RestartApplication); PowerOffCommand = new RelayCommand(PowerOffMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); ResetCommand = new RelayCommand(ResetMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); @@ -311,6 +312,41 @@ namespace Tango.PPC.UI.ViewModels #region Private Methods + private async void OpenPowerOptions() + { + IsPowerOpened = true; + + if (BuildProvider.IsEureka) + { + PowerEurekaViewVM vm = new PowerEurekaViewVM(); + vm = await NotificationProvider.ShowDialog<PowerEurekaViewVM>(vm); + + if (!vm.DialogResult) return; + + switch(vm.PowerAction) + { + case PowerEurekaViewVM.PowerActionEnum.TurnOff: + if(MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected) + PowerOffMachine(); + return; + case PowerEurekaViewVM.PowerActionEnum.StandBy: + if (MachineProvider.MachineOperator.CanPrint) + StandBy(); + return; + case PowerEurekaViewVM.PowerActionEnum.RestartT: + RestartApplication(); + return; + case PowerEurekaViewVM.PowerActionEnum.Restart: + if (MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected) + ResetMachine(); + return; + default: + return; + } + + } + } + /// <summary> /// Stops the printing. /// </summary> |
