Update method improved

This commit is contained in:
Alexander 2019-10-02 19:35:34 +03:00
parent acaab489a2
commit 7281d0bae4

View file

@ -1,4 +1,4 @@
using Crypto_Notepad.Properties; using Crypto_Notepad.Properties;
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
@ -46,7 +46,7 @@ protected override void WndProc(ref Message m)
} }
#region Functions #region Methods
private void DecryptAES() private void DecryptAES()
{ {
EnterKeyForm enterKeyForm = new EnterKeyForm EnterKeyForm enterKeyForm = new EnterKeyForm
@ -379,8 +379,6 @@ private void CheckForUpdates(bool autoCheck)
if (serverVersion > appVersion) if (serverVersion > appVersion)
{ {
mainMenu.Invoke((Action)delegate
{
if (statusPanel.Visible) if (statusPanel.Visible)
{ {
StatusPanelMessage("update-needed"); StatusPanelMessage("update-needed");
@ -402,13 +400,10 @@ private void CheckForUpdates(bool autoCheck)
} }
} }
} }
});
} }
if (serverVersion <= appVersion && autoCheck) if (serverVersion <= appVersion && autoCheck)
{ {
mainMenu.Invoke((Action)delegate
{
using (new CenterWinDialog(this)) using (new CenterWinDialog(this))
{ {
if (statusPanel.Visible) if (statusPanel.Visible)
@ -420,9 +415,7 @@ private void CheckForUpdates(bool autoCheck)
MessageBox.Show("Crypto Notepad is up to date.", PublicVar.appName, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Crypto Notepad is up to date.", PublicVar.appName, MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
} }
});
} }
} }
catch catch
{ {
@ -605,6 +598,7 @@ public void MenuIcons()
} }
} }
} }
public void Toolbaricons(bool oldicons) public void Toolbaricons(bool oldicons)
{ {
if (oldicons) if (oldicons)
@ -744,8 +738,9 @@ private void MainWindow_Load(object sender, EventArgs e)
if (settings.autoCheckUpdate) if (settings.autoCheckUpdate)
{ {
Thread up = new Thread(() => CheckForUpdates(false)); //Thread up = new Thread(() => CheckForUpdates(false));
up.Start(); //up.Start();
CheckForUpdates(false);
} }
MenuIcons(); MenuIcons();
@ -1319,8 +1314,9 @@ private void DocsMainMenu_Click(object sender, EventArgs e)
private void UpdatesMainMenu_Click(object sender, EventArgs e) private void UpdatesMainMenu_Click(object sender, EventArgs e)
{ {
Thread up = new Thread(() => CheckForUpdates(true)); //Thread up = new Thread(() => CheckForUpdates(true));
up.Start(); //up.Start();
CheckForUpdates(true);
} }
private void AboutMainMenu_Click(object sender, EventArgs e) private void AboutMainMenu_Click(object sender, EventArgs e)