From ee36ea1ae60e1fa71b816461d8511740dacae49b Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 24 Nov 2019 09:34:52 +0200 Subject: [PATCH] Fixed bug with wrong update messages --- Crypto Notepad/MainForm.cs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Crypto Notepad/MainForm.cs b/Crypto Notepad/MainForm.cs index efb44c1..f6e1ff6 100644 --- a/Crypto Notepad/MainForm.cs +++ b/Crypto Notepad/MainForm.cs @@ -277,7 +277,7 @@ private async Task CheckForUpdates(bool autoCheck) { using (new CenterWinDialog(this)) { - DialogResult res = MessageBox.Show(this, "New version is available. Install it now?", PublicVar.appName, + DialogResult res = MessageBox.Show(this, "New version is available. Install it now?", PublicVar.appName, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (res == DialogResult.Yes) { @@ -311,21 +311,19 @@ private async Task CheckForUpdates(bool autoCheck) { if (autoCheck) { - mainMenu.Invoke((Action)delegate + using (new CenterWinDialog(this)) { - using (new CenterWinDialog(this)) + if (statusPanel.Visible) { - if (statusPanel.Visible) - { - StatusPanelMessage("update-failed"); - } - else - { - MessageBox.Show(this, "Checking for updates failed:\nConnection lost or the server is busy.", PublicVar.appName, - MessageBoxButtons.OK, MessageBoxIcon.Error); - } + StatusPanelMessage("update-failed"); } - }); + else + { + MessageBox.Show(this, "Checking for updates failed:\nConnection lost or the server is busy.", PublicVar.appName, + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } } }