From cd467ed8a6afec8dcf50d8dc71c75d9d445f7489 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 5 Dec 2019 11:30:45 +0200 Subject: Working on PPC packages... --- .../Application/IPPCApplicationManager.cs | 5 + .../MachineUpdate/IMachineUpdateManager.cs | 13 +++ .../MachineUpdate/MachineUpdateManager.cs | 26 ++++- .../Tango.PPC.Common/Navigation/NavigationView.cs | 1 + .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 1 + .../UpdatePackages/DefaultPackageRunner.cs | 112 +++++++++++++++++++-- .../UpdatePackages/IPackageRunner.cs | 3 +- .../UpdatePackages/PPCPackageAttribute.cs | 5 +- .../UpdatePackages/PackageContext.cs | 7 +- .../UpdatePackages/PackageInstallation.cs | 7 ++ .../UpdatePackages/PackageRunnerResult.cs | 13 +++ .../UpdatePackages/PackageStateChangedEventArgs.cs | 1 + .../PPCApplication/DefaultPPCApplicationManager.cs | 23 ++++- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 10 +- .../PPC/Tango.PPC.UI/ViewModelLocator.cs | 10 ++ .../Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs | 60 +++++++++++ .../Tango.PPC.UI/ViewModels/RestartingViewVM.cs | 27 +++++ .../PPC/Tango.PPC.UI/Views/MainView.xaml | 1 + .../PPC/Tango.PPC.UI/Views/RestartingView.xaml | 52 ++++++++++ .../PPC/Tango.PPC.UI/Views/RestartingView.xaml.cs | 28 ++++++ .../SamplePostPackage.cs | 2 +- .../SamplePrePackage.cs | 2 +- 22 files changed, 394 insertions(+), 15 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageRunnerResult.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/RestartingViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingView.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingView.xaml.cs (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs index 7c67ac1a3..1474eaa04 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -60,6 +60,11 @@ namespace Tango.PPC.Common.Application /// bool IsInTechnicianMode { get; } + /// + /// Gets a value indicating whether an update has occurred before the application started. + /// + bool IsAfterUpdate { get; } + /// /// Shutdown the application. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs index 85d61d4cc..299e18e57 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.PMR.Synchronization; +using Tango.PPC.Common.UpdatePackages; using Tango.PPC.Common.Web; namespace Tango.PPC.Common.MachineUpdate @@ -64,5 +65,17 @@ namespace Tango.PPC.Common.MachineUpdate /// The file path. /// Task GetUpdatePackageFileInfo(String filePath); + + /// + /// Checks whether any post update packages needs to be installed. + /// + /// + Task PostUpdatePackagesRequired(); + + /// + /// Runs all post update packages. + /// + /// + Task RunPostUpdatePackages(); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index ae3e093be..33a6d04e6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -19,6 +19,7 @@ using Tango.Integration.Upgrade; using Tango.PMR.Synchronization; using Tango.PPC.Common.Application; using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Navigation; using Tango.PPC.Common.UpdatePackages; using Tango.PPC.Common.Web; using Tango.Settings; @@ -33,6 +34,7 @@ namespace Tango.PPC.Common.MachineUpdate private IPPCApplicationManager _app_manager; private IMachineProvider _machineProvider; private IPackageRunner _packageRunner; + private INavigationManager _navigationManager; private PPCWebClient _client; #region Events @@ -66,7 +68,7 @@ namespace Tango.PPC.Common.MachineUpdate /// Initializes a new instance of the class. /// /// The application manager. - public MachineUpdateManager(PPCWebClient ppcWebClient, IPPCApplicationManager applicationManager, IMachineProvider machineProvider, IPackageRunner packageRunner) + public MachineUpdateManager(PPCWebClient ppcWebClient, IPPCApplicationManager applicationManager, IMachineProvider machineProvider, IPackageRunner packageRunner, INavigationManager navigationManager) { _client = ppcWebClient; _machineProvider = machineProvider; @@ -81,7 +83,7 @@ namespace Tango.PPC.Common.MachineUpdate private void _packageRunner_PackageStateChanged(object sender, PackageStateChangedEventArgs e) { - UpdateProgress("Preparing", e.PackageName); + UpdateProgress(e.PackageType == PackageType.Pre ? "Preparing" : "Finalizing", e.PackageName); } #endregion @@ -833,6 +835,26 @@ namespace Tango.PPC.Common.MachineUpdate }); } + /// + /// Checks whether any post update packages needs to be installed. + /// + /// + public Task PostUpdatePackagesRequired() + { + String packagesFolder = Path.Combine(AssemblyHelper.GetCurrentAssemblyFolder(), "packages"); + return _packageRunner.IsPackageInstallationRequired(PackageType.Post, packagesFolder); + } + + /// + /// Runs all post update packages. + /// + /// + public Task RunPostUpdatePackages() + { + String packagesFolder = Path.Combine(AssemblyHelper.GetCurrentAssemblyFolder(), "packages"); + return _packageRunner.Run(PackageType.Post, packagesFolder); + } + #endregion #region Protected Methods diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs index d8a1eec56..643908e87 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs @@ -23,5 +23,6 @@ namespace Tango.PPC.Common.Navigation ShutdownView, RestartingSystemView, EmergencyView, + RestartingView, } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 892269c03..671cac4f1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -162,6 +162,7 @@ + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/DefaultPackageRunner.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/DefaultPackageRunner.cs index 882896f04..e1323916b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/DefaultPackageRunner.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/DefaultPackageRunner.cs @@ -6,9 +6,14 @@ using System.IO; using System.Linq; using System.Reflection; using System.Text; +using System.Threading; using System.Threading.Tasks; using Tango.Core; +using Tango.Core.DI; using Tango.Core.Helpers; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; namespace Tango.PPC.Common.UpdatePackages { @@ -87,11 +92,16 @@ namespace Tango.PPC.Common.UpdatePackages File.WriteAllText(_configFile, json); } - public Task Run(PackageType type, String packagesFolder) + public Task Run(PackageType type, String packagesFolder) { - return Task.Factory.StartNew(() => + return Task.Factory.StartNew(() => { + PackageRunnerResult result = new PackageRunnerResult(); + PackageContext context = new PackageContext(); + context.ApplicationManager = TangoIOC.Default.GetInstance(); + context.MachineProvider = TangoIOC.Default.GetInstance(); + context.NotificationProvider = TangoIOC.Default.GetInstance(); LogManager.Log($"Running {type}-update packages..."); @@ -163,19 +173,27 @@ namespace Tango.PPC.Common.UpdatePackages { try { - OnPackageRuns(att.Name, installedPackage.State); + OnPackageRuns(att.Name, installedPackage.State, installedPackage.Type); + installedPackage.InstallationDate = DateTime.Now; packageInstance.Run(context).GetAwaiter().GetResult(); installedPackage.State = PackageInstallationState.Installed; installedPackage.FailedReason = null; - OnPackageRuns(att.Name, installedPackage.State); + OnPackageRuns(att.Name, installedPackage.State, installedPackage.Type); LogManager.Log("Package installed successfully."); + + if (att.RequiresRestart) + { + result.RestartRequired = true; + } + + Thread.Sleep(2000); } catch (Exception ex) { LogManager.Log(ex, "Package installation failed."); installedPackage.State = PackageInstallationState.Failed; installedPackage.FailedReason = ex.FlattenMessage(); - OnPackageRuns(att.Name, installedPackage.State); + OnPackageRuns(att.Name, installedPackage.State, installedPackage.Type); continue; } } @@ -210,15 +228,97 @@ namespace Tango.PPC.Common.UpdatePackages { LogManager.Log(ex, "Error saving packages file!"); } + + return result; + }); + } + + public Task IsPackageInstallationRequired(PackageType type, String packagesFolder) + { + return Task.Factory.StartNew(() => + { + LogManager.Log("Checking if any package installation is required..."); + + _packagesFile = GetPackagesFile().Result; + + //Get all packages in folder. + foreach (var packageFile in Directory.GetFiles(packagesFolder, "*.dll")) + { + LogManager.Log($"Loading assembly '{Path.GetFileName(packageFile)}'..."); + + Assembly asm; + + //Load assembly and investigate for types based on package type. + try + { + asm = Assembly.LoadFile(packageFile); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading assembly!"); + continue; + } + + try + { + foreach (var packageType in asm.GetTypes().Where( + x => typeof(IPPCPackage).IsAssignableFrom(x) && + x.GetCustomAttribute() != null && + x.GetCustomAttribute().Type == type)) + { + LogManager.Log($"Checking package '{packageType.FullName}'..."); + + try + { + //Getting installed package from file. + var installedPackage = _packagesFile.PackageInstallations.SingleOrDefault(x => x.PackageName == packageType.FullName); + + //Check if requires installation. + if (installedPackage == null || installedPackage.State != PackageInstallationState.Installed) + { + if (installedPackage == null) + { + LogManager.Log("Package was never installed."); + return true; + } + else + { + LogManager.Log($"Package installation state is '{installedPackage.State}' due to {installedPackage.FailedReason}"); + return true; + } + } + else + { + LogManager.Log("Package is already installed."); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error in handling the package!"); + continue; + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error investigating assembly!"); + continue; + } + } + + LogManager.Log("No packages to install."); + + return false; }); } - protected virtual void OnPackageRuns(String packageName, PackageInstallationState state) + protected virtual void OnPackageRuns(String packageName, PackageInstallationState state, PackageType type) { PackageStateChanged?.Invoke(this, new PackageStateChangedEventArgs() { PackageName = packageName, State = state, + PackageType = type, }); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/IPackageRunner.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/IPackageRunner.cs index 03c583dca..8a3490f8d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/IPackageRunner.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/IPackageRunner.cs @@ -10,6 +10,7 @@ namespace Tango.PPC.Common.UpdatePackages { event EventHandler PackageStateChanged; Task GetPackagesFile(); - Task Run(PackageType type, String packagesFolder); + Task Run(PackageType type, String packagesFolder); + Task IsPackageInstallationRequired(PackageType type, String packagesFolder); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PPCPackageAttribute.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PPCPackageAttribute.cs index 7ae4ea52d..3186b57b1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PPCPackageAttribute.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PPCPackageAttribute.cs @@ -13,10 +13,13 @@ namespace Tango.PPC.Common.UpdatePackages public PackageType Type { get; set; } - public PPCPackageAttribute(PackageType type, String name) + public bool RequiresRestart { get; set; } + + public PPCPackageAttribute(PackageType type, String name, bool requiresRestart) { Type = type; Name = name; + RequiresRestart = requiresRestart; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageContext.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageContext.cs index cf96ff026..4cfe49af8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageContext.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageContext.cs @@ -3,11 +3,16 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; namespace Tango.PPC.Common.UpdatePackages { public class PackageContext { - + public IPPCApplicationManager ApplicationManager { get; set; } + public IMachineProvider MachineProvider { get; set; } + public INotificationProvider NotificationProvider { get; set; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageInstallation.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageInstallation.cs index bcffb1b6e..bf00915bd 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageInstallation.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageInstallation.cs @@ -12,8 +12,15 @@ namespace Tango.PPC.Common.UpdatePackages public PackageType Type { get; set; } + public DateTime InstallationDate { get; set; } + public PackageInstallationState State { get; set; } public String FailedReason { get; set; } + + public PackageInstallation() + { + InstallationDate = DateTime.Now; + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageRunnerResult.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageRunnerResult.cs new file mode 100644 index 000000000..55f3a490a --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageRunnerResult.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.UpdatePackages +{ + public class PackageRunnerResult + { + public bool RestartRequired { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageStateChangedEventArgs.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageStateChangedEventArgs.cs index 62eb00e5e..9c8cbe2c0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageStateChangedEventArgs.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UpdatePackages/PackageStateChangedEventArgs.cs @@ -10,5 +10,6 @@ namespace Tango.PPC.Common.UpdatePackages { public PackageInstallationState State { get; set; } public String PackageName { get; set; } + public PackageType PackageType { get; set; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index ed5ea2629..95c4ccdac 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -32,6 +32,7 @@ using Tango.PPC.UI.Dialogs; using Tango.Core.Threading; using Tango.PPC.Common.Messages; using Tango.Core.ExtensionMethods; +using Tango.PPC.Common.Navigation; namespace Tango.PPC.UI.PPCApplication { @@ -130,6 +131,11 @@ namespace Tango.PPC.UI.PPCApplication /// public DateTime StartUpDate { get; private set; } + /// + /// Gets a value indicating whether an update has occurred before the application started. + /// + public bool IsAfterUpdate { get; private set; } + private bool _isScreenLocked; /// /// Gets or sets a value indicating whether the screen is currently locked. @@ -220,6 +226,10 @@ namespace Tango.PPC.UI.PPCApplication isAfterSetup = true; LogManager.Log("System restart is required."); } + else + { + IsAfterUpdate = true; + } settings.ApplicationState = ApplicationStates.Ready; settings.Save(); @@ -419,7 +429,7 @@ namespace Tango.PPC.UI.PPCApplication /// /// Restarts the application. /// - public void Restart() + public async void Restart() { if (IsShuttingDown) return; @@ -427,8 +437,19 @@ namespace Tango.PPC.UI.PPCApplication try { + _dispatcher.Invoke(() => + { + var nav = TangoIOC.Default.GetInstance(); + if (nav != null) + { + nav.NavigateTo(NavigationView.RestartingView); + } + }); + LogManager.Log("Restarting the application..."); + await Task.Delay(8000); + _watchdogServer.Dispose(); foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index e71e5794d..9691987c2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -165,6 +165,7 @@ + @@ -180,6 +181,9 @@ LoadingErrorView.xaml + + RestartingView.xaml + LoadingView.xaml @@ -269,6 +273,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + Designer MSBuild:Compile @@ -608,7 +616,7 @@ if $(ConfigurationName) == Release del *.xml - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index ed56f8a08..60bce4e20 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -74,6 +74,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); TangoIOC.Default.Register(new PPCWebClient()); TangoIOC.Default.Register(new DefaultDispatcherProvider(Application.Current.Dispatcher)); @@ -110,6 +111,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); TangoIOC.Default.GetInstance().ContentRendered += (_, __) => @@ -215,5 +217,13 @@ namespace Tango.PPC.UI return TangoIOC.Default.GetInstance(); } } + + public static RestartingViewVM RestartingViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } } } \ No newline at end of file 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 diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/RestartingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/RestartingViewVM.cs new file mode 100644 index 000000000..46111031b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/RestartingViewVM.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; + +namespace Tango.PPC.UI.ViewModels +{ + public class RestartingViewVM : PPCViewModel + { + public override void OnApplicationStarted() + { + + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + } + + public override void OnNavigatedFrom() + { + base.OnNavigatedFrom(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index d139ad5ed..5be95ded4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -124,6 +124,7 @@ + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingView.xaml new file mode 100644 index 000000000..41017f629 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingView.xaml @@ -0,0 +1,52 @@ + + + + + + + + + + v + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingView.xaml.cs new file mode 100644 index 000000000..fabd7b47b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Views +{ + /// + /// Interaction logic for LoadingView.xaml + /// + public partial class RestartingView : UserControl + { + public RestartingView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.SamplePostPackage/SamplePostPackage.cs b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.SamplePostPackage/SamplePostPackage.cs index 0d5e117da..25c2c514b 100644 --- a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.SamplePostPackage/SamplePostPackage.cs +++ b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.SamplePostPackage/SamplePostPackage.cs @@ -8,7 +8,7 @@ using Tango.PPC.Common.UpdatePackages; namespace Tango.PPC.Packages.SamplePostPackage { - [PPCPackage(PackageType.Post, "Sample Post Package")] + [PPCPackage(PackageType.Post, "Sample Post Package", true)] public class SamplePostPackage : ExtendedObject, IPPCPackage { public Task Run(PackageContext context) diff --git a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.SamplePrePackage/SamplePrePackage.cs b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.SamplePrePackage/SamplePrePackage.cs index 1e51e9c94..5aa811e85 100644 --- a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.SamplePrePackage/SamplePrePackage.cs +++ b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.SamplePrePackage/SamplePrePackage.cs @@ -8,7 +8,7 @@ using Tango.PPC.Common.UpdatePackages; namespace Tango.PPC.Packages.SamplePrePackage { - [PPCPackage(PackageType.Pre, "Sample Pre Package")] + [PPCPackage(PackageType.Pre, "Sample Pre Package", false)] public class SamplePrePackage : ExtendedObject, IPPCPackage { public Task Run(PackageContext context) -- cgit v1.3.1