From 66be0fdd579050375421ad54dc25cf35bac0845c Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 15 Dec 2020 16:52:30 +0200 Subject: Implemented several fallbacks to PPC update failure ! --- .../PPCApplication/DefaultPPCApplicationManager.cs | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication') 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 af3473a98..83790a56f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -63,6 +63,11 @@ namespace Tango.PPC.UI.PPCApplication /// public event EventHandler SystemRestartRequired; + /// + /// Occurs when the updater utility has failed to perform the last update. + /// + public event EventHandler UpdaterFailed; + /// /// Occurs when the application has started. /// @@ -140,6 +145,11 @@ namespace Tango.PPC.UI.PPCApplication /// public bool IsAfterUpdate { get; private set; } + /// + /// Gets a value indicating whether the updater utility has failed to perform the last update. + /// + public bool IsUpdateFailed { get; private set; } + private bool _isScreenLocked; /// /// Gets or sets a value indicating whether the screen is currently locked. @@ -264,6 +274,18 @@ namespace Tango.PPC.UI.PPCApplication } } + if (App.StartupArgs.Contains("-update_failed")) + { + LogManager.Log("Application started with '-update_failed' startup arguments. The updater utility has failed."); + + IsUpdateFailed = true; + + settings.ApplicationState = ApplicationStates.Ready; + settings.Save(); + UpdaterFailed?.Invoke(this, new EventArgs()); + return; + } + if (settings.ApplicationState == ApplicationStates.Ready) { LogManager.Log("Initializing ObservablesStaticCollections..."); @@ -616,7 +638,13 @@ namespace Tango.PPC.UI.PPCApplication } LogManager.Log($"Executing '{updaterPath}' with arguments '{arguments}'..."); - Process.Start(updaterPath, arguments); + + Process p = new Process(); + p.StartInfo.FileName = updaterPath; + p.StartInfo.Arguments = arguments; + p.StartInfo.LoadUserProfile = true; + p.StartInfo.UseShellExecute = true; + p.Start(); LogManager.Log("Terminating application..."); Environment.Exit(0); -- cgit v1.3.1