Skip to content

Commit 79f5305

Browse files
committed
fixup! add autoUpdate (enabled by default)
1 parent 991b535 commit 79f5305

2 files changed

Lines changed: 2 additions & 25 deletions

File tree

OpenHardwareMonitor/UI/MainForm.Designer.cs

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenHardwareMonitor/UI/MainForm.cs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public sealed partial class MainForm : Form
4646
private readonly UnitManager _unitManager;
4747
private readonly UpdateVisitor _updateVisitor = new();
4848
private readonly WmiProvider _wmiProvider;
49-
private readonly Timer _checkUpdatesTimer;
5049

5150
private int _delayCount;
5251
private bool _selectionDragging;
@@ -66,12 +65,6 @@ public MainForm()
6665
this.MinimumSize = new Size(400, 200);
6766
Text = $"Open Hardware Monitor {(Environment.Is64BitProcess ? "x64" : "x32")} - {Updater.CurrentVersion}";
6867
Icon = Icon.ExtractAssociatedIcon(Updater.CurrentFileLocation);
69-
//start check updates timer (silent for errors)
70-
var autoUpdate = _settings.GetValue("autoUpdate", true);
71-
_checkUpdatesTimer = new Timer { Interval = 60 * 60 * 1000 };
72-
_checkUpdatesTimer.Tick += (_, _) => Updater.CheckForUpdates(true);
73-
_checkUpdatesTimer.Enabled = autoUpdate;
74-
menuItemAutoUpdates.Checked = autoUpdate;
7568
portableModeMenuItem.Checked = _settings.IsPortable;
7669

7770
_unitManager = new UnitManager(_settings);
@@ -665,6 +658,8 @@ private void MainForm_Load(object sender, EventArgs e)
665658
RestoreCollapsedNodeState(treeView);
666659
treeView.Width += 1; //just to apply column auto-resize
667660

661+
Updater.CheckForUpdates(true); //will display prompt only if update available & when main form displayed
662+
668663
FormClosed += MainForm_FormClosed;
669664
}
670665

@@ -710,14 +705,6 @@ private void menuItemCheckUpdates_Click(object sender, EventArgs e)
710705
Updater.CheckForUpdates(false);
711706
}
712707

713-
private void menuItemAutoUpdate_Click(object sender, EventArgs e)
714-
{
715-
var autoUpdate = !menuItemAutoUpdates.Checked;
716-
this.menuItemAutoUpdates.Checked = autoUpdate;
717-
_checkUpdatesTimer.Enabled = autoUpdate;
718-
_settings.SetValue("autoUpdate", autoUpdate);
719-
}
720-
721708
private void AboutMenuItem_Click(object sender, EventArgs e)
722709
{
723710
_ = new AboutBox().ShowDialog();

0 commit comments

Comments
 (0)