From 42301d524216011d0d125aac303a254051bf7c57 Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Mon, 20 Dec 2021 13:57:21 -0500 Subject: [PATCH] More startup/upgrade cleanup --- App.xaml.cs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/App.xaml.cs b/App.xaml.cs index 29c6fcf..b5144a7 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -36,6 +36,22 @@ namespace WorkIndicator _dispatcher = Dispatcher.CurrentDispatcher; + // Create an isolation handle to see if we are already running + _isolationHandle = ApplicationIsolation.GetIsolationHandle(); + + // If there is another copy then pass it the command line and exit + if (_isolationHandle == null) + { + try + { + InterprocessMessageSender.SendMessage(Environment.CommandLine); + } + catch { } + + Shutdown(); + return; + } + // Initialize the command line listener _commandLineListener = new InterprocessMessageListener(Assembly.GetEntryAssembly().GetName().Name); _commandLineListener.MessageReceived += HandleCommandLine; @@ -53,22 +69,6 @@ namespace WorkIndicator Task.Factory.StartNew(() => { - // Create an isolation handle to see if we are already running - _isolationHandle = ApplicationIsolation.GetIsolationHandle(); - - // If there is another copy then pass it the command line and exit - if (_isolationHandle == null) - { - try - { - InterprocessMessageSender.SendMessage(Environment.CommandLine); - } - catch { } - - _dispatcher.Invoke(Shutdown); - return; - } - // Set automatic start into the registry Current.SetStartWithWindows(Settings.Default.StartWithWindows); @@ -89,7 +89,7 @@ namespace WorkIndicator private void HandleUpdateStatus(UpdateCheck.UpdateStatus status, string message) { - if (status != UpdateCheck.UpdateStatus.Downloading) + if (status != UpdateCheck.UpdateStatus.Installing) return; _dispatcher.Invoke(() => TrayIcon.ShowUpdateMessage(message));