From 97110bad5a8b4926886ca69c443c9a60a4bf1326 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Wed, 7 Feb 2018 23:34:01 -0600 Subject: [PATCH] Move version check to a different thread --- DS4Windows/DS4Forms/DS4Form.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 0956f35..9c768c5 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -333,7 +333,7 @@ namespace DS4Windows if (checkwhen > 0 && DateTime.Now >= LastChecked + TimeSpan.FromHours(checkwhen)) { wc.DownloadFileAsync(url, appdatapath + "\\version.txt"); - wc.DownloadFileCompleted += Check_Version; + wc.DownloadFileCompleted += (sender, e) => { TaskRunner.Run(() => Check_Version(sender, e)); }; LastChecked = DateTime.Now; } @@ -690,8 +690,9 @@ namespace DS4Windows string newversion = File.ReadAllText(appdatapath + "\\version.txt").Trim(); if (version.Replace(',', '.').CompareTo(newversion) == -1) { - if (MessageBox.Show(Properties.Resources.DownloadVersion.Replace("*number*", newversion), - Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + if ((DialogResult)this.Invoke(new Func(() => { + return MessageBox.Show(Properties.Resources.DownloadVersion.Replace("*number*", newversion), +Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question); })) == DialogResult.Yes) { if (!File.Exists(exepath + "\\DS4Updater.exe") || (File.Exists(exepath + "\\DS4Updater.exe") && (FileVersionInfo.GetVersionInfo(exepath + "\\DS4Updater.exe").FileVersion.CompareTo("1.1.0.0") == -1)))