aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
index 47d5835f5..b2f93c29d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
@@ -17,6 +17,7 @@ namespace Tango.PPC.Technician.ViewModels
{
private IOperationSystemManager _os;
private Timer _statsTimer;
+ private bool _resettingDevice;
private float _cpu;
public float CPU
@@ -39,6 +40,8 @@ namespace Tango.PPC.Technician.ViewModels
set { _temperature = value; RaisePropertyChangedAuto(); }
}
+ public RelayCommand ResetDeviceCommand { get; set; }
+
public RelayCommand RestartCommand { get; set; }
public RelayCommand ShutdownCommand { get; set; }
@@ -58,6 +61,27 @@ namespace Tango.PPC.Technician.ViewModels
ShutdownCommand = new RelayCommand(ShutdownSystem);
FactoryResetCommand = new RelayCommand(FactoryReset);
ExitToExplorerCommand = new RelayCommand(ExitToExplorer);
+ ResetDeviceCommand = new RelayCommand(ResetDevice, () => !_resettingDevice);
+ }
+
+ private async void ResetDevice()
+ {
+ try
+ {
+ _resettingDevice = true;
+ ResetDeviceCommand.RaiseCanExecuteChanged();
+ await MachineProvider.MachineOperator.ResetDFU();
+ await NotificationProvider.ShowInfo("Embedded device has been reset successfully.");
+ }
+ catch (Exception ex)
+ {
+ await NotificationProvider.ShowError(ex.FlattenMessage());
+ }
+ finally
+ {
+ _resettingDevice = false;
+ ResetDeviceCommand.RaiseCanExecuteChanged();
+ }
}
private async void FactoryReset()