diff --git a/Source/NETworkManager/StatusWindow.xaml.cs b/Source/NETworkManager/StatusWindow.xaml.cs index 2fdd16828a..8da7006ba6 100644 --- a/Source/NETworkManager/StatusWindow.xaml.cs +++ b/Source/NETworkManager/StatusWindow.xaml.cs @@ -151,6 +151,11 @@ public void ShowWindow(bool enableCloseTimer = false) return; } + // Opened by the user, cancel a running close timer (e.g. if the window was opened on a network change) + _dispatcherTimerClose.Stop(); + _stopwatch.Stop(); + ShowTime = false; + // Focus the window Activate(); } diff --git a/Source/NETworkManager/ViewModels/ConnectionsViewModel.cs b/Source/NETworkManager/ViewModels/ConnectionsViewModel.cs index 2f303d7fe1..49bed2e95c 100644 --- a/Source/NETworkManager/ViewModels/ConnectionsViewModel.cs +++ b/Source/NETworkManager/ViewModels/ConnectionsViewModel.cs @@ -94,8 +94,9 @@ private async void AutoRefreshTimer_Tick(object sender, EventArgs e) // Refresh await Refresh(); - // Restart timer... - _autoRefreshTimer.Start(); + // Restart timer, unless auto refresh was disabled or the view was hidden in the meantime + if (AutoRefreshEnabled && _isViewVisible) + _autoRefreshTimer.Start(); } #endregion @@ -113,6 +114,7 @@ private async void AutoRefreshTimer_Tick(object sender, EventArgs e) /// The timer for auto-refresh. /// private readonly DispatcherTimer _autoRefreshTimer = new(); + private bool _isViewVisible = true; /// /// Gets or sets the search text. @@ -417,6 +419,8 @@ private async Task Refresh(bool init = false) /// public void OnViewVisible() { + _isViewVisible = true; + // Restart timer... if (AutoRefreshEnabled) _autoRefreshTimer.Start(); @@ -427,6 +431,8 @@ public void OnViewVisible() /// public void OnViewHide() { + _isViewVisible = false; + // Temporarily stop timer... if (AutoRefreshEnabled) _autoRefreshTimer.Stop(); diff --git a/Source/NETworkManager/ViewModels/ListenersViewModel.cs b/Source/NETworkManager/ViewModels/ListenersViewModel.cs index 5658ee8c52..257f495121 100644 --- a/Source/NETworkManager/ViewModels/ListenersViewModel.cs +++ b/Source/NETworkManager/ViewModels/ListenersViewModel.cs @@ -85,8 +85,9 @@ private async void AutoRefreshTimer_Tick(object sender, EventArgs e) // Refresh await Refresh(); - // Restart timer... - _autoRefreshTimer.Start(); + // Restart timer, unless auto refresh was disabled or the view was hidden in the meantime + if (AutoRefreshEnabled && _isViewVisible) + _autoRefreshTimer.Start(); } #endregion @@ -104,6 +105,7 @@ private async void AutoRefreshTimer_Tick(object sender, EventArgs e) /// The timer for auto-refresh. /// private readonly DispatcherTimer _autoRefreshTimer = new(); + private bool _isViewVisible = true; /// /// Gets or sets the search text. @@ -405,6 +407,8 @@ private async Task Refresh(bool init = false) /// public void OnViewVisible() { + _isViewVisible = true; + // Restart timer... if (AutoRefreshEnabled) _autoRefreshTimer.Start(); @@ -415,6 +419,8 @@ public void OnViewVisible() /// public void OnViewHide() { + _isViewVisible = false; + // Temporarily stop timer... if (AutoRefreshEnabled) _autoRefreshTimer.Stop(); diff --git a/Source/NETworkManager/ViewModels/NeighborTableViewModel.cs b/Source/NETworkManager/ViewModels/NeighborTableViewModel.cs index 905d09ae13..0f30bb1044 100644 --- a/Source/NETworkManager/ViewModels/NeighborTableViewModel.cs +++ b/Source/NETworkManager/ViewModels/NeighborTableViewModel.cs @@ -89,6 +89,7 @@ private static string ResourceTranslate(NeighborState state) private readonly bool _isLoading; private readonly DispatcherTimer _autoRefreshTimer = new(); + private bool _isViewVisible = true; public string Search { @@ -471,12 +472,16 @@ private async Task Refresh(bool init = false) public void OnViewVisible() { + _isViewVisible = true; + if (AutoRefreshEnabled) _autoRefreshTimer.Start(); } public void OnViewHide() { + _isViewVisible = false; + if (AutoRefreshEnabled) _autoRefreshTimer.Stop(); } @@ -494,7 +499,9 @@ private async void AutoRefreshTimer_Tick(object sender, EventArgs e) if (!IsModifying) await Refresh(); - _autoRefreshTimer.Start(); + // Restart timer, unless auto refresh was disabled or the view was hidden in the meantime + if (AutoRefreshEnabled && _isViewVisible) + _autoRefreshTimer.Start(); } #endregion diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 43e2ed1c5b..67f6ff433e 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -41,6 +41,7 @@ public class WiFiViewModel : ViewModelBase private readonly bool _isLoading; private readonly DispatcherTimer _autoRefreshTimer = new(); + private bool _isViewVisible = true; private readonly DispatcherTimer _hideConnectionStatusMessageTimer = new(); public bool SdkContractAvailable @@ -1296,13 +1297,17 @@ await DialogHelper.ShowMessageAsync(Application.Current.MainWindow, Strings.Erro public void OnViewVisible() { - // Temporarily stop timer... + _isViewVisible = true; + + // Restart timer... if (AutoRefreshEnabled) - _autoRefreshTimer.Stop(); + _autoRefreshTimer.Start(); } public void OnViewHide() { + _isViewVisible = false; + // Temporarily stop timer... if (AutoRefreshEnabled) _autoRefreshTimer.Stop(); @@ -1324,8 +1329,9 @@ private async void AutoRefreshTimer_Tick(object sender, EventArgs e) // Scan networks await ScanAsync(SelectedAdapter, true); - // Restart timer... - _autoRefreshTimer.Start(); + // Restart timer, unless auto refresh was disabled or the view was hidden in the meantime + if (AutoRefreshEnabled && _isViewVisible) + _autoRefreshTimer.Start(); } private void HideConnectionStatusMessageTimer_Tick(object sender, EventArgs e) diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 63124816d8..81e2208ddb 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -115,15 +115,30 @@ Release date: **xx.xx.2026** - Fixed errors when changing the network configuration (e.g. missing permissions) not being shown — the change was reported as successful although it failed. The error message of Windows is now shown. [#3606](https://github.com/BornToBeRoot/NETworkManager/issues/3606) +**Connections** + +- Fixed the auto refresh continuing in the background after switching to another tool, or after it was disabled, if this happened while a refresh was running. [#3639](https://github.com/BornToBeRoot/NETworkManager/pull/3639) + +**Listeners** + +- Fixed the auto refresh continuing in the background after switching to another tool, or after it was disabled, if this happened while a refresh was running. [#3639](https://github.com/BornToBeRoot/NETworkManager/pull/3639) + **Neighbor Table** - Fixed adding and deleting entries not working until the application was restarted if loading the PowerShell module `NetTCPIP` failed once. [cc05937](https://github.com/BornToBeRoot/NETworkManager/commit/cc05937a7de2bf1247621845f47077f3796b9bb2) +- Fixed the auto refresh continuing in the background after switching to another tool, or after it was disabled, if this happened while a refresh was running. [#3639](https://github.com/BornToBeRoot/NETworkManager/pull/3639) + +**WiFi** + +- Fixed the auto refresh continuing in the background after switching to another tool, or after it was disabled, if this happened while a refresh was running. [#3639](https://github.com/BornToBeRoot/NETworkManager/pull/3639) +- Fixed the auto refresh not being resumed after switching back from another tool. [#3639](https://github.com/BornToBeRoot/NETworkManager/pull/3639) **Dashboard** - Fixed the **Network Connection** widget running a full connection check on every application startup, even if the Status Window or Dashboard was never opened. It now only checks when actually shown - via the tray icon, on a network change, or when the Dashboard tab is opened. [#3553](https://github.com/BornToBeRoot/NETworkManager/pull/3553) - Fixed the DNS status (Computer/Router/Internet) in the **Network Connection** widget showing as an error when no PTR record exists for the address, which is common and expected for private IP ranges. This is now shown as informational instead of critical. [#3553](https://github.com/BornToBeRoot/NETworkManager/pull/3553) - Fixed a race condition in the **Network Connection** widget where results from a superseded check could overwrite the results of a newer, still-running check after quickly reopening the widget. [#3553](https://github.com/BornToBeRoot/NETworkManager/pull/3553) +- Fixed the Status Window closing by itself after being opened from the tray icon (or with the hotkey), if it was opened automatically on a network change shortly before. [#3639](https://github.com/BornToBeRoot/NETworkManager/pull/3639) **DNS Lookup**