Merge pull request #3172 from jcefoli/jc/FixUpdateCheck

Fix Automatic Update Check Running Every Startup & Ignoring Preferences
This commit is contained in:
Dimitrij
2026-02-25 17:49:38 +00:00
committed by GitHub
2 changed files with 29 additions and 7 deletions

View File

@@ -127,6 +127,10 @@ namespace mRemoteNG.UI.Forms.OptionsPages
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthUser = txtProxyUsername.Text;
LegacyRijndaelCryptographyProvider cryptographyProvider = new();
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthPass = cryptographyProvider.Encrypt(txtProxyPassword.Text, Runtime.EncryptionKey);
// Mark that the user has explicitly configured their update preference so the
// first-run preference prompt does not appear again.
Properties.OptionsUpdatesPage.Default.CheckForUpdatesAsked = true;
}
public override void LoadRegistrySettings()

View File

@@ -416,6 +416,15 @@ namespace mRemoteNG.UI.Forms
if (!CommonRegistrySettings.AllowCheckForUpdatesAutomatical) return;
if (Properties.OptionsUpdatesPage.Default.CheckForUpdatesAsked) return;
// If the user has already explicitly disabled automatic updates via settings, don't ask again
if (!Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup)
{
Properties.OptionsUpdatesPage.Default.CheckForUpdatesAsked = true;
Properties.OptionsUpdatesPage.Default.Save();
return;
}
string[] commandButtons =
[
Language.AskUpdatesCommandRecommended,
@@ -425,16 +434,25 @@ namespace mRemoteNG.UI.Forms
CTaskDialog.ShowTaskDialogBox(this, GeneralAppInfo.ProductName, Language.AskUpdatesMainInstruction, string.Format(Language.AskUpdatesContent, GeneralAppInfo.ProductName), "", "", "", "", string.Join(" | ", commandButtons), ETaskDialogButtons.None, ESysIcons.Question, ESysIcons.Question);
if (CTaskDialog.CommandButtonResult == 0 | CTaskDialog.CommandButtonResult == 1)
if (CTaskDialog.CommandButtonResult == 0)
{
// Use Recommended Settings: enable automatic updates with the default frequency
Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup = true;
if (Properties.OptionsUpdatesPage.Default.CheckForUpdatesFrequencyDays < 1)
Properties.OptionsUpdatesPage.Default.CheckForUpdatesFrequencyDays = 14;
Properties.OptionsUpdatesPage.Default.CheckForUpdatesAsked = true;
Properties.OptionsUpdatesPage.Default.Save();
}
if (CTaskDialog.CommandButtonResult != 1) return;
AppWindows.Show(WindowType.Options);
if (AppWindows.OptionsFormWindow != null)
AppWindows.OptionsFormWindow.SetActivatedPage(Language.Updates);
else if (CTaskDialog.CommandButtonResult == 1)
{
// Customize: let the user configure update settings manually, then open Options
Properties.OptionsUpdatesPage.Default.CheckForUpdatesAsked = true;
Properties.OptionsUpdatesPage.Default.Save();
AppWindows.Show(WindowType.Options);
if (AppWindows.OptionsFormWindow != null)
AppWindows.OptionsFormWindow.SetActivatedPage(Language.Updates);
}
// For "Ask Later" (button 2), CheckForUpdatesAsked remains false so the dialog will show again next startup
}
private async Task CheckForUpdates()