From 2b31d32af7ebbe27861cdaa639279d98aacf17e6 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 15 Oct 2020 23:12:39 +0300 Subject: Fixed error handling of bad tfp package from DOK. --- .../PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs index 23ec956a0..bbace48dd 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs @@ -478,12 +478,14 @@ namespace Tango.PPC.UI.ViewModels packageInfo = await MachineProvider.MachineOperator.GetFirmwarePackageInfo(st); } - vm.Version = packageInfo.FileDescriptors.SingleOrDefault(x => x.Destination == VersionFileDestination.Mcu).Version; + packageInfo.Validate(); + + vm.Version = packageInfo.GetMcuVersion().ToString(); } catch (Exception ex) { LogManager.Log(ex, $"Error loading package info from {fileItem.Path}."); - await NotificationProvider.ShowError("An error occurred while trying to load the selected firmware upgrade package. Please make sure the package is valid."); + await NotificationProvider.ShowError($"An error occurred while trying to load the selected firmware upgrade package.\n{ex.FlattenMessage()}"); return; } -- cgit v1.3.1 From 3dad2354fa07e71210bb0308406558ae3b96b54c Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Fri, 16 Oct 2020 00:54:58 +0300 Subject: Prevent a machine update while dyeing. --- .../PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 20 ++++++++++++++------ .../Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs | 6 ++++++ 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs') 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 fe28dfb20..562a3b659 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -256,12 +256,7 @@ namespace Tango.PPC.UI.ViewModels StopPrintingCommand = new RelayCommand(StopPrinting); SignOutCommand = new RelayCommand(SignOut); - UpdateCommand = new RelayCommand(() => - { - NavigationManager.NavigateTo(NavigationView.MachineUpdateView); - TangoIOC.Default.GetInstance().CheckForUpdates(); - IsMenuOpened = false; - }); + UpdateCommand = new RelayCommand(UpdateMachine); PowerCommand = new RelayCommand(() => IsPowerOpened = true); RestartApplicationCommand = new RelayCommand(RestartApplication); @@ -425,6 +420,19 @@ namespace Tango.PPC.UI.ViewModels } } + private void UpdateMachine() + { + if (MachineProvider.MachineOperator.IsPrinting) + { + NotificationProvider.ShowInfo("Cannot perform a machine update while the machine is dyeing."); + return; + } + + NavigationManager.NavigateTo(NavigationView.MachineUpdateView); + TangoIOC.Default.GetInstance().CheckForUpdates(); + IsMenuOpened = false; + } + #endregion #region Override Methods diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs index bbace48dd..613c70809 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs @@ -539,6 +539,12 @@ namespace Tango.PPC.UI.ViewModels _updateNotificationItem.IsDatabaseUpdate = e.IsDatabaseUpdateAvailable && !e.IsUpdateAvailable; _updateNotificationItem.Pressed += (_, __) => { + if (MachineProvider.MachineOperator.IsPrinting) + { + NotificationProvider.ShowInfo("Cannot perform a machine update while the machine is dyeing."); + return; + } + _updateNotificationItem = null; if (!IsVisible) -- cgit v1.3.1