aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-12-05 11:30:45 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-12-05 11:30:45 +0200
commitcd467ed8a6afec8dcf50d8dc71c75d9d445f7489 (patch)
tree0adc1655c1d11c434061993d47ef77e461284f7f /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
parente8c9c0b649f31bf5170be409cdf6925aa9fc11b6 (diff)
downloadTango-cd467ed8a6afec8dcf50d8dc71c75d9d445f7489.tar.gz
Tango-cd467ed8a6afec8dcf50d8dc71c75d9d445f7489.zip
Working on PPC packages...
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs60
1 files changed, 60 insertions, 0 deletions
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 01e67d3ce..4cc4ee46f 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
@@ -275,6 +275,66 @@ namespace Tango.PPC.UI.ViewModels
base.OnApplicationReady();
StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Update.Extension, HandleSoftwareUpdatePackageLoaded);
+
+ if (ApplicationManager.IsAfterUpdate)
+ {
+ RunPostUpdatePackages();
+ }
+ }
+
+ #endregion
+
+ #region Post Update Packages
+
+ private async void RunPostUpdatePackages()
+ {
+ await Task.Delay(1000);
+
+ LogManager.Log("Application was loaded after an update. Checking for required post-update packages...");
+
+ bool required = false;
+
+ try
+ {
+ required = await MachineUpdateManager.PostUpdatePackagesRequired();
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error checking for post-update packages.");
+ }
+
+ if (required)
+ {
+ LogManager.Log("Post-update packages found and needs to be installed. Navigating to machine update and running post-update packages...");
+ await NavigationManager.NavigateTo(Common.Navigation.NavigationView.MachineUpdateView);
+ await NavigateTo(MachineUpdateView.UpdateProgressView);
+ try
+ {
+ var result = await MachineUpdateManager.RunPostUpdatePackages();
+
+ LogManager.Log("Post-update packages installed successfully.");
+
+ await Task.Delay(2000);
+
+ if (result.RestartRequired)
+ {
+ LogManager.Log("Restart required. Restarting...");
+ ApplicationManager.Restart();
+ }
+ else
+ {
+ await NavigationManager.NavigateTo(Common.Navigation.NavigationView.LayoutView);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error occurred while running post-update packages.");
+ }
+ }
+ else
+ {
+ LogManager.Log("No post-update packages installation required.");
+ }
}
#endregion