diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-02 16:37:25 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-02 16:37:25 +0200 |
| commit | a2d959a7777bf2387d0f50dbc1ecf69f53e2253d (patch) | |
| tree | 8c6367189294d96ae074f386cdb4139dfeacb84a /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage | |
| parent | ae614a63f593122cd28c644625db179f298dd640 (diff) | |
| download | Tango-a2d959a7777bf2387d0f50dbc1ecf69f53e2253d.tar.gz Tango-a2d959a7777bf2387d0f50dbc1ecf69f53e2253d.zip | |
Implemented machine studio storage module. firmware upgrade version/validate/activate.
Implemented firmware package generator utility.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage')
2 files changed, 40 insertions, 2 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs index a9cfed937..4db48c636 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/ViewModels/MainViewVM.cs @@ -75,6 +75,10 @@ namespace Tango.MachineStudio.Storage.ViewModels public RelayCommand UploadVersionCommand { get; set; } + public RelayCommand ValidateVersionCommand { get; set; } + + public RelayCommand ActivateVersionCommand { get; set; } + public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IFirmwareUpgrader firmwareUpgrader) { _applicationManager = applicationManager; @@ -96,6 +100,8 @@ namespace Tango.MachineStudio.Storage.ViewModels DeleteFolderCommand = new RelayCommand(DeleteFolder, () => StorageManager != null && SelectedStorageItem != null && SelectedStorageItem is StorageFolder); UploadFileCommand = new RelayCommand(UploadFile, () => StorageManager != null && StorageManager.CurrentFolder != null); UploadVersionCommand = new RelayCommand(UploadVersion, () => StorageManager != null && StorageManager.CurrentFolder != null); + ValidateVersionCommand = new RelayCommand(ValidateVersion, () => StorageManager != null && StorageManager.CurrentFolder != null); + ActivateVersionCommand = new RelayCommand(ActivateVersion, () => StorageManager != null && StorageManager.CurrentFolder != null); } private void UploadFile() @@ -362,5 +368,37 @@ namespace Tango.MachineStudio.Storage.ViewModels { _firmwareUpgrader.InvokeUpgradeUI(); } + + private async void ValidateVersion() + { + using (_notification.PushTaskItem("Validating firmware version...")) + { + try + { + await _applicationManager.ConnectedMachine.ValidateFirmwareVersion(StorageManager.CurrentPath); + _notification.ShowInfo($"Version validated successfully!"); + } + catch (Exception ex) + { + _notification.ShowError($"Error validating firmware version.\n{ex.FlattenMessage()}"); + } + } + } + + private async void ActivateVersion() + { + using (_notification.PushTaskItem("Activating firmware version...")) + { + try + { + await _applicationManager.ConnectedMachine.ActivateFirmwareVersion(StorageManager.CurrentPath); + _notification.ShowInfo($"Version activated successfully!"); + } + catch (Exception ex) + { + _notification.ShowError($"Error activating firmware version.\n{ex.FlattenMessage()}"); + } + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/Views/MainView.xaml index 1f435b696..e59837d49 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Storage/Views/MainView.xaml @@ -68,13 +68,13 @@ <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">UPGRADE VERSION</TextBlock> </DockPanel> </Button> - <Button Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="#363636" HorizontalContentAlignment="Left"> + <Button Command="{Binding ValidateVersionCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="#363636" HorizontalContentAlignment="Left"> <DockPanel> <materialDesign:PackIcon Kind="CheckAll" Foreground="#682EBE" Width="32" Height="32" /> <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">VALIDATE VERSION</TextBlock> </DockPanel> </Button> - <Button Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="#363636" HorizontalContentAlignment="Left"> + <Button Command="{Binding ActivateVersionCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="#363636" HorizontalContentAlignment="Left"> <DockPanel> <materialDesign:PackIcon Kind="Flash" Foreground="#532990" Width="32" Height="32" /> <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">ACTIVATE VERSION</TextBlock> |
