From a51d07a893e671cab70b222a151a609d1daa0353 Mon Sep 17 00:00:00 2001 From: Tichau Date: Thu, 18 Feb 2016 19:19:00 +0100 Subject: [PATCH] Handle session terminating for windows certification purpose. --- Application/FileConverter/Application.xaml.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Application/FileConverter/Application.xaml.cs b/Application/FileConverter/Application.xaml.cs index 2fe59f6..3e4c33f 100644 --- a/Application/FileConverter/Application.xaml.cs +++ b/Application/FileConverter/Application.xaml.cs @@ -41,6 +41,7 @@ namespace FileConverter private bool needToRunConversionThread; private bool cancelAutoExit; + private bool isSessionEnding; private UpgradeVersionDescription upgradeVersionDescription = null; public Application() @@ -48,6 +49,14 @@ namespace FileConverter this.ConvertionJobs = this.conversionJobs.AsReadOnly(); } + protected override void OnSessionEnding(SessionEndingCancelEventArgs e) + { + base.OnSessionEnding(e); + + this.isSessionEnding = true; + this.Shutdown(); + } + public static Version ApplicationVersion { get @@ -109,8 +118,8 @@ namespace FileConverter base.OnExit(e); Debug.Log("Exit application."); - - if (this.upgradeVersionDescription != null && this.upgradeVersionDescription.NeedToUpgrade) + + if (!this.isSessionEnding && this.upgradeVersionDescription != null && this.upgradeVersionDescription.NeedToUpgrade) { Debug.Log("A new version of file converter has been found: {0}.", this.upgradeVersionDescription.LatestVersion);