aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs
diff options
context:
space:
mode:
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.cs82
1 files changed, 81 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..17b676499 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;
@@ -30,6 +31,7 @@ namespace Tango.PPC.UI.ViewModels
{
private JobHandler _jobHandler;
private bool _resettingDevice;
+ private DispatcherTimer _date_timer;
/// <summary>
/// Gets or sets the module loader.
@@ -218,6 +220,16 @@ namespace Tango.PPC.UI.ViewModels
set { _cartridges = value; RaisePropertyChangedAuto(); }
}
+ private DateTime _currentDateTime;
+ /// <summary>
+ /// Gets or sets the current date time.
+ /// </summary>
+ public DateTime CurrentDateTime
+ {
+ get { return _currentDateTime; }
+ set { _currentDateTime = value; RaisePropertyChangedAuto(); }
+ }
+
#endregion
#region Commands
@@ -281,6 +293,10 @@ namespace Tango.PPC.UI.ViewModels
/// Gets or sets the stand by command.
/// </summary>
public RelayCommand StandByCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the open general information dialog command.
+ /// </summary>
+ public RelayCommand OpenGeneralinformationCommand { get; set; }
#endregion
@@ -300,17 +316,61 @@ 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);
StandByCommand = new RelayCommand(StandBy, () => MachineProvider.MachineOperator.CanPrint);
+ OpenGeneralinformationCommand = new RelayCommand(OpenGeneralinformationDlg);
+
+ _date_timer = new DispatcherTimer();
+ _date_timer.Interval = TimeSpan.FromSeconds(1);
+ _date_timer.Tick += _date_timer_Tick;
+ _date_timer.Start();
}
#endregion
#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;
+ case PowerEurekaViewVM.PowerActionEnum.CloseApp:
+ CloseApplication();
+ return;
+ default:
+ return;
+ }
+
+ }
+ }
+
/// <summary>
/// Stops the printing.
/// </summary>
@@ -398,6 +458,14 @@ namespace Tango.PPC.UI.ViewModels
}
}
+ private async void CloseApplication()
+ {
+ if (await NotificationProvider.ShowQuestion("Are you sure you want to close the application?"))
+ {
+ ApplicationManager.ShutDown();
+ }
+ }
+
/// <summary>
/// Powers off the machine.
/// </summary>
@@ -475,6 +543,13 @@ namespace Tango.PPC.UI.ViewModels
IsMenuOpened = false;
}
+ private async void OpenGeneralinformationDlg()
+ {
+ GeneralInformationViewVM vm = new GeneralInformationViewVM(MachineProvider, ApplicationManager);
+ vm = await NotificationProvider.ShowDialog<GeneralInformationViewVM>(vm);
+
+ }
+
#endregion
#region Override Methods
@@ -578,6 +653,11 @@ namespace Tango.PPC.UI.ViewModels
#region Event Handlers
+ private void _date_timer_Tick(object sender, EventArgs e)
+ {
+ CurrentDateTime = DateTime.Now;
+ }
+
/// <summary>
/// Handles the PrintingStarted event of the MachineOperator.
/// </summary>