diff options
| author | Avi Levkovich <avi@twine-s.com> | 2018-07-22 09:22:30 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2018-07-22 09:22:30 +0300 |
| commit | 392b017771f32e469269cd12af37b162eef56a5b (patch) | |
| tree | 36cae5ebcbdad7efa9809c63475cbd9e1955dcf1 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | 044fb3fe8e56c5f6d1803bf9b97d648abafba44c (diff) | |
| parent | 3fe33a685c3ca7a8730dacffa5357f77d7e76a96 (diff) | |
| download | Tango-392b017771f32e469269cd12af37b162eef56a5b.tar.gz Tango-392b017771f32e469269cd12af37b162eef56a5b.zip | |
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
3 files changed, 30 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs index 76e138e0e..8034ceb69 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs @@ -18,6 +18,7 @@ namespace Tango.MachineStudio.UI.ViewModels Cancel, Disconnect, UploadHardwareConfig, + Reset, } private IStudioApplicationManager _applicationManager; @@ -33,11 +34,20 @@ namespace Tango.MachineStudio.UI.ViewModels public RelayCommand UploadHardwareConfigurationCommand { get; set; } + public RelayCommand ResetCommand { get; set; } + public ConnectedMachineViewVM(IStudioApplicationManager application) { ApplicationManager = application; DisconnectCommand = new RelayCommand(Disconnect); UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration); + ResetCommand = new RelayCommand(Reset); + } + + private void Reset() + { + Result = ConnectedMachineVMResult.Reset; + Accept(); } private void UploadHardwareConfiguration() diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index a7762a5e6..278926de9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -545,6 +545,25 @@ namespace Tango.MachineStudio.UI.ViewModels } } } + else if (x.Result == ConnectedMachineViewVM.ConnectedMachineVMResult.Reset) + { + if (NotificationProvider.ShowQuestion("This will reset the embedded device. Are you sure?")) + { + using (NotificationProvider.PushTaskItem("Uploading hardware configuration...")) + { + try + { + await ApplicationManager.ConnectedMachine.Reset(); + NotificationProvider.ShowInfo("Embedded device has been restarted."); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error resetting embedded device."); + NotificationProvider.ShowError("Error resetting embedded device." + Environment.NewLine + ex.Message); + } + } + } + } }); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index a4f253de3..39c42392d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -117,6 +117,7 @@ <Grid Grid.Row="1"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Height="40" VerticalAlignment="Bottom"> + <Button Height="Auto" Width="140" Command="{Binding ResetCommand}" Background="#FF5454" BorderBrush="#FF5454" Margin="0 0 10 0" ToolTip="Reset the embedded device">RESET</Button> <Button Height="Auto" Command="{Binding UploadHardwareConfigurationCommand}" ToolTip="Upload the current hardware configuration stored for this machine"> <StackPanel Orientation="Horizontal"> <TextBlock VerticalAlignment="Center">UPLOAD HW CONFIG</TextBlock> |
