From a180f3a2fed20fa080261278a08b70e80a5207b2 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:50:51 +0100 Subject: [PATCH 01/66] Fix: WiFi: Crash when switching the tool without access to the WiFi adapter (B1) The auto refresh timer is only created if the WiFi API is available and the access is allowed. OnViewHide / OnViewVisible called it anyway, so switching from WiFi to another tool threw a NullReferenceException when the location access was denied. Regression of #3685 (not released). Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index fd90245358..47db72939f 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -1323,12 +1323,13 @@ await DialogHelper.ShowMessageAsync(Application.Current.MainWindow, Strings.Erro public void OnViewVisible() { - _autoRefreshTimer.Resume(); + // Not created if the WiFi API is not available or the access is denied (see constructor) + _autoRefreshTimer?.Resume(); } public void OnViewHide() { - _autoRefreshTimer.Pause(); + _autoRefreshTimer?.Pause(); } #endregion From e963f7c250227325be2a52ec84772c1bb776fb73 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:51:14 +0100 Subject: [PATCH 02/66] Fix: WiFi: Crash of the auto refresh without a WiFi adapter (B2) The auto refresh and F5 scanned the selected adapter also if no adapter was found: ScanAsync(null) threw a NullReferenceException, which ended the application when it came from the auto refresh timer (async void). Both require a selected adapter now. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 7 ++++--- Website/docs/changelog/next-release.md | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 47db72939f..209a91118f 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -562,9 +562,10 @@ public WiFiViewModel() _ = LoadAdaptersAsync(SettingsManager.Current.WiFi_InterfaceId); // Auto refresh - // Not while networks are loading or a connection is made (tried again after the interval) + // Not without an adapter, or while networks are loading or a connection is made (tried again after the + // interval) _autoRefreshTimer = new AutoRefreshTimer(() => ScanAsync(SelectedAdapter, true), - () => !IsNetworksLoading && !IsBackgroundSearchRunning && !IsConnecting); + () => SelectedAdapter != null && !IsNetworksLoading && !IsBackgroundSearchRunning && !IsConnecting); AutoRefreshTimes = CollectionViewSource.GetDefaultView(AutoRefreshTime.GetDefaults); SelectedAutoRefreshTime = AutoRefreshTimes.Cast().FirstOrDefault(x => @@ -610,7 +611,7 @@ private void ReloadAdapterAction() private bool ScanNetworks_CanExecute(object obj) { - return !IsAdaptersLoading && !IsNetworksLoading && !IsBackgroundSearchRunning && !AutoRefreshEnabled && !IsConnecting; + return SelectedAdapter != null && !IsAdaptersLoading && !IsNetworksLoading && !IsBackgroundSearchRunning && !AutoRefreshEnabled && !IsConnecting; } private async Task ScanNetworksAction() diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 51b3142570..269230ae81 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -285,6 +285,7 @@ Release date: **xx.xx.2026** - Fixed **Automatically update every** `1` / `5` minutes refreshing only every hour / every 5 hours. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) - Fixed the auto refresh not being resumed after switching back from another tool. [#3639](https://github.com/BornToBeRoot/NETworkManager/pull/3639) - Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) +- Fixed the application crashing when **Automatically update every** was enabled and no WiFi adapter was found (e.g. disabled or unplugged). `F5` no longer tries to scan without an adapter. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 6ba410ab8b670ed646e17266772f2d7cd0b6e9ce Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:51:21 +0100 Subject: [PATCH 03/66] Fix: WiFi: Adapters could not be reloaded with auto refresh enabled (B3) ReloadAdapter_CanExecute was false while the auto refresh was enabled. Without an adapter the auto refresh toggle is hidden, so the Refresh button below "No WiFi adapters found" stayed disabled. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 3 ++- Website/docs/changelog/next-release.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 209a91118f..04ab4c9863 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -598,7 +598,8 @@ private void LoadSettings() private bool ReloadAdapter_CanExecute(object obj) { - return !IsAdaptersLoading && !IsNetworksLoading && !IsBackgroundSearchRunning && !AutoRefreshEnabled && !IsConnecting; + // Not blocked by the auto refresh (it only scans the networks): without an adapter its toggle is hidden + return !IsAdaptersLoading && !IsNetworksLoading && !IsBackgroundSearchRunning && !IsConnecting; } private void ReloadAdapterAction() diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 269230ae81..7260fdc699 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -286,6 +286,7 @@ Release date: **xx.xx.2026** - Fixed the auto refresh not being resumed after switching back from another tool. [#3639](https://github.com/BornToBeRoot/NETworkManager/pull/3639) - Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) - Fixed the application crashing when **Automatically update every** was enabled and no WiFi adapter was found (e.g. disabled or unplugged). `F5` no longer tries to scan without an adapter. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the **Refresh** button below "No WiFi adapters found" being disabled while **Automatically update every** was enabled. The adapters could only be loaded again after a restart. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 4b51aaebf38716f0ccddda5cfd364a4ff61b6bc9 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:52:18 +0100 Subject: [PATCH 04/66] Refactor: WiFi: One connect method for PSK / EAP and WPS (R1) The connect callbacks of the dialog repeated the status message, the result message, the hide timer and the rescan. Both use ConnectAsync with the actual connect call as delegate now. No behavior change. Co-Authored-By: Claude Opus 5.5 --- .../ViewModels/WiFiViewModel.cs | 145 ++++++++---------- 1 file changed, 66 insertions(+), 79 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 04ab4c9863..aaadb67cf5 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -1144,59 +1144,32 @@ private void Connect() var ssid = selectedNetwork.IsHidden ? instance.Ssid : selectedNetwork.AvailableNetwork.Ssid; - // Show status message (not hidden by the timer of a previous message) - _hideConnectionStatusMessageTimer.Stop(); - IsConnecting = true; - ConnectionStatusMessage = string.Format(Strings.ConnectingToXXX, ssid); - IsConnectionStatusMessageDisplayed = true; - - // Connect to the network - var reconnectionKind = instance.ConnectAutomatically - ? WiFiReconnectionKind.Automatic - : WiFiReconnectionKind.Manual; - - PasswordCredential credential = new(); - - switch (instance.ConnectMode) + await ConnectAsync(ssid, () => { - case WiFiConnectMode.Psk: - credential.Password = SecureStringHelper.ConvertToString(instance.PreSharedKey); - break; - case WiFiConnectMode.Eap: - credential.UserName = instance.Username; - - if (!string.IsNullOrEmpty(instance.Domain)) - credential.Resource = instance.Domain; + PasswordCredential credential = new(); - credential.Password = SecureStringHelper.ConvertToString(instance.Password); - break; - } - - WiFiConnectionStatus connectionResult; - - if (selectedNetwork.IsHidden) - connectionResult = await WiFi.ConnectAsync(instance.Options.AdapterInfo.WiFiAdapter, - instance.Options.NetworkInfo.AvailableNetwork, reconnectionKind, credential, instance.Ssid); - else - connectionResult = await WiFi.ConnectAsync(instance.Options.AdapterInfo.WiFiAdapter, - instance.Options.NetworkInfo.AvailableNetwork, reconnectionKind, credential); - - // Done connecting - IsConnecting = false; + switch (instance.ConnectMode) + { + case WiFiConnectMode.Psk: + credential.Password = SecureStringHelper.ConvertToString(instance.PreSharedKey); + break; + case WiFiConnectMode.Eap: + credential.UserName = instance.Username; - // Get result - ConnectionStatusMessage = connectionResult == WiFiConnectionStatus.Success - ? string.Format(Strings.SuccessfullyConnectedToXXX, ssid) - : string.Format(Strings.CouldNotConnectToXXXReasonXXX, ssid, - ResourceTranslator.Translate(ResourceIdentifier.WiFiConnectionStatus, connectionResult)); + if (!string.IsNullOrEmpty(instance.Domain)) + credential.Resource = instance.Domain; - // Hide message automatically - _hideConnectionStatusMessageTimer.Stop(); - _hideConnectionStatusMessageTimer.Start(); + credential.Password = SecureStringHelper.ConvertToString(instance.Password); + break; + } - // Update the Wi-Fi networks. - // Wait because an error may occur if a refresh is done directly after connecting. - await ScanAsync(SelectedAdapter, true, 5000); + return selectedNetwork.IsHidden + ? WiFi.ConnectAsync(instance.Options.AdapterInfo.WiFiAdapter, + instance.Options.NetworkInfo.AvailableNetwork, GetReconnectionKind(instance), credential, + instance.Ssid) + : WiFi.ConnectAsync(instance.Options.AdapterInfo.WiFiAdapter, + instance.Options.NetworkInfo.AvailableNetwork, GetReconnectionKind(instance), credential); + }); }, async instance => { // Connect WPS @@ -1205,37 +1178,8 @@ private void Connect() var ssid = selectedNetwork.IsHidden ? instance.Ssid : selectedNetwork.AvailableNetwork.Ssid; - // Show status message (not hidden by the timer of a previous message) - _hideConnectionStatusMessageTimer.Stop(); - IsConnecting = true; - ConnectionStatusMessage = string.Format(Strings.ConnectingToXXX, ssid); - IsConnectionStatusMessageDisplayed = true; - - // Connect to the network - var reconnectionKind = instance.ConnectAutomatically - ? WiFiReconnectionKind.Automatic - : WiFiReconnectionKind.Manual; - - var connectionResult = await WiFi.ConnectWpsAsync( - instance.Options.AdapterInfo.WiFiAdapter, instance.Options.NetworkInfo.AvailableNetwork, - reconnectionKind); - - // Done connecting - IsConnecting = false; - - // Get result - ConnectionStatusMessage = connectionResult == WiFiConnectionStatus.Success - ? string.Format(Strings.SuccessfullyConnectedToXXX, ssid) - : string.Format(Strings.CouldNotConnectToXXXReasonXXX, ssid, - ResourceTranslator.Translate(ResourceIdentifier.WiFiConnectionStatus, connectionResult)); - - // Hide message automatically - _hideConnectionStatusMessageTimer.Stop(); - _hideConnectionStatusMessageTimer.Start(); - - // Update the Wi-Fi networks. - // Wait because an error may occur if a refresh is done directly after connecting. - await ScanAsync(SelectedAdapter, true, 5000); + await ConnectAsync(ssid, () => WiFi.ConnectWpsAsync(instance.Options.AdapterInfo.WiFiAdapter, + instance.Options.NetworkInfo.AvailableNetwork, GetReconnectionKind(instance))); }, _ => { @@ -1256,6 +1200,49 @@ private void Connect() _ = Application.Current.MainWindow.ShowChildWindowAsync(childWindow); } + /// + /// Gets the reconnection kind of the connect dialog ("Connect automatically"). + /// + private static WiFiReconnectionKind GetReconnectionKind(WiFiConnectViewModel instance) + { + return instance.ConnectAutomatically ? WiFiReconnectionKind.Automatic : WiFiReconnectionKind.Manual; + } + + /// + /// Connects to a network and shows the status (connecting, result) below the networks. The networks are + /// scanned again afterwards. + /// + /// SSID of the network, shown in the status message. + /// Connects to the network (Open / PSK / EAP or WPS) and returns the result. + private async Task ConnectAsync(string ssid, Func> connect) + { + // Show status message (not hidden by the timer of a previous message) + _hideConnectionStatusMessageTimer.Stop(); + IsConnecting = true; + ConnectionStatusMessage = string.Format(Strings.ConnectingToXXX, ssid); + IsConnectionStatusMessageDisplayed = true; + + // Connect to the network + var connectionResult = await connect(); + + // Done connecting + IsConnecting = false; + + // Get result + ConnectionStatusMessage = connectionResult == WiFiConnectionStatus.Success + ? string.Format(Strings.SuccessfullyConnectedToXXX, ssid) + : string.Format(Strings.CouldNotConnectToXXXReasonXXX, ssid, + ResourceTranslator.Translate(ResourceIdentifier.WiFiConnectionStatus, connectionResult)); + + // Hide message automatically + _hideConnectionStatusMessageTimer.Stop(); + _hideConnectionStatusMessageTimer.Start(); + + // Update the Wi-Fi networks. + // Wait because an error may occur if a refresh is done directly after connecting. + await ScanAsync(SelectedAdapter, true, 5000); + } + private async void Disconnect() { var connectedNetwork = Networks.FirstOrDefault(x => x.IsConnected); From f3d5833beb0583acd6a69b9becb13ff9f06f51e1 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:53:12 +0100 Subject: [PATCH 05/66] Fix: WiFi: Crash and blocked scan if connecting fails with an error (B4) The connect callbacks run as async void: an exception of WiFiAdapter.ConnectAsync ended the application and IsConnecting stayed set, which blocked the refresh and the auto refresh. ConnectAsync catches the error now, shows it in the connection status and resets IsConnecting in finally. Disconnect (async void) catches its error the same way. Co-Authored-By: Claude Opus 5.5 --- .../Resources/Strings.Designer.cs | 9 +++ .../Resources/Strings.resx | 3 + .../ViewModels/WiFiViewModel.cs | 63 +++++++++++++------ Website/docs/changelog/next-release.md | 1 + 4 files changed, 56 insertions(+), 20 deletions(-) diff --git a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs index b9b02ec7bc..da57838ebf 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs +++ b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs @@ -2606,6 +2606,15 @@ public static string CouldNotDetectSubnetmask { } } + /// + /// Looks up a localized string similar to Could not disconnect from {0} ({1})!. + /// + public static string CouldNotDisconnectFromXXXReasonXXX { + get { + return ResourceManager.GetString("CouldNotDisconnectFromXXXReasonXXX", resourceCulture); + } + } + /// /// Looks up a localized string similar to Could not find the application "{0}". Maybe the application was hidden in the settings?. /// diff --git a/Source/NETworkManager.Localization/Resources/Strings.resx b/Source/NETworkManager.Localization/Resources/Strings.resx index 7debb8294a..18b640437b 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.resx +++ b/Source/NETworkManager.Localization/Resources/Strings.resx @@ -5450,4 +5450,7 @@ Do you want to start the scan? Beta: this feature is tested publicly and may change. Please report problems on GitHub. + + Could not disconnect from {0} ({1})! + \ No newline at end of file diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index aaadb67cf5..831e6af6de 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -631,7 +631,7 @@ private void ConnectAction() private void DisconnectAction() { - Disconnect(); + _ = DisconnectAsync(); } public ICommand ExportCommand => new RelayCommand(_ => ExportAction()); @@ -1222,17 +1222,29 @@ private async Task ConnectAsync(string ssid, Func> co ConnectionStatusMessage = string.Format(Strings.ConnectingToXXX, ssid); IsConnectionStatusMessageDisplayed = true; - // Connect to the network - var connectionResult = await connect(); - - // Done connecting - IsConnecting = false; + try + { + // Connect to the network + var connectionResult = await connect(); + + // Get result + ConnectionStatusMessage = connectionResult == WiFiConnectionStatus.Success + ? string.Format(Strings.SuccessfullyConnectedToXXX, ssid) + : string.Format(Strings.CouldNotConnectToXXXReasonXXX, ssid, + ResourceTranslator.Translate(ResourceIdentifier.WiFiConnectionStatus, connectionResult)); + } + catch (Exception ex) + { + // E.g. the adapter was disabled while connecting + Log.Error($"Error while connecting to the WiFi network \"{ssid}\".", ex); - // Get result - ConnectionStatusMessage = connectionResult == WiFiConnectionStatus.Success - ? string.Format(Strings.SuccessfullyConnectedToXXX, ssid) - : string.Format(Strings.CouldNotConnectToXXXReasonXXX, ssid, - ResourceTranslator.Translate(ResourceIdentifier.WiFiConnectionStatus, connectionResult)); + ConnectionStatusMessage = string.Format(Strings.CouldNotConnectToXXXReasonXXX, ssid, ex.Message); + } + finally + { + // Done connecting + IsConnecting = false; + } // Hide message automatically _hideConnectionStatusMessageTimer.Stop(); @@ -1243,23 +1255,34 @@ private async Task ConnectAsync(string ssid, Func> co await ScanAsync(SelectedAdapter, true, 5000); } - private async void Disconnect() + private async Task DisconnectAsync() { var connectedNetwork = Networks.FirstOrDefault(x => x.IsConnected); - WiFi.Disconnect(SelectedAdapter.WiFiAdapter); + try + { + WiFi.Disconnect(SelectedAdapter.WiFiAdapter); - if (connectedNetwork != null) + if (connectedNetwork != null) + { + ConnectionStatusMessage = string.Format(Strings.XXXDisconnected, + connectedNetwork.AvailableNetwork.Ssid); + IsConnectionStatusMessageDisplayed = true; + } + } + catch (Exception ex) { - ConnectionStatusMessage = string.Format(Strings.XXXDisconnected, - connectedNetwork.AvailableNetwork.Ssid); - IsConnectionStatusMessageDisplayed = true; + Log.Error("Error while disconnecting the WiFi adapter.", ex); - // Hide message automatically - _hideConnectionStatusMessageTimer.Stop(); - _hideConnectionStatusMessageTimer.Start(); + ConnectionStatusMessage = string.Format(Strings.CouldNotDisconnectFromXXXReasonXXX, + connectedNetwork?.AvailableNetwork.Ssid, ex.Message); + IsConnectionStatusMessageDisplayed = true; } + // Hide message automatically + _hideConnectionStatusMessageTimer.Stop(); + _hideConnectionStatusMessageTimer.Start(); + // Refresh await ScanAsync(SelectedAdapter, true, GlobalStaticConfiguration.ApplicationUIRefreshInterval); } diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 7260fdc699..cb04526732 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -287,6 +287,7 @@ Release date: **xx.xx.2026** - Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) - Fixed the application crashing when **Automatically update every** was enabled and no WiFi adapter was found (e.g. disabled or unplugged). `F5` no longer tries to scan without an adapter. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the **Refresh** button below "No WiFi adapters found" being disabled while **Automatically update every** was enabled. The adapters could only be loaded again after a restart. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the application crashing if connecting to or disconnecting from a network failed with an error (e.g. the adapter was disabled meanwhile). The error is shown in the status below the networks, and scanning is no longer blocked afterwards. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From da0e1ab22b591630ead62ff43e37a7f8289a6a85 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:53:20 +0100 Subject: [PATCH 06/66] Fix: WiFi: Connect / Disconnect available while connecting or without a network (B11) Both commands had no CanExecute: a second connection could be started while one was made, and Connect read SelectedNetwork without a check (null after the networks were scanned again while the menu was open). Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 13 +++++++++++-- Website/docs/changelog/next-release.md | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 831e6af6de..05fb042e2a 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -620,14 +620,23 @@ private async Task ScanNetworksAction() await ScanAsync(SelectedAdapter, true); } - public ICommand ConnectCommand => new RelayCommand(_ => ConnectAction()); + public ICommand ConnectCommand => new RelayCommand(_ => ConnectAction(), ConnectDisconnect_CanExecute); + + /// + /// A network is selected (the selection is cleared when the networks are scanned again) and no connection is + /// made at the moment. + /// + private bool ConnectDisconnect_CanExecute(object obj) + { + return SelectedNetwork != null && !IsConnecting; + } private void ConnectAction() { Connect(); } - public ICommand DisconnectCommand => new RelayCommand(_ => DisconnectAction()); + public ICommand DisconnectCommand => new RelayCommand(_ => DisconnectAction(), ConnectDisconnect_CanExecute); private void DisconnectAction() { diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index cb04526732..bb336c0bf1 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -288,6 +288,7 @@ Release date: **xx.xx.2026** - Fixed the application crashing when **Automatically update every** was enabled and no WiFi adapter was found (e.g. disabled or unplugged). `F5` no longer tries to scan without an adapter. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the **Refresh** button below "No WiFi adapters found" being disabled while **Automatically update every** was enabled. The adapters could only be loaded again after a restart. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the application crashing if connecting to or disconnecting from a network failed with an error (e.g. the adapter was disabled meanwhile). The error is shown in the status below the networks, and scanning is no longer blocked afterwards. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed **Connect...** and **Disconnect** being available while a connection is made, and **Connect...** failing if the networks were scanned again while the context menu was open. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 7075cabe9d14f073960bafd0c27ed36199e9855e Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:53:33 +0100 Subject: [PATCH 07/66] Fix: WiFi: Use credentials ignored when connecting with EAP (B5) UseCredentials of the connect dialog was never read: the (empty) username and password were always sent. They are only set if Use credentials is enabled now; otherwise an empty credential is passed like for open networks. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 4 +++- Website/docs/changelog/next-release.md | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 05fb042e2a..191b215d1a 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -1162,7 +1162,9 @@ await ConnectAsync(ssid, () => case WiFiConnectMode.Psk: credential.Password = SecureStringHelper.ConvertToString(instance.PreSharedKey); break; - case WiFiConnectMode.Eap: + // Without credentials, Windows uses the logged-on user or a certificate (like an open network, + // an empty credential is passed) + case WiFiConnectMode.Eap when instance.UseCredentials: credential.UserName = instance.Username; if (!string.IsNullOrEmpty(instance.Domain)) diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index bb336c0bf1..6f875bef09 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -289,6 +289,7 @@ Release date: **xx.xx.2026** - Fixed the **Refresh** button below "No WiFi adapters found" being disabled while **Automatically update every** was enabled. The adapters could only be loaded again after a restart. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the application crashing if connecting to or disconnecting from a network failed with an error (e.g. the adapter was disabled meanwhile). The error is shown in the status below the networks, and scanning is no longer blocked afterwards. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed **Connect...** and **Disconnect** being available while a connection is made, and **Connect...** failing if the networks were scanned again while the context menu was open. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed **Use credentials** being ignored when connecting to a WPA / WPA2 / WPA3 Enterprise network (EAP). If it is disabled, no username and password are sent and Windows uses the logged-on user or a certificate. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 259fd470764ec75b22f8b587d907f5684ff8eac7 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:53:55 +0100 Subject: [PATCH 08/66] Fix: WiFi: WPS button of the connect dialog never shown (B6) CheckWpsAsync lost its caller when the dialog was migrated to a child window (#3271), so IsWpsAvailable stayed false. It is called when the dialog is loaded again. An error of the check is logged and leaves WPS unavailable instead of keeping "Checking WPS..." visible. Co-Authored-By: Claude Opus 5.5 --- .../ViewModels/WiFiConnectViewModel.cs | 31 ++++++++++++++----- .../Views/WiFiConnectChildWindow.xaml.cs | 5 +++ Website/docs/changelog/next-release.md | 1 + 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiConnectViewModel.cs b/Source/NETworkManager/ViewModels/WiFiConnectViewModel.cs index 7c706f9ca7..2b459473b3 100644 --- a/Source/NETworkManager/ViewModels/WiFiConnectViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiConnectViewModel.cs @@ -1,3 +1,4 @@ +using log4net; using NETworkManager.Models.Network; using NETworkManager.Utilities; using NETworkManager.Settings; @@ -10,6 +11,8 @@ namespace NETworkManager.ViewModels; public class WiFiConnectViewModel : ViewModelBase { + private static readonly ILog Log = LogManager.GetLogger(typeof(WiFiConnectViewModel)); + /// /// Current WiFi adapter info and network info. /// @@ -273,6 +276,10 @@ public bool IsWpsAvailable } } + /// + /// Checks if WPS (push button) is available for the network (shows the WPS button). Called when the dialog is + /// loaded. + /// public async Task CheckWpsAsync() { // Only check if WPS is available for networks secured by Pre-shared key who are not hidden @@ -280,15 +287,25 @@ public async Task CheckWpsAsync() return; IsWpsChecking = true; - // Make the user happy, let him see a reload animation (and he cannot spam the reload command) - await Task.Delay(GlobalStaticConfiguration.ApplicationUIRefreshInterval / 2); - IsWpsAvailable = - await WiFi.IsWpsAvailable(Options.AdapterInfo.WiFiAdapter, Options.NetworkInfo.AvailableNetwork); + try + { + // Takes at least the refresh interval, so the animation is visible - the check runs at the same time + IsWpsAvailable = await TaskHelper.WithMinimumDurationAsync( + () => WiFi.IsWpsAvailable(Options.AdapterInfo.WiFiAdapter, Options.NetworkInfo.AvailableNetwork), + GlobalStaticConfiguration.ApplicationUIRefreshInterval); + } + catch (Exception ex) + { + // Optional: the network can still be connected with the pre-shared key + Log.Error("Error while checking if WPS is available.", ex); - // Make the user happy, let him see a reload animation (and he cannot spam the reload command) - await Task.Delay(GlobalStaticConfiguration.ApplicationUIRefreshInterval / 2); - IsWpsChecking = false; + IsWpsAvailable = false; + } + finally + { + IsWpsChecking = false; + } } /// diff --git a/Source/NETworkManager/Views/WiFiConnectChildWindow.xaml.cs b/Source/NETworkManager/Views/WiFiConnectChildWindow.xaml.cs index b8dda18fb2..c01ce51516 100644 --- a/Source/NETworkManager/Views/WiFiConnectChildWindow.xaml.cs +++ b/Source/NETworkManager/Views/WiFiConnectChildWindow.xaml.cs @@ -1,6 +1,7 @@ using System; using System.Windows; using System.Windows.Threading; +using NETworkManager.ViewModels; namespace NETworkManager.Views; @@ -20,5 +21,9 @@ private void ChildWindow_OnLoaded(object sender, RoutedEventArgs e) else PasswordBoxPreSharedKey.Focus(); })); + + // Shows the WPS button if WPS is available for the network + if (DataContext is WiFiConnectViewModel viewModel) + _ = viewModel.CheckWpsAsync(); } } \ No newline at end of file diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 6f875bef09..c93eba6dba 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -290,6 +290,7 @@ Release date: **xx.xx.2026** - Fixed the application crashing if connecting to or disconnecting from a network failed with an error (e.g. the adapter was disabled meanwhile). The error is shown in the status below the networks, and scanning is no longer blocked afterwards. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed **Connect...** and **Disconnect** being available while a connection is made, and **Connect...** failing if the networks were scanned again while the context menu was open. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed **Use credentials** being ignored when connecting to a WPA / WPA2 / WPA3 Enterprise network (EAP). If it is disabled, no username and password are sent and Windows uses the logged-on user or a certificate. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the **WPS** button of the connect dialog never being shown. Whether a network supports WPS (push button) is checked again when the dialog is opened. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From df0c0b6d708f42132563ae2140e1fffdb55ebd97 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:54:06 +0100 Subject: [PATCH 09/66] Fix: WiFi: Focus of the connect dialog (B7) Both branches focused the pre-shared key box (lost in the migration to a child window, #3271), which is hidden for a hidden network (SSID) and for EAP (username). The first visible input is focused again. Co-Authored-By: Claude Opus 5.5 --- .../Views/WiFiConnectChildWindow.xaml.cs | 16 +++++++++++----- Website/docs/changelog/next-release.md | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/NETworkManager/Views/WiFiConnectChildWindow.xaml.cs b/Source/NETworkManager/Views/WiFiConnectChildWindow.xaml.cs index c01ce51516..05b318e71a 100644 --- a/Source/NETworkManager/Views/WiFiConnectChildWindow.xaml.cs +++ b/Source/NETworkManager/Views/WiFiConnectChildWindow.xaml.cs @@ -1,6 +1,7 @@ using System; using System.Windows; using System.Windows.Threading; +using NETworkManager.Models.Network; using NETworkManager.ViewModels; namespace NETworkManager.Views; @@ -14,16 +15,21 @@ public WiFiConnectChildWindow() private void ChildWindow_OnLoaded(object sender, RoutedEventArgs e) { + if (DataContext is not WiFiConnectViewModel viewModel) + return; + + // Focus the first input: SSID of a hidden network, otherwise the pre-shared key or the username (EAP) Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, new Action(delegate { - if (PasswordBoxPreSharedKey.Visibility == Visibility.Visible) - PasswordBoxPreSharedKey.Focus(); - else + if (viewModel.IsSsidRequired) + TextBoxSsid.Focus(); + else if (viewModel.ConnectMode == WiFiConnectMode.Psk) PasswordBoxPreSharedKey.Focus(); + else if (viewModel.ConnectMode == WiFiConnectMode.Eap) + TextBoxUsername.Focus(); })); // Shows the WPS button if WPS is available for the network - if (DataContext is WiFiConnectViewModel viewModel) - _ = viewModel.CheckWpsAsync(); + _ = viewModel.CheckWpsAsync(); } } \ No newline at end of file diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index c93eba6dba..f30649410a 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -291,6 +291,7 @@ Release date: **xx.xx.2026** - Fixed **Connect...** and **Disconnect** being available while a connection is made, and **Connect...** failing if the networks were scanned again while the context menu was open. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed **Use credentials** being ignored when connecting to a WPA / WPA2 / WPA3 Enterprise network (EAP). If it is disabled, no username and password are sent and Windows uses the logged-on user or a certificate. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the **WPS** button of the connect dialog never being shown. Whether a network supports WPS (push button) is checked again when the dialog is opened. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the connect dialog not focusing the first input: the SSID of a hidden network or the username (EAP) was not focused. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 42840fa122abaf665e793195dc02b8c0edddb08d Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:54:52 +0100 Subject: [PATCH 10/66] Fix: WiFi: Connect mode of WPA3 Enterprise and OWE networks (B8) GetConnectMode only knew WPA / WPA2 Enterprise: WPA3 Enterprise (also 192-bit) got the pre-shared key dialog, and OWE (Enhanced Open, encrypted without a password) too, with Connect disabled until a key was typed. GetConnectMode has an overload for the authentication / encryption type now, with unit tests. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager.Models/Network/WiFi.cs | 26 ++++++++++++++----- .../Network/WiFiConnectModeTests.cs | 26 +++++++++++++++++++ Website/docs/changelog/next-release.md | 1 + 3 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 Source/NETworkManager.Tests/Network/WiFiConnectModeTests.cs diff --git a/Source/NETworkManager.Models/Network/WiFi.cs b/Source/NETworkManager.Models/Network/WiFi.cs index d9475faca6..ba4d325fa3 100644 --- a/Source/NETworkManager.Models/Network/WiFi.cs +++ b/Source/NETworkManager.Models/Network/WiFi.cs @@ -235,16 +235,30 @@ public static void Disconnect(WiFiAdapter adapter) /// Connect mode as . public static WiFiConnectMode GetConnectMode(WiFiAvailableNetwork network) { - // Enterprise - if (network.SecuritySettings.NetworkAuthenticationType is NetworkAuthenticationType.Rsna or NetworkAuthenticationType.Wpa) + return GetConnectMode(network.SecuritySettings.NetworkAuthenticationType, + network.SecuritySettings.NetworkEncryptionType); + } + + /// + /// Get the connect mode from the authentication and encryption type of a Wi-Fi network. + /// + /// Authentication type of the network. + /// Encryption type of the network. + /// Connect mode as . + public static WiFiConnectMode GetConnectMode(NetworkAuthenticationType authenticationType, + NetworkEncryptionType encryptionType) + { + // Enterprise (WPA, WPA2, WPA3) + if (authenticationType is NetworkAuthenticationType.Rsna or NetworkAuthenticationType.Wpa + or NetworkAuthenticationType.Wpa3Enterprise or NetworkAuthenticationType.Wpa3Enterprise192Bits) return WiFiConnectMode.Eap; - // Open - if (network.SecuritySettings.NetworkAuthenticationType == NetworkAuthenticationType.Open80211 || - network.SecuritySettings.NetworkEncryptionType == NetworkEncryptionType.None) + // Open, also OWE (Enhanced Open: encrypted, but without a password) + if (authenticationType is NetworkAuthenticationType.Open80211 or NetworkAuthenticationType.Owe || + encryptionType == NetworkEncryptionType.None) return WiFiConnectMode.Open; - // Pre-Shared-Key + // Pre-Shared-Key (WEP, WPA, WPA2, WPA3 SAE) return WiFiConnectMode.Psk; } diff --git a/Source/NETworkManager.Tests/Network/WiFiConnectModeTests.cs b/Source/NETworkManager.Tests/Network/WiFiConnectModeTests.cs new file mode 100644 index 0000000000..816fcc59ac --- /dev/null +++ b/Source/NETworkManager.Tests/Network/WiFiConnectModeTests.cs @@ -0,0 +1,26 @@ +using NETworkManager.Models.Network; +using Windows.Networking.Connectivity; +using Xunit; + +namespace NETworkManager.Tests.Network; + +public class WiFiConnectModeTests +{ + [Theory] + [InlineData(NetworkAuthenticationType.Open80211, NetworkEncryptionType.None, WiFiConnectMode.Open)] + [InlineData(NetworkAuthenticationType.Owe, NetworkEncryptionType.Ccmp, WiFiConnectMode.Open)] + [InlineData(NetworkAuthenticationType.RsnaPsk, NetworkEncryptionType.None, WiFiConnectMode.Open)] + [InlineData(NetworkAuthenticationType.SharedKey80211, NetworkEncryptionType.Wep, WiFiConnectMode.Psk)] + [InlineData(NetworkAuthenticationType.WpaPsk, NetworkEncryptionType.Tkip, WiFiConnectMode.Psk)] + [InlineData(NetworkAuthenticationType.RsnaPsk, NetworkEncryptionType.Ccmp, WiFiConnectMode.Psk)] + [InlineData(NetworkAuthenticationType.Wpa3Sae, NetworkEncryptionType.Ccmp, WiFiConnectMode.Psk)] + [InlineData(NetworkAuthenticationType.Wpa, NetworkEncryptionType.Tkip, WiFiConnectMode.Eap)] + [InlineData(NetworkAuthenticationType.Rsna, NetworkEncryptionType.Ccmp, WiFiConnectMode.Eap)] + [InlineData(NetworkAuthenticationType.Wpa3Enterprise, NetworkEncryptionType.Ccmp, WiFiConnectMode.Eap)] + [InlineData(NetworkAuthenticationType.Wpa3Enterprise192Bits, NetworkEncryptionType.Ccmp, WiFiConnectMode.Eap)] + public void GetConnectMode_ReturnsTheDialogMode(NetworkAuthenticationType authenticationType, + NetworkEncryptionType encryptionType, WiFiConnectMode expected) + { + Assert.Equal(expected, WiFi.GetConnectMode(authenticationType, encryptionType)); + } +} diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index f30649410a..56458e454f 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -292,6 +292,7 @@ Release date: **xx.xx.2026** - Fixed **Use credentials** being ignored when connecting to a WPA / WPA2 / WPA3 Enterprise network (EAP). If it is disabled, no username and password are sent and Windows uses the logged-on user or a certificate. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the **WPS** button of the connect dialog never being shown. Whether a network supports WPS (push button) is checked again when the dialog is opened. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the connect dialog not focusing the first input: the SSID of a hidden network or the username (EAP) was not focused. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the connect dialog asking for a pre-shared key for WPA3 Enterprise networks (instead of username and password) and for OWE (Enhanced Open) networks, which need no password. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 83defaf3636e7a08dd4a830c63389574effcd737 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:57:37 +0100 Subject: [PATCH 11/66] Fix: WiFi: Wide channels drawn around the primary channel (B19) ChannelCenterFrequencyInKilohertz of WiFiAvailableNetwork is the frequency of the primary 20 MHz channel, where the beacons are sent. The channel chart centered each network on it, so every 40 / 80 / 160 MHz network was drawn shifted (80 MHz on channel 36 over 28 - 44 instead of 36 - 48). WlanApi returns the center of the whole channel with the width now, from the same information elements: HT secondary channel offset, VHT CCFS0 / CCFS1 (new and deprecated 160 MHz encoding), HE 6 GHz Operation CCFS0 / CCFS1. VHT / HE are parsed after the element loop, so the HT fallback no longer depends on the order of the elements. The chart uses the new ChannelBandwidthCenterFrequencyInGigahertz; the Channel / Frequency columns stay the primary channel. Unit tests for the parsing. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager.Models/Network/WiFi.cs | 31 +-- .../Network/WiFiNetworkInfo.cs | 9 +- .../NETworkManager.Models/Network/WlanApi.cs | 188 +++++++++++++----- .../Network/WlanApiTests.cs | 116 +++++++++++ .../ViewModels/WiFiViewModel.cs | 7 +- Website/docs/changelog/next-release.md | 1 + 6 files changed, 281 insertions(+), 71 deletions(-) create mode 100644 Source/NETworkManager.Tests/Network/WlanApiTests.cs diff --git a/Source/NETworkManager.Models/Network/WiFi.cs b/Source/NETworkManager.Models/Network/WiFi.cs index ba4d325fa3..eafb9d7732 100644 --- a/Source/NETworkManager.Models/Network/WiFi.cs +++ b/Source/NETworkManager.Models/Network/WiFi.cs @@ -68,10 +68,10 @@ public static async Task GetNetworksAsync(WiFiAdapter adapt // Try to get the current connected Wi-Fi network of this network adapter var (_, bssid) = TryGetConnectedNetworkFromWiFiAdapter(adapter.NetworkAdapter.NetworkAdapterId.ToString()); - // The WinRT API does not expose the channel bandwidth, so it is read from the native - // BSS list (wlanapi.dll) and matched by BSSID below. Failures yield an empty map and we + // The WinRT API does not expose the channel bandwidth (and its center), so it is read from the + // native BSS list (wlanapi.dll) and matched by BSSID below. Failures yield an empty map and we // fall back to a heuristic per network. - var channelWidths = WlanApi.GetBssChannelWidths(adapter.NetworkAdapter.NetworkAdapterId); + var channels = WlanApi.GetBssChannels(adapter.NetworkAdapter.NetworkAdapterId); var wifiNetworkInfos = new List(); @@ -79,6 +79,8 @@ public static async Task GetNetworksAsync(WiFiAdapter adapt { var channelFrequencyInGigahertz = ConvertChannelFrequencyToGigahertz(availableNetwork.ChannelCenterFrequencyInKilohertz); var radio = GetWiFiRadioFromChannelFrequency(channelFrequencyInGigahertz); + var (channelBandwidth, channelBandwidthCenterFrequencyInGigahertz) = GetChannelBandwidth(channels, + availableNetwork.Bssid, radio, availableNetwork.PhyKind, channelFrequencyInGigahertz); var wifiNetworkInfo = new WiFiNetworkInfo { @@ -86,7 +88,8 @@ public static async Task GetNetworksAsync(WiFiAdapter adapt Radio = radio, ChannelCenterFrequencyInGigahertz = channelFrequencyInGigahertz, Channel = GetChannelFromChannelFrequency(channelFrequencyInGigahertz), - ChannelBandwidth = GetChannelBandwidth(channelWidths, availableNetwork.Bssid, radio, availableNetwork.PhyKind), + ChannelBandwidth = channelBandwidth, + ChannelBandwidthCenterFrequencyInGigahertz = channelBandwidthCenterFrequencyInGigahertz, IsHidden = string.IsNullOrEmpty(availableNetwork.Ssid), IsConnected = availableNetwork.Bssid.Equals(bssid, StringComparison.OrdinalIgnoreCase), NetworkAuthenticationType = GetHumanReadableNetworkAuthenticationType(availableNetwork.SecuritySettings.NetworkAuthenticationType), @@ -330,17 +333,19 @@ private static WiFiRadio GetWiFiRadioFromChannelFrequency(double gigahertz) } /// - /// Determines the channel bandwidth (MHz) for a network. Prefers the value parsed from the - /// native BSS list (); if unavailable, falls back to a heuristic based - /// on the radio band and PHY kind, and finally to 20 MHz. + /// Determines the channel bandwidth (MHz) and its center frequency (GHz) for a network. Prefers + /// the values parsed from the native BSS list (); if unavailable, falls back + /// to a heuristic based on the radio band and PHY kind (centered on the primary channel). /// - private static int GetChannelBandwidth(IReadOnlyDictionary channelWidths, string networkBssid, - WiFiRadio radio, WiFiPhyKind phyKind) + private static (int Bandwidth, double CenterFrequencyInGigahertz) GetChannelBandwidth( + IReadOnlyDictionary channels, string networkBssid, WiFiRadio radio, + WiFiPhyKind phyKind, double primaryFrequencyInGigahertz) { - if (!string.IsNullOrEmpty(networkBssid) && channelWidths.TryGetValue(networkBssid, out var width) && width > 0) - return width; - - return GetHeuristicChannelBandwidth(radio, phyKind); + if (!string.IsNullOrEmpty(networkBssid) && channels.TryGetValue(networkBssid, out var channel) && + channel.BandwidthMHz > 0 && channel.CenterFrequencyMHz > 0) + return (channel.BandwidthMHz, channel.CenterFrequencyMHz / 1000.0); + + return (GetHeuristicChannelBandwidth(radio, phyKind), primaryFrequencyInGigahertz); } /// diff --git a/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs b/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs index 025c839c50..f62f34742a 100644 --- a/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs +++ b/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs @@ -28,7 +28,8 @@ public WiFiNetworkInfo() public WiFiRadio Radio { get; init; } /// - /// The channel center frequency in Gigahertz like 2.4 GHz, 5 GHz, etc. + /// The channel center frequency in Gigahertz like 2.4 GHz, 5 GHz, etc. of the primary 20 MHz channel (where the + /// beacons are sent). /// public double ChannelCenterFrequencyInGigahertz { get; set; } @@ -43,6 +44,12 @@ public WiFiNetworkInfo() /// public int ChannelBandwidth { get; set; } + /// + /// The center frequency in Gigahertz of the whole channel (), e.g. 5.21 for + /// 80 MHz on the channels 36 - 48. The frequency of the primary channel if the bandwidth is estimated. + /// + public double ChannelBandwidthCenterFrequencyInGigahertz { get; set; } + /// /// Indicates if the Wi-Fi network Ssid is hidden. /// diff --git a/Source/NETworkManager.Models/Network/WlanApi.cs b/Source/NETworkManager.Models/Network/WlanApi.cs index 8ac684c0e9..80ad7af977 100644 --- a/Source/NETworkManager.Models/Network/WlanApi.cs +++ b/Source/NETworkManager.Models/Network/WlanApi.cs @@ -7,13 +7,14 @@ namespace NETworkManager.Models.Network; /// /// Native Wi-Fi (wlanapi.dll) interop used to determine the channel bandwidth -/// (20 / 40 / 80 / 160 MHz) of nearby access points. +/// (20 / 40 / 80 / 160 MHz) and its center frequency of nearby access points. /// /// The Windows Runtime Wi-Fi API () does -/// not expose the channel width. The native BSS list (WlanGetNetworkBssList) however -/// returns the raw 802.11 information elements (IEs) of each beacon / probe response. The width -/// is parsed from the HT-Operation (802.11n), VHT-Operation (802.11ac) and HE-Operation -/// (802.11ax / 6 GHz) elements. +/// not expose the channel width, its frequency is the one of the primary 20 MHz channel (where +/// the beacons are sent). The native BSS list (WlanGetNetworkBssList) however returns the +/// raw 802.11 information elements (IEs) of each beacon / probe response. The width and the +/// center of the whole channel are parsed from the HT-Operation (802.11n), VHT-Operation +/// (802.11ac) and HE-Operation (802.11ax / 6 GHz) elements. /// /// All calls are wrapped in try/catch; on any failure an empty result is returned so the caller /// can fall back to a heuristic (see ). @@ -31,6 +32,15 @@ public static class WlanApi private const byte EidExtension = 255; private const byte ExtEidHeOperation = 36; + /// + /// Channel of an access point parsed from its information elements. + /// + /// Channel width in MHz (20, 40, 80, 160), 0 if unknown. + /// + /// Center frequency of the whole channel in MHz (e.g. 5210 for 80 MHz on the channels 36 - 48), 0 if unknown. + /// + public readonly record struct WlanBssChannel(int BandwidthMHz, int CenterFrequencyMHz); + private enum DOT11_BSS_TYPE { // ReSharper disable UnusedMember.Local @@ -124,14 +134,14 @@ private struct WLAN_BSS_ENTRY /// /// Returns a map of BSSID (lowercase, colon-separated, e.g. aa:bb:cc:dd:ee:ff) to the - /// channel bandwidth in MHz for all access points visible to the given Wi-Fi interface. + /// channel (width and center) for all access points visible to the given Wi-Fi interface. /// BSSIDs whose width could not be parsed are omitted from the result. /// /// GUID of the Wi-Fi interface (NetworkAdapter.NetworkAdapterId). - /// A (possibly empty) map of BSSID to channel bandwidth in MHz. - public static Dictionary GetBssChannelWidths(Guid interfaceGuid) + /// A (possibly empty) map of BSSID to its channel. + public static Dictionary GetBssChannels(Guid interfaceGuid) { - var result = new Dictionary(StringComparer.OrdinalIgnoreCase); + var result = new Dictionary(StringComparer.OrdinalIgnoreCase); var clientHandle = IntPtr.Zero; @@ -166,10 +176,11 @@ public static Dictionary GetBssChannelWidths(Guid interfaceGuid) } /// - /// Queries the BSS list for a single WLAN interface and adds the parsed channel widths to + /// Queries the BSS list for a single WLAN interface and adds the parsed channels to /// . Returns if the query succeeded. /// - private static bool TryQueryBssList(IntPtr clientHandle, Guid interfaceGuid, Dictionary result) + private static bool TryQueryBssList(IntPtr clientHandle, Guid interfaceGuid, + Dictionary result) { var bssListPtr = IntPtr.Zero; @@ -213,10 +224,11 @@ private static bool TryQueryBssList(IntPtr clientHandle, Guid interfaceGuid, Dic var ie = new byte[ieSize]; Marshal.Copy(IntPtr.Add(bssListPtr, (int)ieStart), ie, 0, ieSize); - var width = GetBandwidthFromInformationElements(ie); + // Frequency of the primary channel (kHz) + var channel = GetChannelFromInformationElements(ie, (int)(entry.ulChCenterFrequency / 1000)); - if (width > 0) - result[FormatBssid(entry.dot11Bssid)] = width; + if (channel.BandwidthMHz > 0) + result[FormatBssid(entry.dot11Bssid)] = channel; } return true; @@ -267,13 +279,17 @@ private static List EnumerateInterfaces(IntPtr clientHandle) } /// - /// Walks the TLV-encoded 802.11 information elements and returns the widest channel - /// bandwidth (MHz) advertised by the HT-, VHT- or HE-Operation element. Returns 0 if none - /// of these elements are present. + /// Walks the TLV-encoded 802.11 information elements and returns the widest channel advertised + /// by the HT-, VHT- or HE-Operation element, with the center frequency of the whole channel. + /// Returns default (width 0) if none of these elements are present. /// - private static int GetBandwidthFromInformationElements(byte[] ie) + /// Information elements of a beacon / probe response. + /// Frequency of the primary 20 MHz channel in MHz (e.g. 5180). + public static WlanBssChannel GetChannelFromInformationElements(byte[] ie, int primaryFrequencyMHz) { - int htWidth = 0, vhtWidth = 0, heWidth = 0; + WlanBssChannel ht = default; + byte[] vhtOperation = null; + int heOffset = -1, heLength = 0; var pos = 0; @@ -289,50 +305,88 @@ private static int GetBandwidthFromInformationElements(byte[] ie) switch (id) { case EidHtOperation when len >= 2: - { - // HT Operation Information byte 0: bits 0-1 secondary channel offset, - // bit 2 STA channel width (0 = 20 MHz, 1 = any/40 MHz). - var info = ie[data + 1]; - var secondaryChannelOffset = info & 0x03; - var staChannelWidth = (info >> 2) & 0x01; - htWidth = staChannelWidth == 1 && secondaryChannelOffset != 0 ? 40 : 20; + ht = ParseHtChannel(ie[data + 1], primaryFrequencyMHz); break; - } case EidVhtOperation when len >= 3: - vhtWidth = ParseVhtWidth(ie[data], ie[data + 1], ie[data + 2], htWidth); + vhtOperation = [ie[data], ie[data + 1], ie[data + 2]]; break; case EidExtension when len >= 1 && ie[data] == ExtEidHeOperation: - heWidth = ParseHeWidth(ie, data + 1, len - 1, htWidth); + heOffset = data + 1; + heLength = len - 1; break; } pos = data + len; } - return Math.Max(htWidth, Math.Max(vhtWidth, heWidth)); + // VHT and HE defer to HT for 20 / 40 MHz, so they are parsed after the loop (independent of the order) + var vht = vhtOperation == null + ? default + : ParseVhtChannel(vhtOperation[0], vhtOperation[1], vhtOperation[2], ht, primaryFrequencyMHz); + + var he = heOffset < 0 ? default : ParseHeChannel(ie, heOffset, heLength, ht, primaryFrequencyMHz); + + // The widest channel; on a tie the newer element (its center is the more precise one) + return Widest(Widest(ht, vht), he); + } + + /// + /// Returns if it is at least as wide as . + /// + private static WlanBssChannel Widest(WlanBssChannel current, WlanBssChannel candidate) + { + return candidate.BandwidthMHz > 0 && candidate.BandwidthMHz >= current.BandwidthMHz ? candidate : current; + } + + /// + /// Parses the HT Operation Information byte 0: bits 0-1 secondary channel offset (1 = above, + /// 3 = below), bit 2 STA channel width (0 = 20 MHz, 1 = any / 40 MHz). + /// + private static WlanBssChannel ParseHtChannel(byte info, int primaryFrequencyMHz) + { + var secondaryChannelOffset = info & 0x03; + var staChannelWidth = (info >> 2) & 0x01; + + if (staChannelWidth == 1 && secondaryChannelOffset == 1) + return new WlanBssChannel(40, primaryFrequencyMHz + 10); + + if (staChannelWidth == 1 && secondaryChannelOffset == 3) + return new WlanBssChannel(40, primaryFrequencyMHz - 10); + + return new WlanBssChannel(20, primaryFrequencyMHz); } /// - /// Resolves the channel width from a VHT-Operation channel-width field plus its two center - /// frequency segments. Falls back to when the VHT field signals - /// "20/40 MHz". + /// Resolves the channel from a VHT-Operation channel-width field plus its two channel center + /// frequency segments (CCFS, channel numbers). Falls back to when the + /// VHT field signals "20/40 MHz". /// - private static int ParseVhtWidth(int channelWidth, int segment0, int segment1, int htWidth) + private static WlanBssChannel ParseVhtChannel(int channelWidth, int segment0, int segment1, WlanBssChannel ht, + int primaryFrequencyMHz) { switch (channelWidth) { case 0: // 20/40 MHz -> defer to HT - return htWidth > 0 ? htWidth : 20; + return ht.BandwidthMHz > 0 ? ht : new WlanBssChannel(20, primaryFrequencyMHz); case 1: // 80 MHz, unless the segments indicate 160 / 80+80 MHz if (segment1 == 0) - return 80; + return new WlanBssChannel(80, ChannelToFrequency(segment0, primaryFrequencyMHz)); + var diff = Math.Abs(segment0 - segment1); - return diff is 8 or > 16 ? 160 : 80; - case 2: // 160 MHz (deprecated encoding) + + // 160 MHz: segment 1 is the center of the 160 MHz channel + if (diff == 8) + return new WlanBssChannel(160, ChannelToFrequency(segment1, primaryFrequencyMHz)); + + // 80+80 MHz (two separate 80 MHz segments) is shown as 160 MHz around the primary segment + return diff > 16 + ? new WlanBssChannel(160, ChannelToFrequency(segment0, primaryFrequencyMHz)) + : new WlanBssChannel(80, ChannelToFrequency(segment0, primaryFrequencyMHz)); + case 2: // 160 MHz (deprecated encoding): segment 0 is the center of the 160 MHz channel case 3: // 80+80 MHz (deprecated encoding) - treated as 160 MHz for display - return 160; + return new WlanBssChannel(160, ChannelToFrequency(segment0, primaryFrequencyMHz)); default: - return 80; + return new WlanBssChannel(80, ChannelToFrequency(segment0, primaryFrequencyMHz)); } } @@ -340,18 +394,20 @@ private static int ParseVhtWidth(int channelWidth, int segment0, int segment1, i /// Parses the HE-Operation element (802.11ax). Optional sub-fields (VHT Operation /// Information, 6 GHz Operation Information) are only present when the corresponding bit in /// the HE Operation Parameters is set; their offsets therefore depend on the preceding - /// fields. This is a best-effort parse: on any ambiguity 0 is returned so the caller can - /// fall back to a heuristic. + /// fields. This is a best-effort parse: on any ambiguity default (width 0) is returned so + /// the caller can fall back to a heuristic. /// /// The full information element buffer. /// Offset of the HE Operation Parameters (after the extension id byte). /// Remaining length of the HE-Operation element after the extension id. - /// Width parsed from the HT-Operation element (used as VHT fallback). - private static int ParseHeWidth(byte[] ie, int offset, int length, int htWidth) + /// Channel parsed from the HT-Operation element (used as VHT fallback). + /// Frequency of the primary 20 MHz channel in MHz. + private static WlanBssChannel ParseHeChannel(byte[] ie, int offset, int length, WlanBssChannel ht, + int primaryFrequencyMHz) { // HE Operation Parameters (3) + BSS Color (1) + Basic HE-MCS And NSS Set (2) = 6 bytes minimum. if (length < 6) - return 0; + return default; var end = offset + length; @@ -363,12 +419,12 @@ private static int ParseHeWidth(byte[] ie, int offset, int length, int htWidth) var sixGhzOperationInformationPresent = ((heOperationParameters >> 17) & 1) == 1; var cursor = offset + 3 + 1 + 2; // skip parameters, BSS color, basic HE-MCS - var width = 0; + WlanBssChannel channel = default; if (vhtOperationInformationPresent) { if (cursor + 3 <= end) - width = Math.Max(width, ParseVhtWidth(ie[cursor], ie[cursor + 1], ie[cursor + 2], htWidth)); + channel = ParseVhtChannel(ie[cursor], ie[cursor + 1], ie[cursor + 2], ht, primaryFrequencyMHz); cursor += 3; } @@ -378,21 +434,45 @@ private static int ParseHeWidth(byte[] ie, int offset, int length, int htWidth) if (sixGhzOperationInformationPresent && cursor + 2 <= end) { - // 6 GHz Operation Information: Primary Channel (1), Control (1), ... + // 6 GHz Operation Information: Primary Channel (1), Control (1), CCFS0 (1), CCFS1 (1), ... // Control byte bits 0-1 = channel width (0 = 20, 1 = 40, 2 = 80, 3 = 160/80+80 MHz). - var channelWidth = ie[cursor + 1] & 0x03; - var sixGhzWidth = channelWidth switch + var sixGhzWidth = (ie[cursor + 1] & 0x03) switch { 0 => 20, 1 => 40, 2 => 80, - 3 => 160, - _ => 0 + _ => 160 }; - width = Math.Max(width, sixGhzWidth); + + // CCFS0 is the center of the channel (of the primary 80 MHz channel for 160 MHz), CCFS1 the center of + // the 160 MHz channel (0 for narrower channels) + var segment0 = cursor + 3 <= end ? ie[cursor + 2] : 0; + var segment1 = cursor + 4 <= end ? ie[cursor + 3] : 0; + var centerChannel = sixGhzWidth == 160 && segment1 != 0 ? segment1 : segment0; + + channel = Widest(channel, + new WlanBssChannel(sixGhzWidth, ChannelToFrequency(centerChannel, primaryFrequencyMHz))); } - return width; + return channel; + } + + /// + /// Converts a channel number of the band of the primary channel to its frequency in MHz. + /// + /// Channel number (e.g. 42), 0 if not set. + /// Frequency of the primary channel, used for the band and as fallback. + private static int ChannelToFrequency(int channel, int primaryFrequencyMHz) + { + if (channel == 0) + return primaryFrequencyMHz; + + return primaryFrequencyMHz switch + { + >= 5925 => 5950 + channel * 5, // 6 GHz + >= 4900 => 5000 + channel * 5, // 5 GHz + _ => channel == 14 ? 2484 : 2407 + channel * 5 // 2.4 GHz + }; } /// diff --git a/Source/NETworkManager.Tests/Network/WlanApiTests.cs b/Source/NETworkManager.Tests/Network/WlanApiTests.cs new file mode 100644 index 0000000000..f1657ce6f6 --- /dev/null +++ b/Source/NETworkManager.Tests/Network/WlanApiTests.cs @@ -0,0 +1,116 @@ +using System.Linq; +using NETworkManager.Models.Network; +using Xunit; + +namespace NETworkManager.Tests.Network; + +public class WlanApiTests +{ + // HT Operation (61): primary channel, info byte (bits 0-1 secondary channel offset, bit 2 STA channel width), + // 20 more bytes + private static byte[] HtOperation(byte info) + { + return [61, 22, 0, info, .. new byte[20]]; + } + + // VHT Operation (192): channel width, CCFS0, CCFS1, basic VHT-MCS and NSS set (2) + private static byte[] VhtOperation(byte channelWidth, byte segment0, byte segment1) + { + return [192, 5, channelWidth, segment0, segment1, 0, 0]; + } + + // HE Operation (255 / 36) with the 6 GHz Operation Information: primary channel, control (bits 0-1 channel + // width), CCFS0, CCFS1, minimum rate + private static byte[] HeOperation6GHz(byte control, byte segment0, byte segment1) + { + // Parameters (3, B17 = 6 GHz Operation Information present), BSS color (1), basic HE-MCS and NSS set (2) + byte[] body = [36, 0x00, 0x00, 0x02, 0, 0, 0, 1, control, segment0, segment1, 0]; + return [255, (byte)body.Length, .. body]; + } + + private static WlanApi.WlanBssChannel Parse(int primaryFrequencyMHz, params byte[][] elements) + { + return WlanApi.GetChannelFromInformationElements(elements.SelectMany(x => x).ToArray(), primaryFrequencyMHz); + } + + [Fact] + public void NoOperationElement_IsUnknown() + { + // SSID element only + Assert.Equal(default, Parse(5180, [0, 4, 0x54, 0x65, 0x73, 0x74])); + } + + [Fact] + public void Ht20_IsCenteredOnThePrimaryChannel() + { + Assert.Equal(new WlanApi.WlanBssChannel(20, 2437), Parse(2437, HtOperation(0x00))); + } + + [Theory] + [InlineData(0x05, 2422)] // Secondary channel above: channels 1 + 5, center channel 3 + [InlineData(0x07, 2442)] // Secondary channel below: channels 9 + 5, center channel 7 (primary channel 9 = 2452) + public void Ht40_IsCenteredBetweenPrimaryAndSecondaryChannel(byte info, int expectedCenter) + { + var primary = info == 0x05 ? 2412 : 2452; + + Assert.Equal(new WlanApi.WlanBssChannel(40, expectedCenter), Parse(primary, HtOperation(info))); + } + + [Fact] + public void Ht40WithoutSecondaryChannel_Is20() + { + Assert.Equal(new WlanApi.WlanBssChannel(20, 2412), Parse(2412, HtOperation(0x04))); + } + + [Fact] + public void Vht80_IsCenteredOnSegment0() + { + // Primary channel 36, 80 MHz on the channels 36 - 48 (center channel 42) + Assert.Equal(new WlanApi.WlanBssChannel(80, 5210), Parse(5180, HtOperation(0x05), VhtOperation(1, 42, 0))); + } + + [Fact] + public void Vht160_IsCenteredOnSegment1() + { + // Primary channel 36, 160 MHz on the channels 36 - 64 (center channel 50, segment 0 = primary 80 MHz) + Assert.Equal(new WlanApi.WlanBssChannel(160, 5250), Parse(5180, HtOperation(0x05), VhtOperation(1, 42, 50))); + } + + [Fact] + public void Vht160DeprecatedEncoding_IsCenteredOnSegment0() + { + Assert.Equal(new WlanApi.WlanBssChannel(160, 5250), Parse(5180, HtOperation(0x05), VhtOperation(2, 50, 0))); + } + + [Fact] + public void Vht20Or40_DefersToHt() + { + Assert.Equal(new WlanApi.WlanBssChannel(40, 5190), Parse(5180, HtOperation(0x05), VhtOperation(0, 0, 0))); + } + + [Fact] + public void VhtBeforeHt_IsParsedTheSame() + { + Assert.Equal(new WlanApi.WlanBssChannel(40, 5190), Parse(5180, VhtOperation(0, 0, 0), HtOperation(0x05))); + } + + [Theory] + [InlineData(0, 1, 0, 20, 5955)] // Channel 1 + [InlineData(1, 3, 0, 40, 5965)] // Channels 1 - 5, center channel 3 + [InlineData(2, 7, 0, 80, 5985)] // Channels 1 - 13, center channel 7 + [InlineData(3, 7, 15, 160, 6025)] // Channels 1 - 29, center channel 15 (segment 0 = primary 80 MHz) + [InlineData(3, 15, 0, 160, 6025)] // Old encoding: segment 0 is the center + public void He6GHz_IsCenteredOnTheChannelCenter(byte control, byte segment0, byte segment1, int expectedWidth, + int expectedCenter) + { + Assert.Equal(new WlanApi.WlanBssChannel(expectedWidth, expectedCenter), + Parse(5955, HeOperation6GHz(control, segment0, segment1))); + } + + [Fact] + public void TruncatedElement_IsIgnored() + { + // Length 22, but only 3 bytes follow + Assert.Equal(default, Parse(5180, [61, 22, 0, 0x05, 0])); + } +} diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 191b215d1a..15488ffa22 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -800,7 +800,7 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals case WiFiRadio.GHz6: // Split by channel center into the lower (1-125) and upper (129-233) chart. var centerChannel = FrequencyToChannelAxis( - network.ChannelCenterFrequencyInGigahertz * 1000, WiFiRadio.GHz6); + network.ChannelBandwidthCenterFrequencyInGigahertz * 1000, WiFiRadio.GHz6); if (centerChannel < SixGHzSplitChannel) { @@ -1044,7 +1044,7 @@ private static RectangularSection NewSection(double yi, double yj, string color) /// /// Builds a line series and a matching legend entry for a single network, rendered as a - /// trapezoid centered on its channel center frequency. + /// trapezoid centered on the center frequency of the whole channel (not of the primary channel). /// private static (LineSeries Series, WiFiChannelLegendEntry Legend) BuildNetworkSeries(WiFiNetworkInfo network, int colorIndex) { @@ -1052,7 +1052,8 @@ private static (LineSeries Series, WiFiChannelLegendEntry Lege double dbm = network.AvailableNetwork.NetworkRssiInDecibelMilliwatts; var center = ChannelNumberToDisplay( - FrequencyToChannelAxis(network.ChannelCenterFrequencyInGigahertz * 1000, network.Radio), network.Radio); + FrequencyToChannelAxis(network.ChannelBandwidthCenterFrequencyInGigahertz * 1000, network.Radio), + network.Radio); // Channel-number space uses 5 MHz per unit, so a bandwidth in MHz spans bandwidth/5 units. var bandwidth = network.ChannelBandwidth; diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 56458e454f..958d040c5e 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -293,6 +293,7 @@ Release date: **xx.xx.2026** - Fixed the **WPS** button of the connect dialog never being shown. Whether a network supports WPS (push button) is checked again when the dialog is opened. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the connect dialog not focusing the first input: the SSID of a hidden network or the username (EAP) was not focused. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the connect dialog asking for a pre-shared key for WPA3 Enterprise networks (instead of username and password) and for OWE (Enhanced Open) networks, which need no password. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed networks with a channel width of 40, 80 or 160 MHz being drawn at the wrong position on the **Channels** tab: they were centered on their primary channel (e.g. 80 MHz on channel 36 over the channels 28 - 44 instead of 36 - 48), so overlapping networks were shown wrong. The center of the whole channel is read from the beacon now. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From b5f7d4b028ee8ee77c93ea77a648458305889d9c Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:58:21 +0100 Subject: [PATCH 12/66] Fix: WiFi: 320 MHz channels shown as 160 MHz (B20) The EHT Operation element (802.11be, extension id 106) was not parsed, so 320 MHz channels got the 160 MHz of the HE element. Its channel width and center (CCFS0 / CCFS1) are read now, with unit tests. Co-Authored-By: Claude Opus 5.5 --- .../NETworkManager.Models/Network/WlanApi.cs | 57 +++++++++++++++++-- .../Network/WlanApiTests.cs | 24 ++++++++ Website/docs/changelog/next-release.md | 1 + 3 files changed, 77 insertions(+), 5 deletions(-) diff --git a/Source/NETworkManager.Models/Network/WlanApi.cs b/Source/NETworkManager.Models/Network/WlanApi.cs index 80ad7af977..6288124dba 100644 --- a/Source/NETworkManager.Models/Network/WlanApi.cs +++ b/Source/NETworkManager.Models/Network/WlanApi.cs @@ -7,14 +7,14 @@ namespace NETworkManager.Models.Network; /// /// Native Wi-Fi (wlanapi.dll) interop used to determine the channel bandwidth -/// (20 / 40 / 80 / 160 MHz) and its center frequency of nearby access points. +/// (20 / 40 / 80 / 160 / 320 MHz) and its center frequency of nearby access points. /// /// The Windows Runtime Wi-Fi API () does /// not expose the channel width, its frequency is the one of the primary 20 MHz channel (where /// the beacons are sent). The native BSS list (WlanGetNetworkBssList) however returns the /// raw 802.11 information elements (IEs) of each beacon / probe response. The width and the /// center of the whole channel are parsed from the HT-Operation (802.11n), VHT-Operation -/// (802.11ac) and HE-Operation (802.11ax / 6 GHz) elements. +/// (802.11ac), HE-Operation (802.11ax / 6 GHz) and EHT-Operation (802.11be) elements. /// /// All calls are wrapped in try/catch; on any failure an empty result is returned so the caller /// can fall back to a heuristic (see ). @@ -31,11 +31,12 @@ public static class WlanApi private const byte EidVhtOperation = 192; private const byte EidExtension = 255; private const byte ExtEidHeOperation = 36; + private const byte ExtEidEhtOperation = 106; /// /// Channel of an access point parsed from its information elements. /// - /// Channel width in MHz (20, 40, 80, 160), 0 if unknown. + /// Channel width in MHz (20, 40, 80, 160, 320), 0 if unknown. /// /// Center frequency of the whole channel in MHz (e.g. 5210 for 80 MHz on the channels 36 - 48), 0 if unknown. /// @@ -280,7 +281,7 @@ private static List EnumerateInterfaces(IntPtr clientHandle) /// /// Walks the TLV-encoded 802.11 information elements and returns the widest channel advertised - /// by the HT-, VHT- or HE-Operation element, with the center frequency of the whole channel. + /// by the HT-, VHT-, HE- or EHT-Operation element, with the center frequency of the whole channel. /// Returns default (width 0) if none of these elements are present. /// /// Information elements of a beacon / probe response. @@ -290,6 +291,7 @@ public static WlanBssChannel GetChannelFromInformationElements(byte[] ie, int pr WlanBssChannel ht = default; byte[] vhtOperation = null; int heOffset = -1, heLength = 0; + int ehtOffset = -1, ehtLength = 0; var pos = 0; @@ -314,6 +316,10 @@ public static WlanBssChannel GetChannelFromInformationElements(byte[] ie, int pr heOffset = data + 1; heLength = len - 1; break; + case EidExtension when len >= 1 && ie[data] == ExtEidEhtOperation: + ehtOffset = data + 1; + ehtLength = len - 1; + break; } pos = data + len; @@ -326,8 +332,10 @@ public static WlanBssChannel GetChannelFromInformationElements(byte[] ie, int pr var he = heOffset < 0 ? default : ParseHeChannel(ie, heOffset, heLength, ht, primaryFrequencyMHz); + var eht = ehtOffset < 0 ? default : ParseEhtChannel(ie, ehtOffset, ehtLength, primaryFrequencyMHz); + // The widest channel; on a tie the newer element (its center is the more precise one) - return Widest(Widest(ht, vht), he); + return Widest(Widest(Widest(ht, vht), he), eht); } /// @@ -457,6 +465,45 @@ private static WlanBssChannel ParseHeChannel(byte[] ie, int offset, int length, return channel; } + /// + /// Parses the EHT-Operation element (802.11be): EHT Operation Parameters (1, bit 0 = EHT + /// Operation Information present) and Basic EHT-MCS And NSS Set (4), followed by the EHT + /// Operation Information: Control (1, bits 0-2 = 20 / 40 / 80 / 160 / 320 MHz), CCFS0 (1), + /// CCFS1 (1). Only present if the channel differs from the HT / VHT / HE elements (e.g. 320 MHz). + /// + /// The full information element buffer. + /// Offset of the EHT Operation Parameters (after the extension id byte). + /// Remaining length of the EHT-Operation element after the extension id. + /// Frequency of the primary 20 MHz channel in MHz. + private static WlanBssChannel ParseEhtChannel(byte[] ie, int offset, int length, int primaryFrequencyMHz) + { + if (length < 8 || (ie[offset] & 0x01) == 0) + return default; + + var cursor = offset + 1 + 4; // skip parameters, basic EHT-MCS + + var width = (ie[cursor] & 0x07) switch + { + 0 => 20, + 1 => 40, + 2 => 80, + 3 => 160, + 4 => 320, + _ => 0 + }; + + if (width == 0) + return default; + + // CCFS0 is the center of the channel (of the primary 80 / 160 MHz channel for 160 / 320 MHz), CCFS1 the + // center of the 160 / 320 MHz channel + var segment0 = ie[cursor + 1]; + var segment1 = ie[cursor + 2]; + var centerChannel = width >= 160 && segment1 != 0 ? segment1 : segment0; + + return new WlanBssChannel(width, ChannelToFrequency(centerChannel, primaryFrequencyMHz)); + } + /// /// Converts a channel number of the band of the primary channel to its frequency in MHz. /// diff --git a/Source/NETworkManager.Tests/Network/WlanApiTests.cs b/Source/NETworkManager.Tests/Network/WlanApiTests.cs index f1657ce6f6..d489437179 100644 --- a/Source/NETworkManager.Tests/Network/WlanApiTests.cs +++ b/Source/NETworkManager.Tests/Network/WlanApiTests.cs @@ -28,6 +28,14 @@ private static byte[] HeOperation6GHz(byte control, byte segment0, byte segment1 return [255, (byte)body.Length, .. body]; } + // EHT Operation (255 / 106): parameters (bit 0 = EHT Operation Information present), basic EHT-MCS and NSS set (4), + // control (bits 0-2 channel width), CCFS0, CCFS1 + private static byte[] EhtOperation(byte control, byte segment0, byte segment1) + { + byte[] body = [106, 0x01, 0, 0, 0, 0, control, segment0, segment1]; + return [255, (byte)body.Length, .. body]; + } + private static WlanApi.WlanBssChannel Parse(int primaryFrequencyMHz, params byte[][] elements) { return WlanApi.GetChannelFromInformationElements(elements.SelectMany(x => x).ToArray(), primaryFrequencyMHz); @@ -107,6 +115,22 @@ public void He6GHz_IsCenteredOnTheChannelCenter(byte control, byte segment0, byt Parse(5955, HeOperation6GHz(control, segment0, segment1))); } + [Fact] + public void Eht320_IsCenteredOnSegment1() + { + // Primary channel 1, 320 MHz on the channels 1 - 61 (center channel 31, segment 0 = primary 160 MHz) + Assert.Equal(new WlanApi.WlanBssChannel(320, 6105), + Parse(5955, HeOperation6GHz(3, 7, 15), EhtOperation(4, 15, 31))); + } + + [Fact] + public void EhtWithoutOperationInformation_KeepsHe() + { + byte[] eht = [255, 6, 106, 0x00, 0, 0, 0, 0]; + + Assert.Equal(new WlanApi.WlanBssChannel(160, 6025), Parse(5955, HeOperation6GHz(3, 7, 15), eht)); + } + [Fact] public void TruncatedElement_IsIgnored() { diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 958d040c5e..190fa7baaa 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -294,6 +294,7 @@ Release date: **xx.xx.2026** - Fixed the connect dialog not focusing the first input: the SSID of a hidden network or the username (EAP) was not focused. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the connect dialog asking for a pre-shared key for WPA3 Enterprise networks (instead of username and password) and for OWE (Enhanced Open) networks, which need no password. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed networks with a channel width of 40, 80 or 160 MHz being drawn at the wrong position on the **Channels** tab: they were centered on their primary channel (e.g. 80 MHz on channel 36 over the channels 28 - 44 instead of 36 - 48), so overlapping networks were shown wrong. The center of the whole channel is read from the beacon now. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed WiFi 7 (802.11be) networks with a channel width of 320 MHz being shown with 160 MHz. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 32cc895d79cef719263818dce09adec63d67309a Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 00:59:27 +0100 Subject: [PATCH 13/66] Feature: WiFi: Mark estimated channel widths (C7) If the channel width can't be read from the BSS list, it is estimated from the band and the PHY kind, but it looked like a measured value. WiFiNetworkInfo.IsChannelBandwidthEstimated marks it; the grid, the copy menu and the chart tooltip show "~80 MHz", the grid cell has a tooltip with the reason. The estimate for 2.4 GHz is 20 MHz (also for 802.11n, 40 MHz is rarely used on 2.4 GHz). Co-Authored-By: Claude Opus 5.5 --- .../WiFiChannelBandwidthToStringConverter.cs | 15 +++++++++++++- .../Resources/Strings.Designer.cs | 9 +++++++++ .../Resources/Strings.resx | 3 +++ Source/NETworkManager.Models/Network/WiFi.cs | 19 ++++++++++-------- .../Network/WiFiNetworkInfo.cs | 6 ++++++ .../LiveChartsWiFiChannelTooltip.xaml.cs | 3 ++- Source/NETworkManager/Views/WiFiView.xaml | 20 ++++++++++++++++--- Website/docs/changelog/next-release.md | 1 + 8 files changed, 63 insertions(+), 13 deletions(-) diff --git a/Source/NETworkManager.Converters/WiFiChannelBandwidthToStringConverter.cs b/Source/NETworkManager.Converters/WiFiChannelBandwidthToStringConverter.cs index eed8d891e1..c438c615ac 100644 --- a/Source/NETworkManager.Converters/WiFiChannelBandwidthToStringConverter.cs +++ b/Source/NETworkManager.Converters/WiFiChannelBandwidthToStringConverter.cs @@ -1,14 +1,27 @@ using System; using System.Globalization; using System.Windows.Data; +using NETworkManager.Models.Network; namespace NETworkManager.Converters; +/// +/// Channel width of a WiFi network () as text, e.g. "80 MHz", or "~80 MHz" if it was +/// estimated (see ). +/// public sealed class WiFiChannelBandwidthToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return value is not int bandwidth ? "-/-" : $"{bandwidth} MHz"; + return value is not WiFiNetworkInfo info ? "-/-" : Format(info); + } + + /// + /// Gets the channel width of a network as text (e.g. "80 MHz", "~80 MHz" if estimated). + /// + public static string Format(WiFiNetworkInfo info) + { + return $"{(info.IsChannelBandwidthEstimated ? "~" : string.Empty)}{info.ChannelBandwidth} MHz"; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs index da57838ebf..1648de9c66 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs +++ b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs @@ -1855,6 +1855,15 @@ public static string ChannelWidth { } } + /// + /// Looks up a localized string similar to Estimated from the band and the WiFi standard: the channel width could not be read from the beacon of the access point.. + /// + public static string ChannelWidthEstimatedToolTip { + get { + return ResourceManager.GetString("ChannelWidthEstimatedToolTip", resourceCulture); + } + } + /// /// Looks up a localized string similar to Chart time (seconds). /// diff --git a/Source/NETworkManager.Localization/Resources/Strings.resx b/Source/NETworkManager.Localization/Resources/Strings.resx index 18b640437b..c3b53b3203 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.resx +++ b/Source/NETworkManager.Localization/Resources/Strings.resx @@ -5453,4 +5453,7 @@ Do you want to start the scan? Could not disconnect from {0} ({1})! + + Estimated from the band and the WiFi standard: the channel width could not be read from the beacon of the access point. + \ No newline at end of file diff --git a/Source/NETworkManager.Models/Network/WiFi.cs b/Source/NETworkManager.Models/Network/WiFi.cs index eafb9d7732..4a86817a82 100644 --- a/Source/NETworkManager.Models/Network/WiFi.cs +++ b/Source/NETworkManager.Models/Network/WiFi.cs @@ -79,8 +79,9 @@ public static async Task GetNetworksAsync(WiFiAdapter adapt { var channelFrequencyInGigahertz = ConvertChannelFrequencyToGigahertz(availableNetwork.ChannelCenterFrequencyInKilohertz); var radio = GetWiFiRadioFromChannelFrequency(channelFrequencyInGigahertz); - var (channelBandwidth, channelBandwidthCenterFrequencyInGigahertz) = GetChannelBandwidth(channels, - availableNetwork.Bssid, radio, availableNetwork.PhyKind, channelFrequencyInGigahertz); + var (channelBandwidth, channelBandwidthCenterFrequencyInGigahertz, isChannelBandwidthEstimated) = + GetChannelBandwidth(channels, availableNetwork.Bssid, radio, availableNetwork.PhyKind, + channelFrequencyInGigahertz); var wifiNetworkInfo = new WiFiNetworkInfo { @@ -90,6 +91,7 @@ public static async Task GetNetworksAsync(WiFiAdapter adapt Channel = GetChannelFromChannelFrequency(channelFrequencyInGigahertz), ChannelBandwidth = channelBandwidth, ChannelBandwidthCenterFrequencyInGigahertz = channelBandwidthCenterFrequencyInGigahertz, + IsChannelBandwidthEstimated = isChannelBandwidthEstimated, IsHidden = string.IsNullOrEmpty(availableNetwork.Ssid), IsConnected = availableNetwork.Bssid.Equals(bssid, StringComparison.OrdinalIgnoreCase), NetworkAuthenticationType = GetHumanReadableNetworkAuthenticationType(availableNetwork.SecuritySettings.NetworkAuthenticationType), @@ -335,28 +337,29 @@ private static WiFiRadio GetWiFiRadioFromChannelFrequency(double gigahertz) /// /// Determines the channel bandwidth (MHz) and its center frequency (GHz) for a network. Prefers /// the values parsed from the native BSS list (); if unavailable, falls back - /// to a heuristic based on the radio band and PHY kind (centered on the primary channel). + /// to a heuristic based on the radio band and PHY kind (centered on the primary channel, marked as estimated). /// - private static (int Bandwidth, double CenterFrequencyInGigahertz) GetChannelBandwidth( + private static (int Bandwidth, double CenterFrequencyInGigahertz, bool IsEstimated) GetChannelBandwidth( IReadOnlyDictionary channels, string networkBssid, WiFiRadio radio, WiFiPhyKind phyKind, double primaryFrequencyInGigahertz) { if (!string.IsNullOrEmpty(networkBssid) && channels.TryGetValue(networkBssid, out var channel) && channel.BandwidthMHz > 0 && channel.CenterFrequencyMHz > 0) - return (channel.BandwidthMHz, channel.CenterFrequencyMHz / 1000.0); + return (channel.BandwidthMHz, channel.CenterFrequencyMHz / 1000.0, false); - return (GetHeuristicChannelBandwidth(radio, phyKind), primaryFrequencyInGigahertz); + return (GetHeuristicChannelBandwidth(radio, phyKind), primaryFrequencyInGigahertz, true); } /// /// Estimates the channel bandwidth (MHz) from the radio band and PHY kind when the exact - /// value could not be read from the BSS list. + /// value could not be read from the BSS list. 2.4 GHz is always 20 MHz: 40 MHz is supported since + /// 802.11n, but rarely used (only 3 channels without overlap). /// private static int GetHeuristicChannelBandwidth(WiFiRadio radio, WiFiPhyKind phyKind) { return radio switch { - WiFiRadio.GHz2dot4 => phyKind == WiFiPhyKind.HT ? 40 : 20, + WiFiRadio.GHz2dot4 => 20, WiFiRadio.GHz5 => phyKind switch { WiFiPhyKind.Vht or WiFiPhyKind.HE or WiFiPhyKind.Eht => 80, diff --git a/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs b/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs index f62f34742a..3e520fb654 100644 --- a/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs +++ b/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs @@ -50,6 +50,12 @@ public WiFiNetworkInfo() /// public double ChannelBandwidthCenterFrequencyInGigahertz { get; set; } + /// + /// Indicates if the is estimated from the radio band and the PHY kind, because it + /// could not be read from the beacon of the access point. + /// + public bool IsChannelBandwidthEstimated { get; set; } + /// /// Indicates if the Wi-Fi network Ssid is hidden. /// diff --git a/Source/NETworkManager/Controls/LiveChartsWiFiChannelTooltip.xaml.cs b/Source/NETworkManager/Controls/LiveChartsWiFiChannelTooltip.xaml.cs index c19f58d2a2..4ffae4171c 100644 --- a/Source/NETworkManager/Controls/LiveChartsWiFiChannelTooltip.xaml.cs +++ b/Source/NETworkManager/Controls/LiveChartsWiFiChannelTooltip.xaml.cs @@ -9,6 +9,7 @@ using LiveChartsCore.Kernel.Sketches; using LiveChartsCore.SkiaSharpView; using LiveChartsCore.SkiaSharpView.Painting; +using NETworkManager.Converters; using NETworkManager.Localization.Resources; using NETworkManager.Models.Network; using SkiaSharp; @@ -58,7 +59,7 @@ public void Show(IEnumerable tooltipPoints, Chart chart) var ssid = network.IsHidden ? Strings.HiddenNetwork : network.AvailableNetwork.Ssid; var bssid = network.AvailableNetwork.Bssid; var dbm = $"{network.AvailableNetwork.NetworkRssiInDecibelMilliwatts} dBm"; - var widthText = $"{network.ChannelBandwidth} MHz"; + var widthText = WiFiChannelBandwidthToStringConverter.Format(network); var channelDetail = $"{Strings.Channel} {network.Channel} · {widthText}"; TooltipEntries.Add(new TooltipEntry(SkColorToBrush(GetSeriesColor(point)), ssid, bssid, dbm, channelDetail)); diff --git a/Source/NETworkManager/Views/WiFiView.xaml b/Source/NETworkManager/Views/WiFiView.xaml index fa28c9c15f..329ad17d84 100644 --- a/Source/NETworkManager/Views/WiFiView.xaml +++ b/Source/NETworkManager/Views/WiFiView.xaml @@ -339,7 +339,7 @@ Style="{StaticResource ResourceKey=CopyMenuItem}" /> + MinWidth="120"> + + + + Date: Sun, 8 Nov 2026 00:59:36 +0100 Subject: [PATCH 14/66] Fix: WiFi: Wrong 5 GHz channel labels above channel 144 (B9) BuildChannelSet(100, 165, 4) produced 148, 152 ... 164, but the UNII-3 channels are 149, 153 ... 165. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 6 ++++-- Website/docs/changelog/next-release.md | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 15488ffa22..bf030a9899 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -881,11 +881,13 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals // 2.4 GHz operating channels are 1, 2, 3, ... 14 (every channel number), labeled with the channel private static readonly HashSet ValidChannels2Dot4GHz = BuildChannelSet(1, 14, 1); - // 5 GHz operating channels are 36, 40, 44, ... 165 (every 4 in channel-number space), labeled with + // 5 GHz operating channels are 36 - 64 and 100 - 144 (every 4 in channel-number space) and 149 - 165 (UNII-3, + // odd channel numbers), labeled with the channel private static readonly HashSet ValidChannels5GHz = [ .. BuildChannelSet(36, 64, 4), - .. BuildChannelSet(100, 165, 4) + .. BuildChannelSet(100, 144, 4), + .. BuildChannelSet(149, 165, 4) ]; // 6 GHz operating channels are 1, 5, 9, ... 233 (every 4 in channel-number space), labeled with the diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index a03a328105..593e0dc092 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -296,6 +296,7 @@ Release date: **xx.xx.2026** - Fixed the connect dialog asking for a pre-shared key for WPA3 Enterprise networks (instead of username and password) and for OWE (Enhanced Open) networks, which need no password. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed networks with a channel width of 40, 80 or 160 MHz being drawn at the wrong position on the **Channels** tab: they were centered on their primary channel (e.g. 80 MHz on channel 36 over the channels 28 - 44 instead of 36 - 48), so overlapping networks were shown wrong. The center of the whole channel is read from the beacon now. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed WiFi 7 (802.11be) networks with a channel width of 320 MHz being shown with 160 MHz. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the 5 GHz chart of the **Channels** tab labeling the channels above 144 as 148, 152 ... 164 instead of 149, 153 ... 165. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 050c5ff94047b9160c596b7576029fc6c0d3ef14 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:00:33 +0100 Subject: [PATCH 15/66] Fix: WiFi: Channels outside the known 5 / 6 GHz ranges shown as -1 (B16) The 5 GHz range ended at 5825 MHz (channel 165): channels 169 - 177 (UNII-4) and 32 got the radio Unknown and channel -1, so they ignored the band filter and were not drawn. 6 GHz channel 2 (5935 MHz, below channel 1) got -1 as well and was drawn outside the axis. The ranges cover 5160 - 5885 MHz and channel 2 now, the 5 / 6 GHz chart axes include them. GetChannelFromChannelFrequency and GetWiFiRadioFromChannelFrequency are public for unit tests. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager.Models/Network/WiFi.cs | 17 +++++---- .../Network/WiFiChannelTests.cs | 37 +++++++++++++++++++ .../ViewModels/WiFiViewModel.cs | 12 +++--- Website/docs/changelog/next-release.md | 1 + 4 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 Source/NETworkManager.Tests/Network/WiFiChannelTests.cs diff --git a/Source/NETworkManager.Models/Network/WiFi.cs b/Source/NETworkManager.Models/Network/WiFi.cs index 4a86817a82..bee2415052 100644 --- a/Source/NETworkManager.Models/Network/WiFi.cs +++ b/Source/NETworkManager.Models/Network/WiFi.cs @@ -284,8 +284,8 @@ public static async Task IsWpsAvailable(WiFiAdapter adapter, WiFiAvailable /// Get the Wi-Fi channel from channel frequency. /// /// Input like 2.422 or 5.240. - /// Wi-Fi channel like 3 or 48. - private static int GetChannelFromChannelFrequency(double gigahertz) + /// Wi-Fi channel like 3 or 48, -1 if the frequency is not a channel. + public static int GetChannelFromChannelFrequency(double gigahertz) { // Convert to integer MHz to avoid floating-point precision issues from the // kilohertz / 1_000_000.0 conversion in ConvertChannelFrequencyToGigahertz. @@ -297,11 +297,14 @@ private static int GetChannelFromChannelFrequency(double gigahertz) if (mhz == 2484) return 14; - // 5 GHz: channels follow f = 5000 + ch×5 MHz - if (mhz is >= 5180 and <= 5825) + // 5 GHz: channels 32-177 follow f = 5000 + ch×5 MHz (169-177 = UNII-4) + if (mhz is >= 5160 and <= 5885) return (mhz - 5000) / 5; - // 6 GHz: channels 1-233 follow f = 5950 + ch×5 MHz + // 6 GHz: channel 2 is at 5935 MHz, channels 1-233 follow f = 5950 + ch×5 MHz + if (mhz == 5935) + return 2; + if (mhz is >= 5955 and <= 7115) return (mhz - 5950) / 5; @@ -323,12 +326,12 @@ private static double ConvertChannelFrequencyToGigahertz(int kilohertz) /// /// Frequency in gigahertz like 2.412 or 5.180. /// Radio like 2.4 GHz, 5 GHz, etc. as . - private static WiFiRadio GetWiFiRadioFromChannelFrequency(double gigahertz) + public static WiFiRadio GetWiFiRadioFromChannelFrequency(double gigahertz) { return gigahertz switch { >= 2.412 and <= 2.484 => WiFiRadio.GHz2dot4, - >= 5.180 and <= 5.825 => WiFiRadio.GHz5, + >= 5.160 and <= 5.885 => WiFiRadio.GHz5, >= 5.925 and <= 7.125 => WiFiRadio.GHz6, _ => WiFiRadio.Unknown }; diff --git a/Source/NETworkManager.Tests/Network/WiFiChannelTests.cs b/Source/NETworkManager.Tests/Network/WiFiChannelTests.cs new file mode 100644 index 0000000000..dad5a0583e --- /dev/null +++ b/Source/NETworkManager.Tests/Network/WiFiChannelTests.cs @@ -0,0 +1,37 @@ +using NETworkManager.Models.Network; +using Xunit; + +namespace NETworkManager.Tests.Network; + +public class WiFiChannelTests +{ + [Theory] + [InlineData(2.412, 1)] + [InlineData(2.472, 13)] + [InlineData(2.484, 14)] + [InlineData(5.160, 32)] + [InlineData(5.180, 36)] + [InlineData(5.825, 165)] + [InlineData(5.885, 177)] + [InlineData(5.935, 2)] + [InlineData(5.955, 1)] + [InlineData(7.115, 233)] + [InlineData(5.000, -1)] + public void GetChannelFromChannelFrequency_ReturnsTheChannel(double gigahertz, int expected) + { + Assert.Equal(expected, WiFi.GetChannelFromChannelFrequency(gigahertz)); + } + + [Theory] + [InlineData(2.412, WiFiRadio.GHz2dot4)] + [InlineData(2.484, WiFiRadio.GHz2dot4)] + [InlineData(5.180, WiFiRadio.GHz5)] + [InlineData(5.885, WiFiRadio.GHz5)] + [InlineData(5.935, WiFiRadio.GHz6)] + [InlineData(7.115, WiFiRadio.GHz6)] + [InlineData(3.000, WiFiRadio.Unknown)] + public void GetWiFiRadioFromChannelFrequency_ReturnsTheBand(double gigahertz, WiFiRadio expected) + { + Assert.Equal(expected, WiFi.GetWiFiRadioFromChannelFrequency(gigahertz)); + } +} diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index bf030a9899..e6ed3ac2e2 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -881,16 +881,17 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals // 2.4 GHz operating channels are 1, 2, 3, ... 14 (every channel number), labeled with the channel private static readonly HashSet ValidChannels2Dot4GHz = BuildChannelSet(1, 14, 1); - // 5 GHz operating channels are 36 - 64 and 100 - 144 (every 4 in channel-number space) and 149 - 165 (UNII-3, + // 5 GHz operating channels are 36 - 64 and 100 - 144 (every 4 in channel-number space) and 149 - 177 (UNII-3 / -4, // odd channel numbers), labeled with the channel private static readonly HashSet ValidChannels5GHz = [ .. BuildChannelSet(36, 64, 4), .. BuildChannelSet(100, 144, 4), - .. BuildChannelSet(149, 165, 4) + .. BuildChannelSet(149, 177, 4) ]; - // 6 GHz operating channels are 1, 5, 9, ... 233 (every 4 in channel-number space), labeled with the + // 6 GHz operating channels are 1, 5, 9, ... 233 (every 4 in channel-number space), labeled with the channel. + // Channel 2 (5935 MHz) is below channel 1, at -3 on the axis - not labeled (the tooltip shows it). private static readonly HashSet ValidChannels6GHz = BuildChannelSet(1, 233, 4); // Channel that splits the 6 GHz band into the lower (1-125) and upper (129-233) chart. 127 sits @@ -934,8 +935,8 @@ private void InitializeCharts() // left flank of its trapezoid reaches the baseline instead of being clipped. The 5 GHz // upper bound is reduced because the 64..100 dead zone is compressed. Radio2Dot4GHzXAxes = BuildXAxes(-2, 16, ValidChannels2Dot4GHz, false, labelColor); - Radio5GHzXAxes = BuildXAxes(30, 152, ValidChannels5GHz, true, labelColor); - Radio6GHzLowerXAxes = BuildXAxes(-2, 128, ValidChannels6GHz, false, labelColor); + Radio5GHzXAxes = BuildXAxes(30, 160, ValidChannels5GHz, true, labelColor); + Radio6GHzLowerXAxes = BuildXAxes(-6, 128, ValidChannels6GHz, false, labelColor); Radio6GHzUpperXAxes = BuildXAxes(126, 236, ValidChannels6GHz, false, labelColor); Radio2Dot4GHzYAxes = BuildYAxes(labelColor, separatorColor); @@ -1122,6 +1123,7 @@ private static double FrequencyToChannelAxis(double frequencyMHz, WiFiRadio radi // Channel 14 is at 2484 MHz and does not follow the standard ch×5 + 2407 spacing. WiFiRadio.GHz2dot4 => (int)Math.Round(frequencyMHz) == 2484 ? 14.0 : (frequencyMHz - 2407) / 5.0, WiFiRadio.GHz5 => (frequencyMHz - 5000) / 5.0, + // Channel 2 is at 5935 MHz, below channel 1 (5955 MHz) - drawn at its real position (-3) WiFiRadio.GHz6 => (frequencyMHz - 5950) / 5.0, _ => 0 }; diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 593e0dc092..332f7bc5f8 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -297,6 +297,7 @@ Release date: **xx.xx.2026** - Fixed networks with a channel width of 40, 80 or 160 MHz being drawn at the wrong position on the **Channels** tab: they were centered on their primary channel (e.g. 80 MHz on channel 36 over the channels 28 - 44 instead of 36 - 48), so overlapping networks were shown wrong. The center of the whole channel is read from the beacon now. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed WiFi 7 (802.11be) networks with a channel width of 320 MHz being shown with 160 MHz. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the 5 GHz chart of the **Channels** tab labeling the channels above 144 as 148, 152 ... 164 instead of 149, 153 ... 165. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed networks on the 5 GHz channels 169 - 177 (UNII-4) and 32 being shown with channel `-1`, without band (always shown, not affected by the band filter) and missing on the **Channels** tab. 6 GHz channel 2 (5935 MHz) is shown as channel `2` instead of `-1`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 3fa3c98505b5d003ddedd426db5c4ef403b377ea Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:00:40 +0100 Subject: [PATCH 16/66] Fix: WiFi: Sorting by the signal icon and Encryption did nothing (B10) The SortMemberPath of the icon column pointed to a property that doesn't exist on WiFiNetworkInfo (ChannelCenterFrequencyInKilohertz), the one of Encryption missed SecuritySettings. The icon column sorts by the signal bars it shows now. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/Views/WiFiView.xaml | 4 ++-- Website/docs/changelog/next-release.md | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/NETworkManager/Views/WiFiView.xaml b/Source/NETworkManager/Views/WiFiView.xaml index 329ad17d84..069b0eb746 100644 --- a/Source/NETworkManager/Views/WiFiView.xaml +++ b/Source/NETworkManager/Views/WiFiView.xaml @@ -428,7 +428,7 @@ - + Date: Sun, 8 Nov 2026 01:00:57 +0100 Subject: [PATCH 17/66] Fix: WiFi: Adapter could be changed while scanning (B13) Selecting another adapter during a scan started a second scan; the one that finished last won, possibly the one of the previous adapter. The adapter selection is disabled while scanning or connecting (CanChangeAdapter). Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 9 +++++++++ Source/NETworkManager/Views/WiFiView.xaml | 3 ++- Website/docs/changelog/next-release.md | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index e6ed3ac2e2..c89b544344 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -120,6 +120,12 @@ public WiFiAdapterInfo SelectedAdapter } } + /// + /// Gets whether another adapter can be selected: not while the networks are scanned (the result of the previous + /// adapter could arrive after the one of the new adapter) or a connection is made. + /// + public bool CanChangeAdapter => !IsNetworksLoading && !IsBackgroundSearchRunning && !IsConnecting; + public bool IsNetworksLoading { get; @@ -130,6 +136,7 @@ public bool IsNetworksLoading field = value; OnPropertyChanged(); + OnPropertyChanged(nameof(CanChangeAdapter)); } } @@ -437,6 +444,7 @@ public bool IsBackgroundSearchRunning field = value; OnPropertyChanged(); + OnPropertyChanged(nameof(CanChangeAdapter)); } } @@ -463,6 +471,7 @@ public bool IsConnecting field = value; OnPropertyChanged(); + OnPropertyChanged(nameof(CanChangeAdapter)); } } diff --git a/Source/NETworkManager/Views/WiFiView.xaml b/Source/NETworkManager/Views/WiFiView.xaml index 069b0eb746..bcfbcb6471 100644 --- a/Source/NETworkManager/Views/WiFiView.xaml +++ b/Source/NETworkManager/Views/WiFiView.xaml @@ -76,7 +76,8 @@ + SelectedItem="{Binding Path=SelectedAdapter}" + IsEnabled="{Binding Path=CanChangeAdapter}"> diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 640627ba6b..cc70c7b963 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -299,6 +299,7 @@ Release date: **xx.xx.2026** - Fixed the 5 GHz chart of the **Channels** tab labeling the channels above 144 as 148, 152 ... 164 instead of 149, 153 ... 165. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed networks on the 5 GHz channels 169 - 177 (UNII-4) and 32 being shown with channel `-1`, without band (always shown, not affected by the band filter) and missing on the **Channels** tab. 6 GHz channel 2 (5935 MHz) is shown as channel `2` instead of `-1`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed sorting by the signal icon (first column) and by **Encryption** not changing the order of the networks. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the networks of the previously selected adapter possibly being shown after selecting another adapter while a scan was running. The adapter can't be changed while scanning or connecting. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 82cd17938a2f077fef4e0d79d60b62eed048e0dd Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:01:08 +0100 Subject: [PATCH 18/66] Fix: WiFi: Failed refresh removed all networks (B14) A failed scan cleared the networks and charts until the next scan, also for a refresh (manual, auto refresh, the rescan after connecting, which can fail while the adapter is busy). A refresh keeps the networks of the last scan now and only shows the error, like a failed repeated scan of the IP Scanner. A failed first scan of an adapter still clears them. Co-Authored-By: Claude Opus 5.5 --- .../ViewModels/WiFiViewModel.cs | 25 +++++++++++-------- Website/docs/changelog/next-release.md | 1 + 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index c89b544344..03f9888a4d 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -846,16 +846,21 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals statusMessage = string.Format(Strings.ErrorWhileScanningWiFiAdapterXXXWithErrorXXX, adapterInfo.NetworkInterfaceInfo.Name, ex.Message); - // Clear the existing old values if an error occurs - Networks.Clear(); - Radio2Dot4GHzSeries = []; - Radio5GHzSeries = []; - Radio6GHzLowerSeries = []; - Radio6GHzUpperSeries = []; - Radio2Dot4GHzLegend = []; - Radio5GHzLegend = []; - Radio6GHzLowerLegend = []; - Radio6GHzUpperLegend = []; + // A refresh (manual, automatic, after connecting) keeps the networks of the last scan (e.g. the adapter is + // busy shortly after connecting); the header still shows the time of the last scan. The networks of + // another adapter (first scan) are cleared. + if (!refreshing) + { + Networks.Clear(); + Radio2Dot4GHzSeries = []; + Radio5GHzSeries = []; + Radio6GHzLowerSeries = []; + Radio6GHzUpperSeries = []; + Radio2Dot4GHzLegend = []; + Radio5GHzLegend = []; + Radio6GHzLowerLegend = []; + Radio6GHzUpperLegend = []; + } } finally { diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index cc70c7b963..f0bd1f1c1b 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -300,6 +300,7 @@ Release date: **xx.xx.2026** - Fixed networks on the 5 GHz channels 169 - 177 (UNII-4) and 32 being shown with channel `-1`, without band (always shown, not affected by the band filter) and missing on the **Channels** tab. 6 GHz channel 2 (5935 MHz) is shown as channel `2` instead of `-1`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed sorting by the signal icon (first column) and by **Encryption** not changing the order of the networks. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the networks of the previously selected adapter possibly being shown after selecting another adapter while a scan was running. The adapter can't be changed while scanning or connecting. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed all networks and charts being removed if a refresh (manual, **Automatically update every** or after connecting) failed. The networks of the last scan stay, the error is shown below them. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From fad5f9c1763b47dffd07d8f4f1a58adc2cb259a1 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:01:45 +0100 Subject: [PATCH 19/66] Fix: WiFi: Hidden network in the disconnect message and the search (B17) The disconnect message used the empty SSID of a hidden network, and the search compared with the empty SSID instead of "Hidden Network" shown in the grid. GetDisplaySsid is used for both and for the chart series and legend (same logic before). Co-Authored-By: Claude Opus 5.5 --- .../ViewModels/WiFiViewModel.cs | 27 +++++++++++-------- Website/docs/changelog/next-release.md | 1 + 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 03f9888a4d..d981e0feb3 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -557,8 +557,9 @@ public WiFiViewModel() if (string.IsNullOrEmpty(Search)) return true; - // Search by SSID, authentication type, channel frequency, channel, BSSID, vendor and PHY kind - return info.AvailableNetwork.Ssid.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || + // Search by SSID ("Hidden Network" as shown), authentication type, channel frequency, channel, BSSID, + // vendor and PHY kind + return GetDisplaySsid(info).IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || info.NetworkAuthenticationType.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || $"{info.ChannelCenterFrequencyInGigahertz}".IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || $"{info.Channel}".IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || @@ -1103,13 +1104,11 @@ private static (LineSeries Series, WiFiChannelLegendEntry Lege var points = pointList.ToArray(); - var name = network.IsHidden - ? $"{Strings.HiddenNetwork} ({network.AvailableNetwork.Bssid})" - : $"{network.AvailableNetwork.Ssid} ({network.AvailableNetwork.Bssid})"; + var ssid = GetDisplaySsid(network); var series = new LineSeries { - Name = name, + Name = $"{ssid} ({network.AvailableNetwork.Bssid})", Values = points, // Plot in 0..100 space (dBm + 100) so the area fill drops to the bottom baseline. Mapping = (point, _) => new Coordinate(point.ChannelAxis, point.Dbm + SignalOffset), @@ -1120,12 +1119,19 @@ private static (LineSeries Series, WiFiChannelLegendEntry Lege }; var wpfColor = Color.FromArgb(color.Alpha, color.Red, color.Green, color.Blue); - var legendSsid = network.IsHidden ? Strings.HiddenNetwork : network.AvailableNetwork.Ssid; - var legend = new WiFiChannelLegendEntry(new SolidColorBrush(wpfColor), legendSsid, network.AvailableNetwork.Bssid); + var legend = new WiFiChannelLegendEntry(new SolidColorBrush(wpfColor), ssid, network.AvailableNetwork.Bssid); return (series, legend); } + /// + /// Gets the SSID of a network as shown in the grid ("Hidden Network" for a hidden network). + /// + private static string GetDisplaySsid(WiFiNetworkInfo network) + { + return network.IsHidden ? Strings.HiddenNetwork : network.AvailableNetwork.Ssid; + } + /// /// Converts a channel center frequency (MHz) to channel-number space for the chart X axis. /// This mapping is linear with frequency (5 MHz per unit). @@ -1295,8 +1301,7 @@ private async Task DisconnectAsync() if (connectedNetwork != null) { - ConnectionStatusMessage = string.Format(Strings.XXXDisconnected, - connectedNetwork.AvailableNetwork.Ssid); + ConnectionStatusMessage = string.Format(Strings.XXXDisconnected, GetDisplaySsid(connectedNetwork)); IsConnectionStatusMessageDisplayed = true; } } @@ -1305,7 +1310,7 @@ private async Task DisconnectAsync() Log.Error("Error while disconnecting the WiFi adapter.", ex); ConnectionStatusMessage = string.Format(Strings.CouldNotDisconnectFromXXXReasonXXX, - connectedNetwork?.AvailableNetwork.Ssid, ex.Message); + connectedNetwork == null ? null : GetDisplaySsid(connectedNetwork), ex.Message); IsConnectionStatusMessageDisplayed = true; } diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index f0bd1f1c1b..09d742e156 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -301,6 +301,7 @@ Release date: **xx.xx.2026** - Fixed sorting by the signal icon (first column) and by **Encryption** not changing the order of the networks. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the networks of the previously selected adapter possibly being shown after selecting another adapter while a scan was running. The adapter can't be changed while scanning or connecting. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed all networks and charts being removed if a refresh (manual, **Automatically update every** or after connecting) failed. The networks of the last scan stay, the error is shown below them. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the message after disconnecting from a hidden network missing the name (" disconnected!"), and the search not finding hidden networks by the shown text `Hidden Network`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From da9b21f5163ea0a204103c37c071ca8f10a3c554 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:02:43 +0100 Subject: [PATCH 20/66] Fix: WiFi: Adapter icon kept the state of the first load (B18) The up / down icon of the adapter selection was bound to NetworkInterfaceInfo.IsOperational, read once when the adapters were loaded, so it still showed "up" after a disconnect. WiFiAdapterInfo has a notifying IsOperational now, updated after each scan from the operational status of the network interfaces (cheap, without the PowerShell query of GetNetworkInterfaces). Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager.Models/Network/WiFi.cs | 20 +++++++++++++++- .../Network/WiFiAdapterInfo.cs | 23 +++++++++++++++++-- .../ViewModels/WiFiViewModel.cs | 3 +++ Source/NETworkManager/Views/WiFiView.xaml | 2 +- Website/docs/changelog/next-release.md | 1 + 5 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Source/NETworkManager.Models/Network/WiFi.cs b/Source/NETworkManager.Models/Network/WiFi.cs index bee2415052..148514f2e8 100644 --- a/Source/NETworkManager.Models/Network/WiFi.cs +++ b/Source/NETworkManager.Models/Network/WiFi.cs @@ -46,7 +46,8 @@ public static async Task> GetAdapterAsync() wifiAdapterInfos.Add(new WiFiAdapterInfo { NetworkInterfaceInfo = networkInterface, - WiFiAdapter = wiFiAdapter + WiFiAdapter = wiFiAdapter, + IsOperational = networkInterface.IsOperational }); else Log.Warn($"Could not find network interface for WiFi adapter with id: {wiFiAdapterId}"); @@ -55,6 +56,23 @@ public static async Task> GetAdapterAsync() return wifiAdapterInfos; } + /// + /// Updates of the adapters (e.g. after connecting or + /// disconnecting). Reads only the operational status of the network interfaces (fast), not all + /// their information like . + /// + /// Wi-Fi adapters to update. + public static void UpdateAdapterStates(IEnumerable adapters) + { + var states = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces() + .ToDictionary(x => x.Id, x => x.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up, + StringComparer.OrdinalIgnoreCase); + + foreach (var adapter in adapters) + if (states.TryGetValue(adapter.NetworkInterfaceInfo.Id, out var isOperational)) + adapter.IsOperational = isOperational; + } + /// /// Get all available Wi-Fi networks for an adapter with additional information's. /// diff --git a/Source/NETworkManager.Models/Network/WiFiAdapterInfo.cs b/Source/NETworkManager.Models/Network/WiFiAdapterInfo.cs index 46dfdd190d..134db6716e 100644 --- a/Source/NETworkManager.Models/Network/WiFiAdapterInfo.cs +++ b/Source/NETworkManager.Models/Network/WiFiAdapterInfo.cs @@ -1,9 +1,28 @@ -using Windows.Devices.WiFi; +using NETworkManager.Utilities; +using Windows.Devices.WiFi; namespace NETworkManager.Models.Network; -public class WiFiAdapterInfo +public class WiFiAdapterInfo : PropertyChangedBase { public NetworkInterfaceInfo NetworkInterfaceInfo { get; set; } public WiFiAdapter WiFiAdapter { get; set; } + + /// + /// Indicates if the adapter is up (connected to a network). Updated after each scan (see + /// ), is the state when the adapters + /// were loaded. + /// + public bool IsOperational + { + get; + set + { + if (value == field) + return; + + field = value; + OnPropertyChanged(); + } + } } \ No newline at end of file diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index d981e0feb3..b439dc3e1f 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -839,6 +839,9 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals Radio6GHzUpperLegend = [.. legend6GHzUpper]; LastRefreshTime = wiFiNetworkScanInfo.Timestamp; + + // Connected / disconnected (also outside of NETworkManager) - the icon of the adapter selection + WiFi.UpdateAdapterStates(Adapters); } catch (Exception ex) { diff --git a/Source/NETworkManager/Views/WiFiView.xaml b/Source/NETworkManager/Views/WiFiView.xaml index bcfbcb6471..ce48597609 100644 --- a/Source/NETworkManager/Views/WiFiView.xaml +++ b/Source/NETworkManager/Views/WiFiView.xaml @@ -96,7 +96,7 @@ Value="{DynamicResource ResourceKey=MahApps.Brushes.Gray3}" /> diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 09d742e156..9b8d5c6f9a 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -302,6 +302,7 @@ Release date: **xx.xx.2026** - Fixed the networks of the previously selected adapter possibly being shown after selecting another adapter while a scan was running. The adapter can't be changed while scanning or connecting. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed all networks and charts being removed if a refresh (manual, **Automatically update every** or after connecting) failed. The networks of the last scan stay, the error is shown below them. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the message after disconnecting from a hidden network missing the name (" disconnected!"), and the search not finding hidden networks by the shown text `Hidden Network`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the icon of the adapter selection (connected / disconnected) keeping the state of when the adapters were loaded. It is updated after each scan, e.g. after connecting or disconnecting. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 4e22c4cc90f6b516aedb5d18cf257d6392f0f8bb Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:03:24 +0100 Subject: [PATCH 21/66] Fix: WiFi: Refresh behind an open dialog (C2) F5, the adapter reload and the auto refresh didn't check for an open dialog (like the Connections or the IP Scanner do), so the list was replaced behind the connect or export dialog. They wait until it is closed now. Co-Authored-By: Claude Opus 5.5 --- .../ViewModels/WiFiViewModel.cs | 24 +++++++++++++++---- Website/docs/changelog/next-release.md | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index b439dc3e1f..ab34d18185 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -5,6 +5,7 @@ using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.Painting.Effects; using log4net; +using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Controls; using NETworkManager.Localization; @@ -572,10 +573,11 @@ public WiFiViewModel() _ = LoadAdaptersAsync(SettingsManager.Current.WiFi_InterfaceId); // Auto refresh - // Not without an adapter, or while networks are loading or a connection is made (tried again after the - // interval) + // Not without an adapter, while a dialog is open (e.g. connect), or while networks are loading or a connection + // is made (tried again after the interval) _autoRefreshTimer = new AutoRefreshTimer(() => ScanAsync(SelectedAdapter, true), - () => SelectedAdapter != null && !IsNetworksLoading && !IsBackgroundSearchRunning && !IsConnecting); + () => SelectedAdapter != null && !IsDialogOpen() && !IsNetworksLoading && !IsBackgroundSearchRunning && + !IsConnecting); AutoRefreshTimes = CollectionViewSource.GetDefaultView(AutoRefreshTime.GetDefaults); SelectedAutoRefreshTime = AutoRefreshTimes.Cast().FirstOrDefault(x => @@ -609,7 +611,18 @@ private void LoadSettings() private bool ReloadAdapter_CanExecute(object obj) { // Not blocked by the auto refresh (it only scans the networks): without an adapter its toggle is hidden - return !IsAdaptersLoading && !IsNetworksLoading && !IsBackgroundSearchRunning && !IsConnecting; + return !IsDialogOpen() && !IsAdaptersLoading && !IsNetworksLoading && !IsBackgroundSearchRunning && + !IsConnecting; + } + + /// + /// A dialog (e.g. connect, export) is open: no refresh behind it (F5), and no auto refresh. + /// + private static bool IsDialogOpen() + { + return Application.Current.MainWindow == null || + ((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen || + ConfigurationManager.Current.IsChildWindowOpen; } private void ReloadAdapterAction() @@ -622,7 +635,8 @@ private void ReloadAdapterAction() private bool ScanNetworks_CanExecute(object obj) { - return SelectedAdapter != null && !IsAdaptersLoading && !IsNetworksLoading && !IsBackgroundSearchRunning && !AutoRefreshEnabled && !IsConnecting; + return SelectedAdapter != null && !IsDialogOpen() && !IsAdaptersLoading && !IsNetworksLoading && + !IsBackgroundSearchRunning && !AutoRefreshEnabled && !IsConnecting; } private async Task ScanNetworksAction() diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 9b8d5c6f9a..485ae8d7d6 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -303,6 +303,7 @@ Release date: **xx.xx.2026** - Fixed all networks and charts being removed if a refresh (manual, **Automatically update every** or after connecting) failed. The networks of the last scan stay, the error is shown below them. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the message after disconnecting from a hidden network missing the name (" disconnected!"), and the search not finding hidden networks by the shown text `Hidden Network`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the icon of the adapter selection (connected / disconnected) keeping the state of when the adapters were loaded. It is updated after each scan, e.g. after connecting or disconnecting. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed `F5` scanning and **Automatically update every** refreshing the networks behind an open dialog (e.g. **Connect...** or **Export...**). The auto refresh waits until the dialog is closed. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From fe450a380a71cd411ccdeef940d2797d00a12b1e Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:06:44 +0100 Subject: [PATCH 22/66] Feature: WiFi: Check the access to the WiFi adapter again (C1, M2) The access was only requested in the constructor: after it was allowed in the Windows settings, the application had to be restarted. The constructor always sets up the list and the timers now; the adapters are loaded (and the auto refresh enabled) once the access is allowed, which is checked again by a Refresh button next to Open settings and when the view is shown again. Co-Authored-By: Claude Opus 5.5 --- .../ViewModels/WiFiViewModel.cs | 78 ++++++++++++------- Source/NETworkManager/Views/WiFiView.xaml | 58 +++++++++----- Website/docs/changelog/next-release.md | 1 + 3 files changed, 89 insertions(+), 48 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index ab34d18185..40a92a66cc 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -512,30 +512,10 @@ public WiFiViewModel() _isLoading = true; - // Set up the channel charts (axes, sections, paints) unconditionally so the chart bindings - // are never null, even on the code paths that return early below. + // Set up the channel charts (axes, sections, paints), the list and the timers unconditionally, so the + // bindings are never null - also if the WiFi API is not available or the access is denied (yet) InitializeCharts(); - // Check if Microsoft.Windows.SDK.Contracts is available - SdkContractAvailable = ApiInformation.IsTypePresent("Windows.Devices.WiFi.WiFiAdapter"); - - if (!SdkContractAvailable) - { - _isLoading = false; - - return; - } - - // Check if the access is denied and show a message - WiFiAdapterAccessEnabled = RequestAccess(); - - if (!WiFiAdapterAccessEnabled) - { - _isLoading = false; - - return; - } - // Result view + search NetworksView = CollectionViewSource.GetDefaultView(Networks); NetworksView.SortDescriptions.Add(new SortDescription( @@ -569,10 +549,7 @@ public WiFiViewModel() info.PhyKind.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1; }; - // Load network adapters - _ = LoadAdaptersAsync(SettingsManager.Current.WiFi_InterfaceId); - - // Auto refresh + // Auto refresh (enabled when the access is allowed, see Start) // Not without an adapter, while a dialog is open (e.g. connect), or while networks are loading or a connection // is made (tried again after the interval) _autoRefreshTimer = new AutoRefreshTimer(() => ScanAsync(SelectedAdapter, true), @@ -583,7 +560,6 @@ public WiFiViewModel() SelectedAutoRefreshTime = AutoRefreshTimes.Cast().FirstOrDefault(x => x.Value == SettingsManager.Current.WiFi_AutoRefreshTime.Value && x.TimeUnit == SettingsManager.Current.WiFi_AutoRefreshTime.TimeUnit); - AutoRefreshEnabled = SettingsManager.Current.WiFi_AutoRefreshEnabled; // Hide ConnectionStatusMessage automatically _hideConnectionStatusMessageTimer.Interval = new TimeSpan(0, 0, 15); @@ -592,9 +568,47 @@ public WiFiViewModel() // Load settings LoadSettings(); + // Check if Microsoft.Windows.SDK.Contracts is available + SdkContractAvailable = ApiInformation.IsTypePresent("Windows.Devices.WiFi.WiFiAdapter"); + + if (SdkContractAvailable) + { + // Check if the access is denied and show a message (checked again, see CheckAccess) + WiFiAdapterAccessEnabled = RequestAccess(); + + if (WiFiAdapterAccessEnabled) + Start(); + } + _isLoading = false; } + /// + /// Loads the adapters (scans the networks of the selected one) and enables the auto refresh. Called once the + /// access to the WiFi adapter is allowed. + /// + private void Start() + { + _ = LoadAdaptersAsync(SettingsManager.Current.WiFi_InterfaceId); + + AutoRefreshEnabled = SettingsManager.Current.WiFi_AutoRefreshEnabled; + } + + /// + /// Checks the access to the WiFi adapter again while it is denied (e.g. it was allowed in the Windows settings + /// after the message was shown), and starts if it is allowed now - without a restart of the application. + /// + private void CheckAccess() + { + if (!SdkContractAvailable || WiFiAdapterAccessEnabled) + return; + + WiFiAdapterAccessEnabled = RequestAccess(); + + if (WiFiAdapterAccessEnabled) + Start(); + } + private void LoadSettings() { Show2Dot4GHzNetworks = SettingsManager.Current.WiFi_Show2dot4GHzNetworks; @@ -674,6 +688,8 @@ private void ExportAction() _ = Export(); } + public ICommand CheckAccessCommand => new RelayCommand(_ => CheckAccess()); + public ICommand OpenSettingsCommand => new RelayCommand(_ => OpenSettingsAction()); private static void OpenSettingsAction() @@ -1387,13 +1403,15 @@ await DialogHelper.ShowMessageAsync(Application.Current.MainWindow, Strings.Erro public void OnViewVisible() { - // Not created if the WiFi API is not available or the access is denied (see constructor) - _autoRefreshTimer?.Resume(); + // The access may have been allowed in the Windows settings in the meantime + CheckAccess(); + + _autoRefreshTimer.Resume(); } public void OnViewHide() { - _autoRefreshTimer?.Pause(); + _autoRefreshTimer.Pause(); } #endregion diff --git a/Source/NETworkManager/Views/WiFiView.xaml b/Source/NETworkManager/Views/WiFiView.xaml index ce48597609..56bf1ebdf3 100644 --- a/Source/NETworkManager/Views/WiFiView.xaml +++ b/Source/NETworkManager/Views/WiFiView.xaml @@ -1028,24 +1028,46 @@ - + + + + + \ No newline at end of file diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 485ae8d7d6..08ab371d11 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -214,6 +214,7 @@ Release date: **xx.xx.2026** - The search filters after a short delay while typing instead of on every key press, `Enter` filters right away. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) - The time of the last scan of the networks (`Last scan at 14:32`, the date in the tooltip) is shown in their header, with **Automatically update every** a countdown to the next scan; the line below only shows errors and the connection status. Reloading the network adapters is faster (the minimum of 2.5 seconds runs while loading) and the reload icon spins until it is finished. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) - A channel width that could not be read from the beacon of the access point and is estimated is shown as `~80 MHz` (grid, copy and the tooltip of the **Channels** tab), the tooltip of the cell explains it. Estimated widths on 2.4 GHz are 20 MHz (40 MHz is rarely used there). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- After allowing the access to the WiFi adapter in the Windows settings (location), **Refresh** below the message (or switching back to WiFi) loads the adapters. A restart of the application is no longer needed. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From ff3984ff63d73eff93d1cdc34ab28f1e5c532849 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:07:22 +0100 Subject: [PATCH 23/66] Feature: WiFi: BSSID in the default MAC address format (C6) The BSSID was shown in the format of the WinRT API (lowercase), the IP Scanner and the other tools use MACAddressHelper.GetDefaultFormat (uppercase). WiFiNetworkInfo.Bssid has the formatted value; grid, copy, search, chart legend / tooltip and the export use it. Co-Authored-By: Claude Opus 5.5 --- .../Export/ExportManager.WiFiNetworkInfo.cs | 8 ++++---- Source/NETworkManager.Models/Network/WiFi.cs | 2 ++ Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs | 6 ++++++ .../Controls/LiveChartsWiFiChannelTooltip.xaml.cs | 2 +- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 6 +++--- Source/NETworkManager/Views/WiFiView.xaml | 6 +++--- Website/docs/changelog/next-release.md | 1 + 7 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs b/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs index 78e866df04..66cfc93e3b 100644 --- a/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs +++ b/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs @@ -47,11 +47,11 @@ private static void CreateCsv(IEnumerable collection, string fi var stringBuilder = new StringBuilder(); stringBuilder.AppendLine( - $"{nameof(WiFiNetworkInfo.AvailableNetwork.Bssid)},{nameof(WiFiNetworkInfo.AvailableNetwork.Ssid)},{nameof(WiFiNetworkInfo.AvailableNetwork.ChannelCenterFrequencyInKilohertz)},{nameof(WiFiNetworkInfo.AvailableNetwork.SignalBars)},{nameof(WiFiNetworkInfo.AvailableNetwork.IsWiFiDirect)},{nameof(WiFiNetworkInfo.AvailableNetwork.NetworkRssiInDecibelMilliwatts)},{nameof(WiFiNetworkInfo.AvailableNetwork.PhyKind)},{nameof(WiFiNetworkInfo.AvailableNetwork.NetworkKind)},{nameof(WiFiNetworkInfo.AvailableNetwork.SecuritySettings.NetworkAuthenticationType)},{nameof(WiFiNetworkInfo.AvailableNetwork.SecuritySettings.NetworkEncryptionType)},{nameof(WiFiNetworkInfo.AvailableNetwork.BeaconInterval)},{nameof(WiFiNetworkInfo.AvailableNetwork.Uptime)}"); + $"{nameof(WiFiNetworkInfo.Bssid)},{nameof(WiFiNetworkInfo.AvailableNetwork.Ssid)},{nameof(WiFiNetworkInfo.AvailableNetwork.ChannelCenterFrequencyInKilohertz)},{nameof(WiFiNetworkInfo.AvailableNetwork.SignalBars)},{nameof(WiFiNetworkInfo.AvailableNetwork.IsWiFiDirect)},{nameof(WiFiNetworkInfo.AvailableNetwork.NetworkRssiInDecibelMilliwatts)},{nameof(WiFiNetworkInfo.AvailableNetwork.PhyKind)},{nameof(WiFiNetworkInfo.AvailableNetwork.NetworkKind)},{nameof(WiFiNetworkInfo.AvailableNetwork.SecuritySettings.NetworkAuthenticationType)},{nameof(WiFiNetworkInfo.AvailableNetwork.SecuritySettings.NetworkEncryptionType)},{nameof(WiFiNetworkInfo.AvailableNetwork.BeaconInterval)},{nameof(WiFiNetworkInfo.AvailableNetwork.Uptime)}"); foreach (var info in collection) stringBuilder.AppendLine( - $"{info.AvailableNetwork.Bssid},{info.AvailableNetwork.Ssid},{info.AvailableNetwork.ChannelCenterFrequencyInKilohertz},{info.AvailableNetwork.SignalBars},{info.AvailableNetwork.IsWiFiDirect},{info.AvailableNetwork.NetworkRssiInDecibelMilliwatts},{info.AvailableNetwork.PhyKind},{info.AvailableNetwork.NetworkKind},{info.AvailableNetwork.SecuritySettings.NetworkAuthenticationType},{info.AvailableNetwork.SecuritySettings.NetworkEncryptionType},{info.AvailableNetwork.BeaconInterval},{info.AvailableNetwork.Uptime}"); + $"{info.Bssid},{info.AvailableNetwork.Ssid},{info.AvailableNetwork.ChannelCenterFrequencyInKilohertz},{info.AvailableNetwork.SignalBars},{info.AvailableNetwork.IsWiFiDirect},{info.AvailableNetwork.NetworkRssiInDecibelMilliwatts},{info.AvailableNetwork.PhyKind},{info.AvailableNetwork.NetworkKind},{info.AvailableNetwork.SecuritySettings.NetworkAuthenticationType},{info.AvailableNetwork.SecuritySettings.NetworkEncryptionType},{info.AvailableNetwork.BeaconInterval},{info.AvailableNetwork.Uptime}"); File.WriteAllText(filePath, stringBuilder.ToString()); } @@ -69,7 +69,7 @@ private static void CreateXml(IEnumerable collection, string fi from info in collection select new XElement(nameof(WiFiNetworkInfo), - new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.Bssid), info.AvailableNetwork.Bssid), + new XElement(nameof(WiFiNetworkInfo.Bssid), info.Bssid), new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.Ssid), info.AvailableNetwork.Ssid), new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.ChannelCenterFrequencyInKilohertz), info.AvailableNetwork.ChannelCenterFrequencyInKilohertz), @@ -109,7 +109,7 @@ private static void CreateJson(IReadOnlyList collection, string for (var i = 0; i < collection.Count; i++) jsonData[i] = new { - collection[i].AvailableNetwork.Bssid, + collection[i].Bssid, collection[i].AvailableNetwork.Ssid, collection[i].AvailableNetwork.ChannelCenterFrequencyInKilohertz, SignalBars = collection[i].AvailableNetwork.SignalBars.ToString(), diff --git a/Source/NETworkManager.Models/Network/WiFi.cs b/Source/NETworkManager.Models/Network/WiFi.cs index 148514f2e8..4be16e09fa 100644 --- a/Source/NETworkManager.Models/Network/WiFi.cs +++ b/Source/NETworkManager.Models/Network/WiFi.cs @@ -7,6 +7,7 @@ using Windows.Networking.Connectivity; using Windows.Security.Credentials; using NETworkManager.Models.Lookup; +using NETworkManager.Utilities; namespace NETworkManager.Models.Network; @@ -104,6 +105,7 @@ public static async Task GetNetworksAsync(WiFiAdapter adapt var wifiNetworkInfo = new WiFiNetworkInfo { AvailableNetwork = availableNetwork, + Bssid = MACAddressHelper.GetDefaultFormat(availableNetwork.Bssid), Radio = radio, ChannelCenterFrequencyInGigahertz = channelFrequencyInGigahertz, Channel = GetChannelFromChannelFrequency(channelFrequencyInGigahertz), diff --git a/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs b/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs index 3e520fb654..18bcc07e8d 100644 --- a/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs +++ b/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs @@ -22,6 +22,12 @@ public WiFiNetworkInfo() /// public WiFiAvailableNetwork AvailableNetwork { get; init; } + /// + /// BSSID (MAC address of the access point) in the default format of the application (e.g. + /// AA:BB:CC:DD:EE:FF), like the MAC addresses of the other tools. + /// + public string Bssid { get; init; } + /// /// Radio that is used like 2.4 GHz, 5 GHz, etc. /// diff --git a/Source/NETworkManager/Controls/LiveChartsWiFiChannelTooltip.xaml.cs b/Source/NETworkManager/Controls/LiveChartsWiFiChannelTooltip.xaml.cs index 4ffae4171c..cf07cc9d32 100644 --- a/Source/NETworkManager/Controls/LiveChartsWiFiChannelTooltip.xaml.cs +++ b/Source/NETworkManager/Controls/LiveChartsWiFiChannelTooltip.xaml.cs @@ -57,7 +57,7 @@ public void Show(IEnumerable tooltipPoints, Chart chart) continue; var ssid = network.IsHidden ? Strings.HiddenNetwork : network.AvailableNetwork.Ssid; - var bssid = network.AvailableNetwork.Bssid; + var bssid = network.Bssid; var dbm = $"{network.AvailableNetwork.NetworkRssiInDecibelMilliwatts} dBm"; var widthText = WiFiChannelBandwidthToStringConverter.Format(network); var channelDetail = $"{Strings.Channel} {network.Channel} · {widthText}"; diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 40a92a66cc..ab7cf79daa 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -544,7 +544,7 @@ public WiFiViewModel() info.NetworkAuthenticationType.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || $"{info.ChannelCenterFrequencyInGigahertz}".IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || $"{info.Channel}".IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || - info.AvailableNetwork.Bssid.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || + info.Bssid.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || info.Vendor.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || info.PhyKind.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1; }; @@ -1141,7 +1141,7 @@ private static (LineSeries Series, WiFiChannelLegendEntry Lege var series = new LineSeries { - Name = $"{ssid} ({network.AvailableNetwork.Bssid})", + Name = $"{ssid} ({network.Bssid})", Values = points, // Plot in 0..100 space (dBm + 100) so the area fill drops to the bottom baseline. Mapping = (point, _) => new Coordinate(point.ChannelAxis, point.Dbm + SignalOffset), @@ -1152,7 +1152,7 @@ private static (LineSeries Series, WiFiChannelLegendEntry Lege }; var wpfColor = Color.FromArgb(color.Alpha, color.Red, color.Green, color.Blue); - var legend = new WiFiChannelLegendEntry(new SolidColorBrush(wpfColor), ssid, network.AvailableNetwork.Bssid); + var legend = new WiFiChannelLegendEntry(new SolidColorBrush(wpfColor), ssid, network.Bssid); return (series, legend); } diff --git a/Source/NETworkManager/Views/WiFiView.xaml b/Source/NETworkManager/Views/WiFiView.xaml index 56bf1ebdf3..3292fa8844 100644 --- a/Source/NETworkManager/Views/WiFiView.xaml +++ b/Source/NETworkManager/Views/WiFiView.xaml @@ -359,7 +359,7 @@ Style="{StaticResource ResourceKey=CopyMenuItem}" /> Date: Sun, 8 Nov 2026 01:07:52 +0100 Subject: [PATCH 24/66] Feature: WiFi: Keep the networks while the adapters are reloaded (C8) Reloading the adapters selects a new instance of the same adapter, which started a scan with the full loading indicator in place of the grid. A scan of the same adapter is a background refresh now (like the auto refresh), only a different adapter shows the loading indicator. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 6 +++++- Website/docs/changelog/next-release.md | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index ab7cf79daa..ef15fc3e87 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -113,7 +113,11 @@ public WiFiAdapterInfo SelectedAdapter if (!_isLoading) SettingsManager.Current.WiFi_InterfaceId = value.NetworkInterfaceInfo.Id; - _ = ScanAsync(value); + // The same adapter after the adapters were reloaded: refresh in the background (the networks stay + // visible), another adapter: show the loading indicator instead of the networks of the previous one + var isSameAdapter = field != null && field.NetworkInterfaceInfo.Id == value.NetworkInterfaceInfo.Id; + + _ = ScanAsync(value, isSameAdapter); } field = value; diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 2e1166f4b6..dd9daf7c61 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -216,6 +216,7 @@ Release date: **xx.xx.2026** - A channel width that could not be read from the beacon of the access point and is estimated is shown as `~80 MHz` (grid, copy and the tooltip of the **Channels** tab), the tooltip of the cell explains it. Estimated widths on 2.4 GHz are 20 MHz (40 MHz is rarely used there). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - After allowing the access to the WiFi adapter in the Windows settings (location), **Refresh** below the message (or switching back to WiFi) loads the adapters. A restart of the application is no longer needed. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - The BSSID is shown, copied and exported in the same format as the MAC addresses of the other tools (`AA:BB:CC:DD:EE:FF` instead of `aa:bb:cc:dd:ee:ff`). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Reloading the adapters keeps the networks visible while they are scanned again (the refresh icon spins), instead of replacing them by the loading indicator. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 262cd74be5a59873bc0c398451c8149fcb764134 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:08:13 +0100 Subject: [PATCH 25/66] Fix: WiFi: Untranslated "Unknown" for security and PHY kind (O2) GetHumanReadableNetworkAuthenticationType / GetHumanReadablePhyKind returned the hard-coded English text "Unknown". The model has no access to the strings, so the placeholder for no value is used, like for an unknown vendor and the authentication type None. The technical terms (Open, WEP, WPA2 Personal (PSK), 802.11ax) stay. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager.Models/Network/WiFi.cs | 6 +++--- Website/docs/changelog/next-release.md | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/NETworkManager.Models/Network/WiFi.cs b/Source/NETworkManager.Models/Network/WiFi.cs index 4be16e09fa..c0f247e2b4 100644 --- a/Source/NETworkManager.Models/Network/WiFi.cs +++ b/Source/NETworkManager.Models/Network/WiFi.cs @@ -403,8 +403,8 @@ public static string GetHumanReadableNetworkAuthenticationType(NetworkAuthentica { return networkAuthenticationType switch { - NetworkAuthenticationType.None => "-/-", - NetworkAuthenticationType.Unknown => "Unknown", + // No value like an unknown vendor ("Unknown" is not translated in the model) + NetworkAuthenticationType.None or NetworkAuthenticationType.Unknown => "-/-", NetworkAuthenticationType.Open80211 => "Open", NetworkAuthenticationType.SharedKey80211 => "WEP", NetworkAuthenticationType.Wpa => "WPA Enterprise", @@ -430,7 +430,7 @@ public static string GetHumanReadablePhyKind(WiFiPhyKind phyKind) { return phyKind switch { - WiFiPhyKind.Unknown => "Unknown", + WiFiPhyKind.Unknown => "-/-", WiFiPhyKind.Dsss or WiFiPhyKind.Fhss => "802.11", WiFiPhyKind.Ofdm => "802.11a", WiFiPhyKind.Hrdsss => "802.11b", diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index dd9daf7c61..5b9f72cdb3 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -217,6 +217,7 @@ Release date: **xx.xx.2026** - After allowing the access to the WiFi adapter in the Windows settings (location), **Refresh** below the message (or switching back to WiFi) loads the adapters. A restart of the application is no longer needed. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - The BSSID is shown, copied and exported in the same format as the MAC addresses of the other tools (`AA:BB:CC:DD:EE:FF` instead of `aa:bb:cc:dd:ee:ff`). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Reloading the adapters keeps the networks visible while they are scanned again (the refresh icon spins), instead of replacing them by the loading indicator. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- An unknown security or PHY kind is shown as `-/-` (like an unknown vendor) instead of the untranslated text `Unknown`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From d93ce059fcbed1232d137ae1b115643100768c35 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:09:17 +0100 Subject: [PATCH 26/66] Refactor: WiFi: One field list for the CSV, XML and JSON export (R3) The CSV header, the CSV row, the XML elements and the JSON object each listed the same 12 values. One list of fields (name + value) drives all three formats now, like the export of the IP Scanner. Same columns, order and values per format (CSV / JSON text in the current culture, XML values as before). No unit test: WiFiAvailableNetwork (WinRT) can't be created outside of a scan. Co-Authored-By: Claude Opus 5.5 --- .../Export/ExportManager.WiFiNetworkInfo.cs | 98 +++++++++---------- 1 file changed, 47 insertions(+), 51 deletions(-) diff --git a/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs b/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs index 66cfc93e3b..bfa9da8798 100644 --- a/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs +++ b/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs @@ -12,6 +12,37 @@ namespace NETworkManager.Models.Export; public static partial class ExportManager { + /// + /// Exported column (CSV) / element (XML, JSON key) of a WiFi network, see . + /// + /// Name of the column / element. + /// Gets the value of a network (e.g. a string, a number, an enum or a time span). + private sealed record WiFiNetworkExportField(string Name, Func GetValue); + + /// + /// Exported values of a WiFi network - one list for CSV, XML and JSON. The released columns come first, new ones + /// are appended at the end, so the position of a column never changes. + /// + private static readonly WiFiNetworkExportField[] WiFiNetworkExportFields = + [ + new(nameof(WiFiNetworkInfo.Bssid), x => x.Bssid), + new(nameof(WiFiNetworkInfo.AvailableNetwork.Ssid), x => x.AvailableNetwork.Ssid), + new(nameof(WiFiNetworkInfo.AvailableNetwork.ChannelCenterFrequencyInKilohertz), + x => x.AvailableNetwork.ChannelCenterFrequencyInKilohertz), + new(nameof(WiFiNetworkInfo.AvailableNetwork.SignalBars), x => x.AvailableNetwork.SignalBars), + new(nameof(WiFiNetworkInfo.AvailableNetwork.IsWiFiDirect), x => x.AvailableNetwork.IsWiFiDirect), + new(nameof(WiFiNetworkInfo.AvailableNetwork.NetworkRssiInDecibelMilliwatts), + x => x.AvailableNetwork.NetworkRssiInDecibelMilliwatts), + new(nameof(WiFiNetworkInfo.AvailableNetwork.PhyKind), x => x.AvailableNetwork.PhyKind), + new(nameof(WiFiNetworkInfo.AvailableNetwork.NetworkKind), x => x.AvailableNetwork.NetworkKind), + new(nameof(WiFiNetworkInfo.AvailableNetwork.SecuritySettings.NetworkAuthenticationType), + x => x.AvailableNetwork.SecuritySettings.NetworkAuthenticationType), + new(nameof(WiFiNetworkInfo.AvailableNetwork.SecuritySettings.NetworkEncryptionType), + x => x.AvailableNetwork.SecuritySettings.NetworkEncryptionType), + new(nameof(WiFiNetworkInfo.AvailableNetwork.BeaconInterval), x => x.AvailableNetwork.BeaconInterval), + new(nameof(WiFiNetworkInfo.AvailableNetwork.Uptime), x => x.AvailableNetwork.Uptime) + ]; + /// /// Method to export objects from type to a file. /// @@ -46,12 +77,11 @@ private static void CreateCsv(IEnumerable collection, string fi { var stringBuilder = new StringBuilder(); - stringBuilder.AppendLine( - $"{nameof(WiFiNetworkInfo.Bssid)},{nameof(WiFiNetworkInfo.AvailableNetwork.Ssid)},{nameof(WiFiNetworkInfo.AvailableNetwork.ChannelCenterFrequencyInKilohertz)},{nameof(WiFiNetworkInfo.AvailableNetwork.SignalBars)},{nameof(WiFiNetworkInfo.AvailableNetwork.IsWiFiDirect)},{nameof(WiFiNetworkInfo.AvailableNetwork.NetworkRssiInDecibelMilliwatts)},{nameof(WiFiNetworkInfo.AvailableNetwork.PhyKind)},{nameof(WiFiNetworkInfo.AvailableNetwork.NetworkKind)},{nameof(WiFiNetworkInfo.AvailableNetwork.SecuritySettings.NetworkAuthenticationType)},{nameof(WiFiNetworkInfo.AvailableNetwork.SecuritySettings.NetworkEncryptionType)},{nameof(WiFiNetworkInfo.AvailableNetwork.BeaconInterval)},{nameof(WiFiNetworkInfo.AvailableNetwork.Uptime)}"); + stringBuilder.AppendLine(string.Join(",", WiFiNetworkExportFields.Select(field => field.Name))); foreach (var info in collection) - stringBuilder.AppendLine( - $"{info.Bssid},{info.AvailableNetwork.Ssid},{info.AvailableNetwork.ChannelCenterFrequencyInKilohertz},{info.AvailableNetwork.SignalBars},{info.AvailableNetwork.IsWiFiDirect},{info.AvailableNetwork.NetworkRssiInDecibelMilliwatts},{info.AvailableNetwork.PhyKind},{info.AvailableNetwork.NetworkKind},{info.AvailableNetwork.SecuritySettings.NetworkAuthenticationType},{info.AvailableNetwork.SecuritySettings.NetworkEncryptionType},{info.AvailableNetwork.BeaconInterval},{info.AvailableNetwork.Uptime}"); + stringBuilder.AppendLine(string.Join(",", WiFiNetworkExportFields.Select(field => + Convert.ToString(field.GetValue(info), CultureInfo.CurrentCulture)))); File.WriteAllText(filePath, stringBuilder.ToString()); } @@ -67,32 +97,9 @@ private static void CreateXml(IEnumerable collection, string fi new XElement(ApplicationName.WiFi.ToString(), new XElement(nameof(WiFiNetworkInfo) + "s", from info in collection - select - new XElement(nameof(WiFiNetworkInfo), - new XElement(nameof(WiFiNetworkInfo.Bssid), info.Bssid), - new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.Ssid), info.AvailableNetwork.Ssid), - new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.ChannelCenterFrequencyInKilohertz), - info.AvailableNetwork.ChannelCenterFrequencyInKilohertz), - new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.SignalBars), - info.AvailableNetwork.SignalBars), - new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.IsWiFiDirect), - info.AvailableNetwork.IsWiFiDirect), - new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.NetworkRssiInDecibelMilliwatts), - info.AvailableNetwork.NetworkRssiInDecibelMilliwatts), - new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.PhyKind), - info.AvailableNetwork.PhyKind), - new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.NetworkKind), - info.AvailableNetwork.NetworkKind), - new XElement( - nameof(WiFiNetworkInfo.AvailableNetwork.SecuritySettings.NetworkAuthenticationType), - info.AvailableNetwork.SecuritySettings.NetworkAuthenticationType), - new XElement( - nameof(WiFiNetworkInfo.AvailableNetwork.SecuritySettings.NetworkEncryptionType), - info.AvailableNetwork.SecuritySettings.NetworkEncryptionType), - new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.BeaconInterval), - info.AvailableNetwork.BeaconInterval), - new XElement(nameof(WiFiNetworkInfo.AvailableNetwork.Uptime), - info.AvailableNetwork.Uptime))))); + select new XElement(nameof(WiFiNetworkInfo), + from field in WiFiNetworkExportFields + select new XElement(field.Name, field.GetValue(info)))))); document.Save(filePath); } @@ -104,28 +111,17 @@ from info in collection /// Path to the export file. private static void CreateJson(IReadOnlyList collection, string filePath) { - var jsonData = new object[collection.Count]; - - for (var i = 0; i < collection.Count; i++) - jsonData[i] = new + var jsonData = collection + .Select(info => WiFiNetworkExportFields.ToDictionary(field => field.Name, field => { - collection[i].Bssid, - collection[i].AvailableNetwork.Ssid, - collection[i].AvailableNetwork.ChannelCenterFrequencyInKilohertz, - SignalBars = collection[i].AvailableNetwork.SignalBars.ToString(), - IsWiFiDirect = collection[i].AvailableNetwork.IsWiFiDirect.ToString(), - NetworkRssiInDecibelMilliwatts = collection[i].AvailableNetwork.NetworkRssiInDecibelMilliwatts - .ToString(CultureInfo.CurrentCulture), - PhyKind = collection[i].AvailableNetwork.PhyKind.ToString(), - NetworkKind = collection[i].AvailableNetwork.NetworkKind.ToString(), - NetworkAuthenticationType = - collection[i].AvailableNetwork.SecuritySettings.NetworkAuthenticationType.ToString(), - NetworkEncryptionType = - collection[i].AvailableNetwork.SecuritySettings.NetworkEncryptionType.ToString(), - BeaconInterval = collection[i].AvailableNetwork.BeaconInterval.ToString(), - Uptime = collection[i].AvailableNetwork.Uptime.ToString() - }; + var value = field.GetValue(info); + + // Numbers (frequency) and text as they are, other values (enums, time spans, signal bars, RSSI) as + // text like in the CSV file + return value is int or string ? value : Convert.ToString(value, CultureInfo.CurrentCulture); + })) + .ToArray(); File.WriteAllText(filePath, JsonConvert.SerializeObject(jsonData, Formatting.Indented)); } -} \ No newline at end of file +} From 76cb868c8c15ce8228974e01da7a13afd18cef1c Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:09:29 +0100 Subject: [PATCH 27/66] Feature: WiFi: Export channel, channel width, vendor, connected, security (M1) The export lacked the values the grid shows next to the ones of the WinRT API: IsConnected, Security (human-readable authentication), Channel, ChannelWidth, ChannelWidthEstimated and Vendor. They are appended at the end, the existing columns keep their position. Co-Authored-By: Claude Opus 5.5 --- .../Export/ExportManager.WiFiNetworkInfo.cs | 11 ++++++++++- Website/docs/changelog/next-release.md | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs b/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs index bfa9da8798..e22bac0401 100644 --- a/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs +++ b/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs @@ -40,7 +40,16 @@ private sealed record WiFiNetworkExportField(string Name, Func x.AvailableNetwork.SecuritySettings.NetworkEncryptionType), new(nameof(WiFiNetworkInfo.AvailableNetwork.BeaconInterval), x => x.AvailableNetwork.BeaconInterval), - new(nameof(WiFiNetworkInfo.AvailableNetwork.Uptime), x => x.AvailableNetwork.Uptime) + new(nameof(WiFiNetworkInfo.AvailableNetwork.Uptime), x => x.AvailableNetwork.Uptime), + // Values shown in the grid + new(nameof(WiFiNetworkInfo.IsConnected), x => x.IsConnected), + // Human-readable authentication type (e.g. "WPA2 Personal (PSK)") + new("Security", x => x.NetworkAuthenticationType), + new(nameof(WiFiNetworkInfo.Channel), x => x.Channel), + // MHz, estimated if the width could not be read from the beacon + new("ChannelWidth", x => x.ChannelBandwidth), + new("ChannelWidthEstimated", x => x.IsChannelBandwidthEstimated), + new(nameof(WiFiNetworkInfo.Vendor), x => x.Vendor) ]; /// diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 5b9f72cdb3..ee8a310309 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -218,6 +218,7 @@ Release date: **xx.xx.2026** - The BSSID is shown, copied and exported in the same format as the MAC addresses of the other tools (`AA:BB:CC:DD:EE:FF` instead of `aa:bb:cc:dd:ee:ff`). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Reloading the adapters keeps the networks visible while they are scanned again (the refresh icon spins), instead of replacing them by the loading indicator. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - An unknown security or PHY kind is shown as `-/-` (like an unknown vendor) instead of the untranslated text `Unknown`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- The export contains the values shown in the grid that were missing: `IsConnected`, `Security`, `Channel`, `ChannelWidth` (MHz), `ChannelWidthEstimated` and `Vendor` (appended as the last columns / elements). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From c7764d5e1f9acbd9dfed7f61d53134691b124980 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:09:55 +0100 Subject: [PATCH 28/66] Fix: WiFi: SSID with a comma broke the CSV export (O1) The CSV values were not quoted, so an SSID with a comma or a quote shifted the columns of its row. The text values (SSID, security, vendor) are quoted with CsvHelper.QuoteString, like in the other exports. Co-Authored-By: Claude Opus 5.5 --- .../Export/ExportManager.WiFiNetworkInfo.cs | 19 ++++++++++++++----- Website/docs/changelog/next-release.md | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs b/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs index e22bac0401..9ed3f9a1a9 100644 --- a/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs +++ b/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs @@ -6,6 +6,7 @@ using System.Text; using System.Xml.Linq; using NETworkManager.Models.Network; +using NETworkManager.Utilities; using Newtonsoft.Json; namespace NETworkManager.Models.Export; @@ -17,7 +18,11 @@ public static partial class ExportManager /// /// Name of the column / element. /// Gets the value of a network (e.g. a string, a number, an enum or a time span). - private sealed record WiFiNetworkExportField(string Name, Func GetValue); + /// The value is quoted in the CSV file (text that may contain a comma, e.g. the SSID). + private sealed record WiFiNetworkExportField( + string Name, + Func GetValue, + bool IsQuoted = false); /// /// Exported values of a WiFi network - one list for CSV, XML and JSON. The released columns come first, new ones @@ -26,7 +31,7 @@ private sealed record WiFiNetworkExportField(string Name, Func x.Bssid), - new(nameof(WiFiNetworkInfo.AvailableNetwork.Ssid), x => x.AvailableNetwork.Ssid), + new(nameof(WiFiNetworkInfo.AvailableNetwork.Ssid), x => x.AvailableNetwork.Ssid, true), new(nameof(WiFiNetworkInfo.AvailableNetwork.ChannelCenterFrequencyInKilohertz), x => x.AvailableNetwork.ChannelCenterFrequencyInKilohertz), new(nameof(WiFiNetworkInfo.AvailableNetwork.SignalBars), x => x.AvailableNetwork.SignalBars), @@ -44,12 +49,12 @@ private sealed record WiFiNetworkExportField(string Name, Func x.IsConnected), // Human-readable authentication type (e.g. "WPA2 Personal (PSK)") - new("Security", x => x.NetworkAuthenticationType), + new("Security", x => x.NetworkAuthenticationType, true), new(nameof(WiFiNetworkInfo.Channel), x => x.Channel), // MHz, estimated if the width could not be read from the beacon new("ChannelWidth", x => x.ChannelBandwidth), new("ChannelWidthEstimated", x => x.IsChannelBandwidthEstimated), - new(nameof(WiFiNetworkInfo.Vendor), x => x.Vendor) + new(nameof(WiFiNetworkInfo.Vendor), x => x.Vendor, true) ]; /// @@ -90,7 +95,11 @@ private static void CreateCsv(IEnumerable collection, string fi foreach (var info in collection) stringBuilder.AppendLine(string.Join(",", WiFiNetworkExportFields.Select(field => - Convert.ToString(field.GetValue(info), CultureInfo.CurrentCulture)))); + { + var value = Convert.ToString(field.GetValue(info), CultureInfo.CurrentCulture); + + return field.IsQuoted ? CsvHelper.QuoteString(value) : value; + }))); File.WriteAllText(filePath, stringBuilder.ToString()); } diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index ee8a310309..c58d1163cd 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -309,6 +309,7 @@ Release date: **xx.xx.2026** - Fixed the message after disconnecting from a hidden network missing the name (" disconnected!"), and the search not finding hidden networks by the shown text `Hidden Network`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the icon of the adapter selection (connected / disconnected) keeping the state of when the adapters were loaded. It is updated after each scan, e.g. after connecting or disconnecting. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed `F5` scanning and **Automatically update every** refreshing the networks behind an open dialog (e.g. **Connect...** or **Export...**). The auto refresh waits until the dialog is closed. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the CSV export breaking the row of a network whose SSID contains a comma or a quote. SSID, security and vendor are quoted. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From fa50298c42f6a5abfe75955b75a414c2b064fc84 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:10:27 +0100 Subject: [PATCH 29/66] Feature: WiFi: Export the shown networks in grid order (C5) Export all wrote every scanned network (also the bands hidden by the filter and the networks hidden by the search) in scan order, selected networks in click order, on the UI thread. Like the IP Scanner, the filtered view is exported in its order (selected ones too) and the file is written in Task.Run. Co-Authored-By: Claude Opus 5.5 --- .../ViewModels/WiFiViewModel.cs | 22 ++++++++++++++----- Website/docs/changelog/next-release.md | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index ef15fc3e87..bc245dc57b 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -1359,6 +1359,16 @@ private async Task DisconnectAsync() await ScanAsync(SelectedAdapter, true, GlobalStaticConfiguration.ApplicationUIRefreshInterval); } + /// + /// Gets the selected networks in the order they are shown in the grid (not in the order they were selected). + /// + private List GetSelectedNetworksInGridOrder() + { + var selectedNetworks = new HashSet(SelectedNetworks.Cast()); + + return NetworksView.Cast().Where(selectedNetworks.Contains).ToList(); + } + private Task Export() { var childWindow = new ExportChildWindow(); @@ -1370,11 +1380,13 @@ private Task Export() try { - ExportManager.Export(instance.FilePath, instance.FileType, - instance.ExportAll - ? Networks - : new ObservableCollection(SelectedNetworks.Cast() - .ToArray())); + // The networks shown in the grid (band filter, search) in their order. Copied on the UI thread, exported + // in the background + var networks = instance.ExportAll + ? NetworksView.Cast().ToList() + : GetSelectedNetworksInGridOrder(); + + await Task.Run(() => ExportManager.Export(instance.FilePath, instance.FileType, networks)); } catch (Exception ex) { diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index c58d1163cd..1048e1cfc8 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -219,6 +219,7 @@ Release date: **xx.xx.2026** - Reloading the adapters keeps the networks visible while they are scanned again (the refresh icon spins), instead of replacing them by the loading indicator. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - An unknown security or PHY kind is shown as `-/-` (like an unknown vendor) instead of the untranslated text `Unknown`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - The export contains the values shown in the grid that were missing: `IsConnected`, `Security`, `Channel`, `ChannelWidth` (MHz), `ChannelWidthEstimated` and `Vendor` (appended as the last columns / elements). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- **Export...** > all exports the networks shown in the grid (filtered by band and search) in the order shown, the selected networks are exported in the order shown too. The file is written in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 86c128ae9ca570626322f2b1d90d1a301eb5599b Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:11:34 +0100 Subject: [PATCH 30/66] Fix: WiFi: Connected network via the WiFi API instead of netsh (P1, B12, B15) Every scan ran "netsh wlan show interfaces" in a new PowerShell instance synchronously on the UI thread (after await ScanAsync), and parsed its (localized) text: the window froze briefly every scan, an exception of PowerShell ended the whole scan (B15), and with several adapters the lines of the next adapter were read if the scanned one was not connected (B12). WlanApi.GetConnectedBssid reads the BSSID with WlanQueryInterface (wlan_intf_opcode_current_connection); null if not connected or on an error. Everything after adapter.ScanAsync (native calls, OUI lookups, now synchronous) runs in Task.Run. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager.Models/Network/WiFi.cs | 89 ++++--------------- .../NETworkManager.Models/Network/WlanApi.cs | 62 +++++++++++++ Website/docs/changelog/next-release.md | 2 + 3 files changed, 83 insertions(+), 70 deletions(-) diff --git a/Source/NETworkManager.Models/Network/WiFi.cs b/Source/NETworkManager.Models/Network/WiFi.cs index c0f247e2b4..5938557455 100644 --- a/Source/NETworkManager.Models/Network/WiFi.cs +++ b/Source/NETworkManager.Models/Network/WiFi.cs @@ -84,13 +84,27 @@ public static async Task GetNetworksAsync(WiFiAdapter adapt // Scan network adapter async await adapter.ScanAsync(); - // Try to get the current connected Wi-Fi network of this network adapter - var (_, bssid) = TryGetConnectedNetworkFromWiFiAdapter(adapter.NetworkAdapter.NetworkAdapterId.ToString()); + // The rest (native calls, vendor lookups) runs in the background - the caller continues on the UI thread + // after ScanAsync + return await Task.Run(() => CreateScanInfo(adapter)); + } + + /// + /// Creates the result of a scan from the network report of the adapter. + /// + /// WiFi adapter as after the scan. + /// A report as including a list of . + private static WiFiNetworkScanInfo CreateScanInfo(WiFiAdapter adapter) + { + var adapterId = adapter.NetworkAdapter.NetworkAdapterId; + + // BSSID of the network this adapter is connected to (null if not connected or not read) + var bssid = WlanApi.GetConnectedBssid(adapterId); // The WinRT API does not expose the channel bandwidth (and its center), so it is read from the // native BSS list (wlanapi.dll) and matched by BSSID below. Failures yield an empty map and we // fall back to a heuristic per network. - var channels = WlanApi.GetBssChannels(adapter.NetworkAdapter.NetworkAdapterId); + var channels = WlanApi.GetBssChannels(adapterId); var wifiNetworkInfos = new List(); @@ -115,7 +129,7 @@ public static async Task GetNetworksAsync(WiFiAdapter adapt IsHidden = string.IsNullOrEmpty(availableNetwork.Ssid), IsConnected = availableNetwork.Bssid.Equals(bssid, StringComparison.OrdinalIgnoreCase), NetworkAuthenticationType = GetHumanReadableNetworkAuthenticationType(availableNetwork.SecuritySettings.NetworkAuthenticationType), - Vendor = (await OUILookup.LookupByMacAddressAsync(availableNetwork.Bssid)).FirstOrDefault()?.Vendor ?? "-/-", + Vendor = OUILookup.LookupByMacAddress(availableNetwork.Bssid).FirstOrDefault()?.Vendor ?? "-/-", PhyKind = GetHumanReadablePhyKind(availableNetwork.PhyKind) }; @@ -124,77 +138,12 @@ public static async Task GetNetworksAsync(WiFiAdapter adapt return new WiFiNetworkScanInfo { - NetworkAdapterId = adapter.NetworkAdapter.NetworkAdapterId, + NetworkAdapterId = adapterId, WiFiNetworkInfos = wifiNetworkInfos, Timestamp = adapter.NetworkReport.Timestamp.LocalDateTime }; } - /// - /// Try to get the current connected Wi-Fi network (SSID and BSSID) of a network adapter from - /// netsh.exe. - /// Calling netsh.exe and parsing the output feels so dirty, but Microsoft's API returns only - /// the WLAN profile and the SSID of the connected network. The BSSID is needed to find a - /// specific access point among several. - /// - /// GUID of the Wi-Fi network adapter. - /// SSID and BSSID of the connected Wi-Fi network. Values are null if not detected. - // ReSharper disable once UnusedTupleComponentInReturnValue - private static (string SSID, string BSSID) TryGetConnectedNetworkFromWiFiAdapter(string adapterId) - { - string ssid = null; - string bssid = null; - - using (var powerShell = System.Management.Automation.PowerShell.Create()) - { - powerShell.AddScript("netsh wlan show interfaces"); - - var psOutputs = powerShell.Invoke(); - - /* - if (powerShell.Streams.Error.Count > 0) { // Handle error? } - if (powerShell.Streams.Warning.Count > 0) { // Handle warning? } - */ - - /* Each object looks like this: - * - * Name : Wireless - * Description : Intel ... - * GUID : 90d8... - * SSID : Devices - * BSSID : 6a:d7:... - */ - - var foundAdapter = false; - - foreach (var outputItem in psOutputs) - { - // Find line with the network adapter id... - if (outputItem.ToString().Contains(adapterId, StringComparison.OrdinalIgnoreCase)) - foundAdapter = true; - - // ...and skip all lines until we found it. - if (!foundAdapter) - continue; - - // Extract SSID from the line - if (outputItem.ToString().Contains(" SSID ", StringComparison.OrdinalIgnoreCase)) - ssid = outputItem.ToString().Split(':')[1].Trim(); - - // Extract BSSID from the line - if (outputItem.ToString().Contains(" BSSID ", StringComparison.OrdinalIgnoreCase)) - bssid = outputItem.ToString().Split(':', 2)[1].Trim(); - - // Break if we got the values, otherwise we might overwrite them - // with values from another adapter. - if (!string.IsNullOrEmpty(ssid) && !string.IsNullOrEmpty(bssid)) - break; - } - } - - return (ssid, bssid); - } - /// /// Connect to a Wi-Fi network with Pre-shared key, EAP or no security. /// diff --git a/Source/NETworkManager.Models/Network/WlanApi.cs b/Source/NETworkManager.Models/Network/WlanApi.cs index 6288124dba..cee19bb33c 100644 --- a/Source/NETworkManager.Models/Network/WlanApi.cs +++ b/Source/NETworkManager.Models/Network/WlanApi.cs @@ -26,6 +26,13 @@ public static class WlanApi private const uint WlanApiVersion2 = 0x00000002; private const uint ErrorSuccess = 0; + // WLAN_INTF_OPCODE wlan_intf_opcode_current_connection: WLAN_CONNECTION_ATTRIBUTES of the interface. + private const uint WlanIntfOpcodeCurrentConnection = 7; + + // Offset of WLAN_ASSOCIATION_ATTRIBUTES.dot11Bssid in WLAN_CONNECTION_ATTRIBUTES: isState (4), wlanConnectionMode + // (4), strProfileName (WCHAR[256] = 512), dot11Ssid (4 + 32), dot11BssType (4). + private const int ConnectionAttributesBssidOffset = 4 + 4 + 512 + 36 + 4; + // 802.11 information element identifiers. private const byte EidHtOperation = 61; private const byte EidVhtOperation = 192; @@ -66,6 +73,10 @@ private static extern uint WlanGetNetworkBssList(IntPtr hClientHandle, ref Guid IntPtr pDot11Ssid, DOT11_BSS_TYPE dot11BssType, [MarshalAs(UnmanagedType.Bool)] bool bSecurityEnabled, IntPtr pReserved, out IntPtr ppWlanBssList); + [DllImport("wlanapi.dll")] + private static extern uint WlanQueryInterface(IntPtr hClientHandle, ref Guid pInterfaceGuid, uint opCode, + IntPtr pReserved, out uint pdwDataSize, out IntPtr ppData, IntPtr pWlanOpcodeValueType); + [DllImport("wlanapi.dll")] private static extern uint WlanEnumInterfaces(IntPtr hClientHandle, IntPtr pReserved, out IntPtr ppInterfaceList); @@ -176,6 +187,57 @@ public static Dictionary GetBssChannels(Guid interfaceGu return result; } + /// + /// Returns the BSSID (lowercase, colon-separated, e.g. aa:bb:cc:dd:ee:ff) of the access point the + /// given Wi-Fi interface is connected to. + /// + /// GUID of the Wi-Fi interface (NetworkAdapter.NetworkAdapterId). + /// The BSSID, or null if the interface is not connected or it could not be read. + public static string GetConnectedBssid(Guid interfaceGuid) + { + var clientHandle = IntPtr.Zero; + var dataPtr = IntPtr.Zero; + + try + { + var ret = WlanOpenHandle(WlanApiVersion2, IntPtr.Zero, out _, out clientHandle); + + if (ret != ErrorSuccess) + { + Log.Warn($"WlanOpenHandle failed with error code {ret}."); + return null; + } + + var guid = interfaceGuid; + + // Fails with ERROR_INVALID_STATE (5023) if the interface is not connected + ret = WlanQueryInterface(clientHandle, ref guid, WlanIntfOpcodeCurrentConnection, IntPtr.Zero, + out var dataSize, out dataPtr, IntPtr.Zero); + + if (ret != ErrorSuccess || dataPtr == IntPtr.Zero || dataSize < ConnectionAttributesBssidOffset + 6) + return null; + + var bssid = new byte[6]; + Marshal.Copy(IntPtr.Add(dataPtr, ConnectionAttributesBssidOffset), bssid, 0, 6); + + return FormatBssid(bssid); + } + catch (Exception ex) + { + Log.Error("Error while reading the connected Wi-Fi network via wlanapi.dll.", ex); + + return null; + } + finally + { + if (dataPtr != IntPtr.Zero) + WlanFreeMemory(dataPtr); + + if (clientHandle != IntPtr.Zero) + WlanCloseHandle(clientHandle, IntPtr.Zero); + } + } + /// /// Queries the BSS list for a single WLAN interface and adds the parsed channels to /// . Returns if the query succeeded. diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 1048e1cfc8..9c425ba1db 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -220,6 +220,7 @@ Release date: **xx.xx.2026** - An unknown security or PHY kind is shown as `-/-` (like an unknown vendor) instead of the untranslated text `Unknown`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - The export contains the values shown in the grid that were missing: `IsConnected`, `Security`, `Channel`, `ChannelWidth` (MHz), `ChannelWidthEstimated` and `Vendor` (appended as the last columns / elements). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - **Export...** > all exports the networks shown in the grid (filtered by band and search) in the order shown, the selected networks are exported in the order shown too. The file is written in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Scanning the networks (also **Automatically update every**) no longer freezes the window briefly: the connected network is read from the WiFi API instead of `netsh` via PowerShell, and the vendor lookups run in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** @@ -311,6 +312,7 @@ Release date: **xx.xx.2026** - Fixed the icon of the adapter selection (connected / disconnected) keeping the state of when the adapters were loaded. It is updated after each scan, e.g. after connecting or disconnecting. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed `F5` scanning and **Automatically update every** refreshing the networks behind an open dialog (e.g. **Connect...** or **Export...**). The auto refresh waits until the dialog is closed. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the CSV export breaking the row of a network whose SSID contains a comma or a quote. SSID, security and vendor are quoted. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed a network being marked as **Connected** that the selected adapter isn't connected to, if the computer has several WiFi adapters and the selected one was disconnected. An error while reading the connected network no longer ends the scan. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 4622b35ca411a65ea138227253f54602240f85b2 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:12:00 +0100 Subject: [PATCH 31/66] Refactor: WiFi: Remove dead code (R4) WiFiNetworkScanInfo.NetworkAdapterId was set but never read, the constructors of WiFiNetworkInfo / WiFiNetworkScanInfo were empty. The file of WiFiNetworkScanInfo had a typo in its name (WiFiNetworkScannfo). Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager.Models/Network/WiFi.cs | 1 - .../NETworkManager.Models/Network/WiFiNetworkInfo.cs | 8 -------- ...{WiFiNetworkScannfo.cs => WiFiNetworkScanInfo.cs} | 12 ------------ 3 files changed, 21 deletions(-) rename Source/NETworkManager.Models/Network/{WiFiNetworkScannfo.cs => WiFiNetworkScanInfo.cs} (65%) diff --git a/Source/NETworkManager.Models/Network/WiFi.cs b/Source/NETworkManager.Models/Network/WiFi.cs index 5938557455..6571f77c89 100644 --- a/Source/NETworkManager.Models/Network/WiFi.cs +++ b/Source/NETworkManager.Models/Network/WiFi.cs @@ -138,7 +138,6 @@ private static WiFiNetworkScanInfo CreateScanInfo(WiFiAdapter adapter) return new WiFiNetworkScanInfo { - NetworkAdapterId = adapterId, WiFiNetworkInfos = wifiNetworkInfos, Timestamp = adapter.NetworkReport.Timestamp.LocalDateTime }; diff --git a/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs b/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs index 18bcc07e8d..b68219497e 100644 --- a/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs +++ b/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs @@ -7,14 +7,6 @@ namespace NETworkManager.Models.Network; /// public class WiFiNetworkInfo { - /// - /// /// Create an instance of . - /// - public WiFiNetworkInfo() - { - - } - #region Variables /// diff --git a/Source/NETworkManager.Models/Network/WiFiNetworkScannfo.cs b/Source/NETworkManager.Models/Network/WiFiNetworkScanInfo.cs similarity index 65% rename from Source/NETworkManager.Models/Network/WiFiNetworkScannfo.cs rename to Source/NETworkManager.Models/Network/WiFiNetworkScanInfo.cs index d5f2c389b2..231bbfa459 100644 --- a/Source/NETworkManager.Models/Network/WiFiNetworkScannfo.cs +++ b/Source/NETworkManager.Models/Network/WiFiNetworkScanInfo.cs @@ -8,20 +8,8 @@ namespace NETworkManager.Models.Network; /// public class WiFiNetworkScanInfo { - /// - /// Create an instance of . - /// - public WiFiNetworkScanInfo() - { - } - #region Variables - /// - /// If of the network adapter who performed the scan. - /// - public Guid NetworkAdapterId { get; set; } - /// /// List of available WiFi networks on the network adapter. /// From b85e2fc22218023732e44aa9f1ae3e1081184185 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:13:35 +0100 Subject: [PATCH 32/66] Feature: WiFi: Keep the selected network when scanning again (P2, C4) Every scan cleared the networks and added them one by one into the sorted view, so the selection and the position in the list were lost every 30 s with the auto refresh. Like the Firewall, the networks are replaced with one notification (ObservableRangeCollection.ReplaceAll) and the selected network is selected again by its BSSID (if it is still shown) and scrolled into view. Co-Authored-By: Claude Opus 5.5 --- .../ViewModels/WiFiViewModel.cs | 26 +++++++++++------- Source/NETworkManager/Views/WiFiView.xaml.cs | 27 ++++++++++++++++++- Website/docs/changelog/next-release.md | 1 + 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index bc245dc57b..5cbce404aa 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -288,7 +288,7 @@ public bool Show6GHzNetworks } } - public ObservableCollection Networks + public ObservableRangeCollection Networks { get; init @@ -806,11 +806,22 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals Log.Debug("ScanAsync - Scan completed. Found " + wiFiNetworkScanInfo.WiFiNetworkInfos.Count + " networks."); - // Clear the values after the scan to make the UI smoother - Log.Debug("ScanAsync - Clearing old values..."); - Networks.Clear(); + // Remember the selected network, because replacing the networks clears the selection + var selectedBssid = SelectedNetwork?.Bssid; + + // Replace all networks with a single notification, so the view is filtered / sorted only once + Networks.ReplaceAll(wiFiNetworkScanInfo.WiFiNetworkInfos); + + // Select the network again (e.g. after an auto refresh), so the selection and the scroll position are kept. + // If several networks were selected, only this one is selected again. Not if it is hidden by the filter. + if (selectedBssid != null) + { + var network = Networks.FirstOrDefault(x => x.Bssid == selectedBssid); + + if (network != null && NetworksView.Contains(network)) + SelectedNetwork = network; + } - Log.Debug("ScanAsync - Adding new values..."); List series2Dot4GHz = []; List series5GHz = []; List series6GHzLower = []; @@ -822,11 +833,6 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals foreach (var network in wiFiNetworkScanInfo.WiFiNetworkInfos) { - Log.Debug("ScanAsync - Add network: " + network.AvailableNetwork.Ssid + " with channel frequency: " + - network.AvailableNetwork.ChannelCenterFrequencyInKilohertz); - - Networks.Add(network); - switch (network.Radio) { case WiFiRadio.GHz2dot4: diff --git a/Source/NETworkManager/Views/WiFiView.xaml.cs b/Source/NETworkManager/Views/WiFiView.xaml.cs index 942768fd1d..83871508dd 100644 --- a/Source/NETworkManager/Views/WiFiView.xaml.cs +++ b/Source/NETworkManager/Views/WiFiView.xaml.cs @@ -1,5 +1,8 @@ -using System.Windows; +using System; +using System.ComponentModel; +using System.Windows; using System.Windows.Controls; +using System.Windows.Threading; using NETworkManager.ViewModels; namespace NETworkManager.Views; @@ -17,6 +20,28 @@ public WiFiView() InitializeComponent(); DataContext = _viewModel; + + _viewModel.PropertyChanged += ViewModel_PropertyChanged; + } + + /// + /// Scrolls the selected network into view, e.g. when it is selected again after the networks were scanned + /// again (see ). + /// + private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName != nameof(WiFiViewModel.SelectedNetwork) || _viewModel.SelectedNetwork == null) + return; + + // Wait until the DataGrid has processed the new items and the selection + Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => + { + var network = _viewModel.SelectedNetwork; + + // The network may be hidden by the filter / search + if (network != null && DataGridNetworks.Items.Contains(network)) + DataGridNetworks.ScrollIntoView(network); + })); } public void OnViewHide() diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 9c425ba1db..fa653d6b7c 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -221,6 +221,7 @@ Release date: **xx.xx.2026** - The export contains the values shown in the grid that were missing: `IsConnected`, `Security`, `Channel`, `ChannelWidth` (MHz), `ChannelWidthEstimated` and `Vendor` (appended as the last columns / elements). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - **Export...** > all exports the networks shown in the grid (filtered by band and search) in the order shown, the selected networks are exported in the order shown too. The file is written in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Scanning the networks (also **Automatically update every**) no longer freezes the window briefly: the connected network is read from the WiFi API instead of `netsh` via PowerShell, and the vendor lookups run in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- The selected network stays selected (and in view) when the networks are scanned again, e.g. with **Automatically update every**. The list is replaced at once instead of network by network. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 13a8615c6863a74d550a0b7d71348c17c4f2640a Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:14:19 +0100 Subject: [PATCH 33/66] Feature: WiFi: Copy the SSID / BSSID of several networks (M3) With several networks selected, the context menu only had Export... Like the IP Scanner, Copy... > SSID / BSSID copies the value of all selected networks, one per line in the grid order, without duplicates (hidden networks have no SSID). Co-Authored-By: Claude Opus 5.5 --- .../ViewModels/WiFiViewModel.cs | 23 +++++++++++++++++++ Source/NETworkManager/Views/WiFiView.xaml | 12 ++++++++++ Website/docs/changelog/next-release.md | 1 + 3 files changed, 36 insertions(+) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 5cbce404aa..28eebcfa30 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -685,6 +685,29 @@ private void DisconnectAction() _ = DisconnectAsync(); } + /// + /// Gets the command to copy a value of all selected networks (one per line, in the order shown in the grid, + /// without duplicates). Parameter: SSID or BSSID. + /// + public ICommand CopySelectedNetworksCommand => new RelayCommand(CopySelectedNetworksAction); + + private void CopySelectedNetworksAction(object parameter) + { + Func selector = parameter switch + { + // Hidden networks have no SSID + "SSID" => x => x.AvailableNetwork.Ssid, + "BSSID" => x => x.Bssid, + _ => null + }; + + if (selector == null) + return; + + ClipboardHelper.SetClipboard(string.Join(Environment.NewLine, + GetSelectedNetworksInGridOrder().Select(selector).Where(x => !string.IsNullOrEmpty(x)).Distinct())); + } + public ICommand ExportCommand => new RelayCommand(_ => ExportAction()); private void ExportAction() diff --git a/Source/NETworkManager/Views/WiFiView.xaml b/Source/NETworkManager/Views/WiFiView.xaml index 3292fa8844..02247c347b 100644 --- a/Source/NETworkManager/Views/WiFiView.xaml +++ b/Source/NETworkManager/Views/WiFiView.xaml @@ -399,6 +399,18 @@ + + + + + diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index fa653d6b7c..5a52581ce6 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -222,6 +222,7 @@ Release date: **xx.xx.2026** - **Export...** > all exports the networks shown in the grid (filtered by band and search) in the order shown, the selected networks are exported in the order shown too. The file is written in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Scanning the networks (also **Automatically update every**) no longer freezes the window briefly: the connected network is read from the WiFi API instead of `netsh` via PowerShell, and the vendor lookups run in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - The selected network stays selected (and in view) when the networks are scanned again, e.g. with **Automatically update every**. The list is replaced at once instead of network by network. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- If several networks are selected, **Copy...** > **SSID** / **BSSID** copies the values of all selected networks (one per line, in the order shown, without duplicates). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **Dashboard** From 6cb1bf0a01a211e773cf9591c7ec7fd36c981de8 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:23:56 +0100 Subject: [PATCH 34/66] Feature: WiFi: Changes since the last scan (M4) Like the IP Scanner (Since last scan), each scan is compared with the previous scan of the same adapter by BSSID (WiFiScanComparer, with unit tests): New, Gone and Changed (channel, channel width if both were read from the beacon, or security; the signal is not a change). Gone networks stay as faded rows until the next scan (not drawn in the charts, Connect disabled). A Since last scan column (icon + text, the tooltip of a changed network shows its previous values) and the counters in the header are shown once a scan is compared; the change is also in the search and the export (Change, last column). Only in memory, another adapter starts over. Co-Authored-By: Claude Opus 5.5 --- .../WiFiNetworkChangeToStringConverter.cs | 60 ++++++++ .../Resources/Strings.Designer.cs | 27 ++++ .../Resources/Strings.resx | 9 ++ .../Export/ExportManager.WiFiNetworkInfo.cs | 10 +- .../Network/WiFiNetworkChange.cs | 28 ++++ .../Network/WiFiNetworkInfo.cs | 12 ++ .../Network/WiFiScanComparer.cs | 83 ++++++++++ .../Network/WiFiScanComparerTests.cs | 112 ++++++++++++++ .../ViewModels/WiFiViewModel.cs | 145 +++++++++++++++++- Source/NETworkManager/Views/WiFiView.xaml | 110 +++++++++++++ Website/docs/changelog/next-release.md | 4 + 11 files changed, 590 insertions(+), 10 deletions(-) create mode 100644 Source/NETworkManager.Converters/WiFiNetworkChangeToStringConverter.cs create mode 100644 Source/NETworkManager.Models/Network/WiFiNetworkChange.cs create mode 100644 Source/NETworkManager.Models/Network/WiFiScanComparer.cs create mode 100644 Source/NETworkManager.Tests/Network/WiFiScanComparerTests.cs diff --git a/Source/NETworkManager.Converters/WiFiNetworkChangeToStringConverter.cs b/Source/NETworkManager.Converters/WiFiNetworkChangeToStringConverter.cs new file mode 100644 index 0000000000..68fb88c09f --- /dev/null +++ b/Source/NETworkManager.Converters/WiFiNetworkChangeToStringConverter.cs @@ -0,0 +1,60 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using NETworkManager.Localization.Resources; +using NETworkManager.Models.Network; + +namespace NETworkManager.Converters; + +/// +/// Convert the of a network (since the previous scan) to a translated +/// (e.g. "New"), or a to the tooltip of a changed network. +/// +public sealed class WiFiNetworkChangeToStringConverter : IValueConverter +{ + /// + /// Convert the change of a network to a translated . + /// + /// + /// Change of the network as , or the network as with + /// the parameter "ToolTip". + /// + /// + /// "ToolTip" for the values of the previous scan of a changed network. + /// + /// Translated change (empty if there is none), or the tooltip (null without previous values). + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (parameter is "ToolTip") + return value is WiFiNetworkInfo { Previous: { } previous } + ? string.Format(Strings.PreviouslyX, + $"{Strings.Channel} {previous.Channel} · {WiFiChannelBandwidthToStringConverter.Format(previous)} · {previous.NetworkAuthenticationType}") + : null; + + return value is WiFiNetworkChange change ? ToLocalizedString(change) : string.Empty; + } + + /// + /// Gets the translated change of a network. + /// + /// Change of the network. + /// Translated change, empty for . + public static string ToLocalizedString(WiFiNetworkChange change) + { + return change switch + { + WiFiNetworkChange.New => Strings.HostChange_New, + WiFiNetworkChange.Gone => Strings.HostChange_Gone, + WiFiNetworkChange.Changed => Strings.WiFiNetworkChange_Changed, + _ => string.Empty + }; + } + + /// + /// !!! Method not implemented !!! + /// + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } +} diff --git a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs index 1648de9c66..86a32066c0 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs +++ b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs @@ -9823,6 +9823,15 @@ public static string Preview { } } + /// + /// Looks up a localized string similar to Previously: {0}. + /// + public static string PreviouslyX { + get { + return ResourceManager.GetString("PreviouslyX", resourceCulture); + } + } + /// /// Looks up a localized string similar to Previous MAC address: {0}. /// @@ -15514,6 +15523,15 @@ public static string WiFiConnectionStatus_UnsupportedAuthenticationProtocol { } } + /// + /// Looks up a localized string similar to Changed. + /// + public static string WiFiNetworkChange_Changed { + get { + return ResourceManager.GetString("WiFiNetworkChange_Changed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Window. /// @@ -15658,6 +15676,15 @@ public static string XADNSRecordsResolvedForXXXMessage { } } + /// + /// Looks up a localized string similar to {0} Changed. + /// + public static string XChanged { + get { + return ResourceManager.GetString("XChanged", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} Closed. /// diff --git a/Source/NETworkManager.Localization/Resources/Strings.resx b/Source/NETworkManager.Localization/Resources/Strings.resx index c3b53b3203..17a46c9d0c 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.resx +++ b/Source/NETworkManager.Localization/Resources/Strings.resx @@ -5456,4 +5456,13 @@ Do you want to start the scan? Estimated from the band and the WiFi standard: the channel width could not be read from the beacon of the access point. + + Changed + + + {0} Changed + + + Previously: {0} + \ No newline at end of file diff --git a/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs b/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs index 9ed3f9a1a9..d33a86bf35 100644 --- a/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs +++ b/Source/NETworkManager.Models/Export/ExportManager.WiFiNetworkInfo.cs @@ -54,7 +54,9 @@ private sealed record WiFiNetworkExportField( // MHz, estimated if the width could not be read from the beacon new("ChannelWidth", x => x.ChannelBandwidth), new("ChannelWidthEstimated", x => x.IsChannelBandwidthEstimated), - new(nameof(WiFiNetworkInfo.Vendor), x => x.Vendor, true) + new(nameof(WiFiNetworkInfo.Vendor), x => x.Vendor, true), + // Change since the previous scan of the same adapter (empty without a previous scan / change) + new(nameof(WiFiNetworkInfo.Change), x => x.Change == WiFiNetworkChange.None ? null : x.Change.ToString()) ]; /// @@ -134,9 +136,9 @@ private static void CreateJson(IReadOnlyList collection, string { var value = field.GetValue(info); - // Numbers (frequency) and text as they are, other values (enums, time spans, signal bars, RSSI) as - // text like in the CSV file - return value is int or string ? value : Convert.ToString(value, CultureInfo.CurrentCulture); + // Numbers (frequency), text and empty values as they are, other values (enums, time spans, signal bars, + // RSSI) as text like in the CSV file + return value is null or int or string ? value : Convert.ToString(value, CultureInfo.CurrentCulture); })) .ToArray(); diff --git a/Source/NETworkManager.Models/Network/WiFiNetworkChange.cs b/Source/NETworkManager.Models/Network/WiFiNetworkChange.cs new file mode 100644 index 0000000000..f14561f3c4 --- /dev/null +++ b/Source/NETworkManager.Models/Network/WiFiNetworkChange.cs @@ -0,0 +1,28 @@ +namespace NETworkManager.Models.Network; + +/// +/// Change of a WiFi network (BSSID) since the previous scan of the same adapter (see ). +/// +public enum WiFiNetworkChange +{ + /// + /// No change, or there is no previous scan to compare with. + /// + None, + + /// + /// The network is visible now, it was not visible in the previous scan. + /// + New, + + /// + /// The network was visible in the previous scan, it is not visible now. + /// + Gone, + + /// + /// The channel, the channel width or the security of the network changed (e.g. the access point switched the + /// channel because of interference or radar). + /// + Changed +} diff --git a/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs b/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs index b68219497e..0e8b398eef 100644 --- a/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs +++ b/Source/NETworkManager.Models/Network/WiFiNetworkInfo.cs @@ -78,5 +78,17 @@ public class WiFiNetworkInfo /// Human-readable phy kind. /// public string PhyKind { get; set; } + + /// + /// Change since the previous scan of the same adapter (set by the view model after the scan, see + /// ). + /// + public WiFiNetworkChange Change { get; set; } + + /// + /// The network of the previous scan if it (channel, channel width or + /// security), otherwise null. + /// + public WiFiNetworkInfo Previous { get; set; } #endregion } \ No newline at end of file diff --git a/Source/NETworkManager.Models/Network/WiFiScanComparer.cs b/Source/NETworkManager.Models/Network/WiFiScanComparer.cs new file mode 100644 index 0000000000..234ed9ec2f --- /dev/null +++ b/Source/NETworkManager.Models/Network/WiFiScanComparer.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; + +namespace NETworkManager.Models.Network; + +/// +/// Result of . +/// +/// +/// Networks of the current scan with a change ( or +/// ) and the network of the previous scan (null if new). +/// +/// Networks of the previous scan that are not visible now (in the order of the previous scan). +public sealed record WiFiScanComparison( + IReadOnlyList<(WiFiNetworkInfo Network, WiFiNetworkChange Change, WiFiNetworkInfo Previous)> Changes, + IReadOnlyList Gone); + +/// +/// Compares a scan of the WiFi networks with the previous scan of the same adapter, by BSSID: which networks are +/// new, gone or changed their channel, channel width or security. The signal strength is not a change (it varies +/// with every scan). +/// +public static class WiFiScanComparer +{ + /// + /// Compares the current scan with the previous one. + /// + /// Networks of the previous scan. + /// Networks of the current scan. + /// Changes of the current networks and the gone networks. + public static WiFiScanComparison Compare(IReadOnlyList previous, + IReadOnlyList current) + { + var previousByBssid = ByBssid(previous); + var currentByBssid = ByBssid(current); + + var changes = new List<(WiFiNetworkInfo, WiFiNetworkChange, WiFiNetworkInfo)>(); + var gone = new List(); + + foreach (var network in currentByBssid.Values) + { + if (!previousByBssid.TryGetValue(network.Bssid, out var previousNetwork)) + changes.Add((network, WiFiNetworkChange.New, null)); + else if (IsChanged(previousNetwork, network)) + changes.Add((network, WiFiNetworkChange.Changed, previousNetwork)); + } + + foreach (var network in previousByBssid.Values) + { + if (!currentByBssid.ContainsKey(network.Bssid)) + gone.Add(network); + } + + return new WiFiScanComparison(changes, gone); + } + + /// + /// The channel, the channel width or the security changed. A width that was estimated in one of the scans is not + /// compared (it differs if the beacon could be read in one scan only). + /// + private static bool IsChanged(WiFiNetworkInfo previous, WiFiNetworkInfo current) + { + return previous.Channel != current.Channel || + (!previous.IsChannelBandwidthEstimated && !current.IsChannelBandwidthEstimated && + previous.ChannelBandwidth != current.ChannelBandwidth) || + !string.Equals(previous.NetworkAuthenticationType, current.NetworkAuthenticationType, + StringComparison.Ordinal); + } + + /// + /// Networks by BSSID, in their order (the first one if a BSSID is reported twice). + /// + private static Dictionary ByBssid(IEnumerable networks) + { + var result = new Dictionary(StringComparer.OrdinalIgnoreCase); + + foreach (var network in networks) + if (!string.IsNullOrEmpty(network.Bssid)) + result.TryAdd(network.Bssid, network); + + return result; + } +} diff --git a/Source/NETworkManager.Tests/Network/WiFiScanComparerTests.cs b/Source/NETworkManager.Tests/Network/WiFiScanComparerTests.cs new file mode 100644 index 0000000000..84a5228c7a --- /dev/null +++ b/Source/NETworkManager.Tests/Network/WiFiScanComparerTests.cs @@ -0,0 +1,112 @@ +using System.Linq; +using NETworkManager.Models.Network; +using Xunit; + +namespace NETworkManager.Tests.Network; + +public class WiFiScanComparerTests +{ + private static WiFiNetworkInfo Network(string bssid, int channel = 36, int width = 80, + string security = "WPA2 Personal (PSK)", bool isEstimated = false) + { + return new WiFiNetworkInfo + { + Bssid = bssid, + Channel = channel, + ChannelBandwidth = width, + IsChannelBandwidthEstimated = isEstimated, + NetworkAuthenticationType = security + }; + } + + [Fact] + public void SameNetworks_HaveNoChange() + { + var result = WiFiScanComparer.Compare([Network("AA"), Network("BB")], [Network("BB"), Network("AA")]); + + Assert.Empty(result.Changes); + Assert.Empty(result.Gone); + } + + [Fact] + public void SignalStrength_IsNoChange() + { + // Only the BSSID, channel, width and security are compared - another object with the same values + var result = WiFiScanComparer.Compare([Network("AA")], [Network("AA")]); + + Assert.Empty(result.Changes); + } + + [Fact] + public void NetworkVisibleNow_IsNew() + { + var current = Network("BB"); + + var result = WiFiScanComparer.Compare([Network("AA")], [Network("AA"), current]); + + var change = Assert.Single(result.Changes); + Assert.Same(current, change.Network); + Assert.Equal(WiFiNetworkChange.New, change.Change); + Assert.Null(change.Previous); + } + + [Fact] + public void NetworkNotVisibleNow_IsGone() + { + var previous = Network("BB"); + + var result = WiFiScanComparer.Compare([Network("AA"), previous], [Network("AA")]); + + Assert.Same(previous, Assert.Single(result.Gone)); + Assert.Empty(result.Changes); + } + + [Theory] + [InlineData(40, 80, "WPA2 Personal (PSK)")] // Channel + [InlineData(36, 160, "WPA2 Personal (PSK)")] // Channel width + [InlineData(36, 80, "WPA3 Personal (SAE)")] // Security + public void ChannelWidthOrSecurity_IsChanged(int channel, int width, string security) + { + var previous = Network("AA"); + + var result = WiFiScanComparer.Compare([previous], [Network("AA", channel, width, security)]); + + var change = Assert.Single(result.Changes); + Assert.Equal(WiFiNetworkChange.Changed, change.Change); + Assert.Same(previous, change.Previous); + } + + [Fact] + public void EstimatedWidth_IsNotCompared() + { + var result = WiFiScanComparer.Compare([Network("AA", width: 80)], + [Network("AA", width: 20, isEstimated: true)]); + + Assert.Empty(result.Changes); + } + + [Fact] + public void Bssid_IsComparedCaseInsensitive() + { + var result = WiFiScanComparer.Compare([Network("aa:bb")], [Network("AA:BB")]); + + Assert.Empty(result.Changes); + Assert.Empty(result.Gone); + } + + [Fact] + public void DuplicateBssid_UsesTheFirst() + { + var result = WiFiScanComparer.Compare([Network("AA"), Network("AA", 40)], [Network("AA")]); + + Assert.Empty(result.Changes); + } + + [Fact] + public void Gone_KeepsTheOrderOfThePreviousScan() + { + var result = WiFiScanComparer.Compare([Network("CC"), Network("AA"), Network("BB")], []); + + Assert.Equal(["CC", "AA", "BB"], result.Gone.Select(x => x.Bssid)); + } +} diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 28eebcfa30..952561b841 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -8,6 +8,7 @@ using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Controls; +using NETworkManager.Converters; using NETworkManager.Localization; using NETworkManager.Localization.Resources; using NETworkManager.Models.Export; @@ -288,6 +289,78 @@ public bool Show6GHzNetworks } } + /// + /// Networks of the last successful scan and the id of its adapter: the next scan of the same adapter is compared + /// with it (see ). Only in memory. + /// + private IReadOnlyList _previousScan; + + private string _previousScanAdapterId; + + /// + /// Gets whether the shown networks are compared with a previous scan (shows the column and the counters). + /// + public bool HasComparison + { + get; + private set + { + if (value == field) + return; + + field = value; + OnPropertyChanged(); + } + } + + /// + /// Gets the number of networks that are visible now and were not in the previous scan. + /// + public int NetworksNew + { + get; + private set + { + if (value == field) + return; + + field = value; + OnPropertyChanged(); + } + } + + /// + /// Gets the number of networks that were visible in the previous scan and are not now. + /// + public int NetworksGone + { + get; + private set + { + if (value == field) + return; + + field = value; + OnPropertyChanged(); + } + } + + /// + /// Gets the number of networks whose channel, channel width or security changed since the previous scan. + /// + public int NetworksChanged + { + get; + private set + { + if (value == field) + return; + + field = value; + OnPropertyChanged(); + } + } + public ObservableRangeCollection Networks { get; @@ -550,7 +623,9 @@ public WiFiViewModel() $"{info.Channel}".IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || info.Bssid.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || info.Vendor.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || - info.PhyKind.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1; + info.PhyKind.IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1 || + (HasComparison && WiFiNetworkChangeToStringConverter.ToLocalizedString(info.Change) + .IndexOf(Search, StringComparison.OrdinalIgnoreCase) > -1); }; // Auto refresh (enabled when the access is allowed, see Start) @@ -665,12 +740,12 @@ private async Task ScanNetworksAction() public ICommand ConnectCommand => new RelayCommand(_ => ConnectAction(), ConnectDisconnect_CanExecute); /// - /// A network is selected (the selection is cleared when the networks are scanned again) and no connection is - /// made at the moment. + /// A network is selected that is still visible (not gone since the last scan) and no connection is made at the + /// moment. /// private bool ConnectDisconnect_CanExecute(object obj) { - return SelectedNetwork != null && !IsConnecting; + return SelectedNetwork is { Change: not WiFiNetworkChange.Gone } && !IsConnecting; } private void ConnectAction() @@ -832,8 +907,9 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals // Remember the selected network, because replacing the networks clears the selection var selectedBssid = SelectedNetwork?.Bssid; - // Replace all networks with a single notification, so the view is filtered / sorted only once - Networks.ReplaceAll(wiFiNetworkScanInfo.WiFiNetworkInfos); + // Replace all networks with a single notification, so the view is filtered / sorted only once. With the + // networks that are gone since the previous scan of this adapter. + Networks.ReplaceAll(CompareWithPreviousScan(adapterInfo, wiFiNetworkScanInfo.WiFiNetworkInfos)); // Select the network again (e.g. after an auto refresh), so the selection and the scroll position are kept. // If several networks were selected, only this one is selected again. Not if it is hidden by the filter. @@ -1190,6 +1266,63 @@ private static (LineSeries Series, WiFiChannelLegendEntry Lege return (series, legend); } + /// + /// Compares the networks of a scan with the previous scan of the same adapter: marks new and changed networks, + /// adds the networks that are gone (shown until the next scan). The scan becomes the one the next scan is + /// compared with. Another adapter (or the first scan) starts without a comparison. + /// + /// Adapter of the scan. + /// Networks of the scan. + /// The networks to show (the scanned ones and the gone ones). + private List CompareWithPreviousScan(WiFiAdapterInfo adapterInfo, + IReadOnlyList networks) + { + var rows = new List(networks); + var adapterId = adapterInfo.NetworkInterfaceInfo.Id; + + if (_previousScan != null && _previousScanAdapterId == adapterId) + { + // The networks of the previous scan are not shown anymore (except the gone ones): no chain of previous + // networks over the scans + foreach (var network in _previousScan) + network.Previous = null; + + var comparison = WiFiScanComparer.Compare(_previousScan, networks); + + foreach (var (network, change, previous) in comparison.Changes) + { + network.Change = change; + network.Previous = previous; + } + + // Shown as they were in the previous scan (not connected, not drawn in the charts) + foreach (var network in comparison.Gone) + { + network.Change = WiFiNetworkChange.Gone; + network.IsConnected = false; + + rows.Add(network); + } + + NetworksNew = comparison.Changes.Count(x => x.Change == WiFiNetworkChange.New); + NetworksGone = comparison.Gone.Count; + NetworksChanged = comparison.Changes.Count(x => x.Change == WiFiNetworkChange.Changed); + HasComparison = true; + } + else + { + NetworksNew = 0; + NetworksGone = 0; + NetworksChanged = 0; + HasComparison = false; + } + + _previousScan = networks; + _previousScanAdapterId = adapterId; + + return rows; + } + /// /// Gets the SSID of a network as shown in the grid ("Hidden Network" for a hidden network). /// diff --git a/Source/NETworkManager/Views/WiFiView.xaml b/Source/NETworkManager/Views/WiFiView.xaml index 02247c347b..f170e36b8a 100644 --- a/Source/NETworkManager/Views/WiFiView.xaml +++ b/Source/NETworkManager/Views/WiFiView.xaml @@ -29,6 +29,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -584,6 +628,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 5a52581ce6..461cf4900c 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -47,6 +47,10 @@ Release date: **xx.xx.2026** - New global **DNS suffix** options in [Settings > Network](../settings/network.md): **Add DNS suffix (primary) to hostname** appends the Windows primary (or, if none is set, the active network adapter's connection-specific) DNS suffix to a bare hostname before resolving it, and **Use custom DNS suffix** lets you override it with a suffix of your own. Previously only available in DNS Lookup, this now also applies to every other tool that resolves hostnames through NETworkManager's shared DNS resolver (e.g. Ping, Traceroute, Port Scanner, IP Scanner, SNTP Lookup) — DNS Lookup stays independent. [#3591](https://github.com/BornToBeRoot/NETworkManager/pull/3591) - **DNS server(s)** in [Settings > Network](../settings/network.md) is now a list of servers (IP address + port), configured via an **Edit DNS server** dialog, replacing the previous single semicolon-separated, port-53-only text field. [#3591](https://github.com/BornToBeRoot/NETworkManager/pull/3591) +**WiFi** + +- Changes since the last scan: each scan is compared with the previous scan of the same adapter (by BSSID). The new column **Since last scan** shows networks that are **New**, **Gone** (shown faded until the next scan) or **Changed** (channel, channel width or security, the tooltip shows the previous values), the header shows the counters (e.g. `2 New · 1 Gone`). Also in the search and the export (`Change`). Useful with **Automatically update every** to see new access points or channel changes. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) + ## Improvements - Links (e.g. in **About**, **Web Console** and the notices in **RDAP**) are now keyboard accessible: they can be reached with `Tab` and opened with `Enter`. [#3607](https://github.com/BornToBeRoot/NETworkManager/pull/3607) From 1b11e44d2f8fd551fb0b219073585073aba4ec5e Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:24:54 +0100 Subject: [PATCH 35/66] Docs: WiFi: Toolbar, columns, connect, export, changes and channels (O3, D1-D7) The WiFi documentation was behind the tool: toolbar (adapter, last scan, auto refresh, bands, search), column table incl. the estimated channel width, changes since the last scan, context menu in the order of the UI with the multi-selection, the connect dialog, the export (formats, columns, filtered networks in grid order), and the Channels tab (center of the whole channel, legend, signal-quality bands, what the filter doesn't apply to). The location access no longer needs a restart. Co-Authored-By: Claude Opus 5.5 --- Website/docs/application/wifi.md | 113 ++++++++++++++++++++++++------- 1 file changed, 87 insertions(+), 26 deletions(-) diff --git a/Website/docs/application/wifi.md b/Website/docs/application/wifi.md index f43bee8866..46e495a02a 100644 --- a/Website/docs/application/wifi.md +++ b/Website/docs/application/wifi.md @@ -14,64 +14,125 @@ keywords: ] --- -# WiFi -The **WiFi** tool shows available wireless networks, including channel, signal strength, and encryption details. +# WiFi -Hidden wireless networks are shown as `Hidden Network`. +The **WiFi** tool shows the wireless networks (access points) in range of a WiFi adapter, with channel, channel width, signal strength and security, shows them on the channels of the 2.4, 5 and 6 GHz bands and connects to them. :::info -Wi-Fi is a wireless networking technology based on IEEE 802.11 standards. Access points periodically advertise network information (such as SSID and security capabilities), which clients can scan and display. +Wi-Fi is a wireless networking technology based on IEEE 802.11 standards. Access points periodically advertise network information (such as SSID and security capabilities) in beacons, which clients can scan and display. + +::: + +:::note + +Starting with Windows 11 24H2, you must allow access to the Wi-Fi adapter: open `Windows Settings > Privacy & security > Location` and enable access for Desktop Apps / NETworkManager. **Open settings** below the message opens these settings; after allowing the access, **Refresh** below the message (or switching back to **WiFi**) loads the adapters, a restart is not needed. ::: ## WiFi -On the **WiFi** tab, you can select which wireless adapter is used for scanning. Results can be filtered by the 2.4 GHz, 5 GHz, and 6 GHz bands. +![WiFi](../img/wifi.png) -In the search field, you can filter wireless networks by `SSID`, `Security`, `Frequency`, `Channel`, `BSSID (MAC Address)`, `Vendor`, and `PHY kind`. Search is case-insensitive. +### Toolbar + +| Element | Description | +| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Interface** | WiFi adapter that is scanned (the icon shows if it is connected). The selected adapter is saved. The button next to it reloads the adapters (e.g. after an adapter was plugged in). The adapter can't be changed while scanning or connecting. | +| **Last scan at** | Time of the last scan (the tooltip shows the date), with **Automatically update every** a countdown to the next scan (`Next refresh in 00:12`). | +| **Automatically update every** | Scans the networks again after the selected interval (`5 s` to `5 min`, default `30 s`, the pause after a scan). It pauses while another tool or a dialog is shown. The interval and the checkbox are saved. | +| **Refresh** | Scans the networks again (`F5`). Not available while **Automatically update every** is enabled. | +| **2.4 GHz** / **5 GHz** / **6 GHz** | Show or hide the networks of a band (saved). | +| Search | Filters the networks by SSID (`Hidden Network` for hidden networks), security, frequency, channel, BSSID (MAC address), vendor, PHY kind and the change since the last scan. Case-insensitive, after a short delay while typing (`Enter` filters right away). | + +A refresh (manual, automatic or after connecting) keeps the networks and the selected network visible while scanning (the refresh icon spins). If a refresh fails, the networks of the last scan stay and the error is shown below them. + +### Columns + +| Column | Description | +| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Icon | Signal bars, with a lock if the network is secured (sorts by the signal bars) | +| **Since last scan** | Change since the previous scan, see [Changes since the last scan](#changes-since-the-last-scan) (only if the networks are compared with one) | +| **SSID** | Name of the network, `Hidden Network` for a hidden network | +| **Connected** | The selected adapter is connected to this access point | +| **Security** | Authentication, e.g. `WPA2 Personal (PSK)`, `WPA3 Personal (SAE)`, `WPA2 Enterprise`, `OWE`, `Open` | +| **Frequency** | Frequency of the primary channel (e.g. `5.18 GHz`) | +| **Channel** | Primary channel (where the access point sends its beacons, e.g. `36`) | +| **Channel width** | Channel width (`20`, `40`, `80`, `160` or `320 MHz`), read from the beacon of the access point. If it can't be read, it is estimated from the band and the WiFi standard and shown as `~80 MHz` (the tooltip explains it) | +| **Signal strength** | Received signal strength (RSSI) in dBm | +| **Authentication** | Authentication type as reported by Windows (e.g. `RsnaPsk`) | +| **Encryption** | Encryption type as reported by Windows (e.g. `Ccmp`) | +| **BSSID** | MAC address of the access point (e.g. `AA:BB:CC:DD:EE:FF`) | +| **Vendor** | Vendor of the BSSID (OUI) | +| **PHY kind** | WiFi standard, e.g. `802.11ax` | +| **Network kind** | `Infrastructure` (access point) or `Adhoc` | +| **Beacon interval** | Interval of the beacons in milliseconds | +| **Uptime** | Time since the access point was started | + +### Changes since the last scan + +Each scan is compared with the previous scan of the same adapter (by BSSID): + +- **New**: the network is visible now, it was not visible in the last scan. +- **Gone**: the network was visible in the last scan, it is not visible now. The row is shown faded (as it was in the last scan) until the next scan; it can't be connected. +- **Changed**: the channel, the channel width or the security of the network changed (e.g. the access point switched the channel because of interference or radar). The tooltip shows the previous values. A change of the signal strength is not shown (it varies with every scan), and an estimated channel width is not compared. + +The **Since last scan** column and the counters right of the **Networks** header (e.g. `2 New · 1 Gone`) are only shown if the networks are compared with a previous scan. Changing the adapter starts over. The last scan is only kept in memory. The change is also in the search and the export (`Change`). Together with **Automatically update every**, this shows new access points or channel changes in the area. -:::note +### Context menu -Starting with Windows 11 24H2, you must allow access to the Wi-Fi adapter. +| Action | Description | +| -------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| **Connect...** | Opens a dialog to connect to the selected network, see [Connect](#connect) (only if not connected) | +| **Disconnect** | Disconnects the adapter from the selected network (only if connected) | +| **Copy...** | Copies a value of the selected network to the clipboard | +| **Export...** | Opens a dialog to export the selected or all networks to a file, see [Export](#export) | -Open `Windows Settings > Privacy & security > Location`, enable access for Desktop Apps / NETworkManager, then restart the application. +If multiple networks are selected, **Copy...** > **SSID** / **BSSID** (one value per line, in the order shown, without duplicates) and **Export...** are available. -::: +### Connect -![WiFi](../img/wifi.png) +**Connect...** opens a dialog with the fields required by the security of the network: -### Context menu +| Field | Description | +| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| **SSID** | Name of the network (only for a hidden network) | +| **Connect automatically** | Windows connects to the network automatically in the future | +| **Pre-shared key** | Password of a WPA / WPA2 / WPA3 Personal (or WEP) network | +| **Use credentials** | WPA / WPA2 / WPA3 Enterprise (EAP) network: connect with **Username**, **Domain** (optional) and **Password**. If disabled, Windows uses the logged-on user or a certificate | -| Action | Description | -| -------------- | ---------------------------------------------------------------------------------- | -| **Connect...** | Opens a dialog to connect to the selected wireless network (only if not connected) | -| **Disconnect** | Disconnects from the selected wireless network (only if connected) | -| **Export...** | Opens a dialog to export the selected or all wireless networks to a file | -| **Copy** | Copies the selected information to the clipboard | +Open and OWE (Enhanced Open) networks need no password. If the network supports WPS (push button), **WPS** connects by pressing the WPS button of the access point (checked when the dialog is opened, `Checking WPS...`). + +The status of the connection (`Connecting to ...`, the result or the error) is shown below the networks for 15 seconds, and the networks are scanned again a few seconds later. + +### Export + +**Export...** exports the networks as CSV, XML or JSON: **all** exports the networks shown (filtered by band and search) in the order shown, **selected** the selected networks in the order shown. Columns / elements: `Bssid`, `Ssid`, `ChannelCenterFrequencyInKilohertz`, `SignalBars`, `IsWiFiDirect`, `NetworkRssiInDecibelMilliwatts`, `PhyKind`, `NetworkKind`, `NetworkAuthenticationType`, `NetworkEncryptionType`, `BeaconInterval`, `Uptime`, `IsConnected`, `Security`, `Channel`, `ChannelWidth` (MHz), `ChannelWidthEstimated`, `Vendor` and `Change`. ### Keyboard shortcuts -| Key | Action | -| ---- | ----------------- | -| `F5` | Scan for networks | +| Key | Action | +| ---- | ----------------------------------------------------------------- | +| `F5` | Scan the networks (not while **Automatically update every** is enabled) | ## Channels -On the **Channels** tab, all wireless networks of the selected wireless adapter are displayed in a graphical view with channel, channel width, and signal strength. This helps identify overlapping wireless networks that do not originate from the same access point. +On the **Channels** tab, the networks of the selected adapter are drawn on the channels of their band, with their channel width and signal strength. This helps to find overlapping networks and a free channel. The tab is split into two sub-tabs: -- **2.4 & 5 GHz** — shows networks on the 2.4 GHz and 5 GHz bands in a single chart each. -- **6 GHz** — shows 6 GHz networks in two separate charts: lower channels (1–125) and upper channels (129–233). +- **2.4 & 5 GHz**: one chart for the 2.4 GHz and one for the 5 GHz band. The unused range between the channels 64 and 100 of the 5 GHz band is compressed. +- **6 GHz**: the lower (channels 1 - 125) and the upper channels (129 - 233) in two charts. + +Each network is drawn as a band over its whole channel width (20, 40, 80, 160 or 320 MHz), centered on the center of the channel (e.g. 80 MHz with the primary channel 36 covers the channels 36 - 48), so overlapping networks can be identified. If the channel width is estimated, the network is drawn around its primary channel. The legend below each chart lists the networks with their color (SSID and BSSID). The background shows the signal quality: excellent (-30 dBm and better), good (-67 to -30 dBm), reliable (-70 to -67 dBm), weak (-80 to -70 dBm) and poor (below -80 dBm). -Each network is drawn as a proportional band reflecting its channel width (20, 40, 80, or 160 MHz), so overlapping networks can be identified more accurately. +The charts show all networks of the last scan: the band filter, the search and the gone networks don't apply. ![WiFi - Channel](../img/wifi--channel.png) :::note -Move the mouse over a network band to display details such as SSID, channel, channel width, and signal strength in a tooltip. +Move the mouse over a network to display details such as SSID, BSSID, channel, channel width and signal strength in a tooltip. ::: From ed33664d51642f302907503a01afa8011cda34ee Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:25:14 +0100 Subject: [PATCH 36/66] Chore: Feature review skill: Write tests with every fix and feature The review checks which logic of a feature has no unit tests (area 10, findings T1, ...), and fixes / features get unit tests in the same commit where possible, with testable logic moved into small public static methods in NETworkManager.Models (like IPScannerScanComparer). Co-Authored-By: Claude Opus 5.5 --- .claude/skills/feature-review/SKILL.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.claude/skills/feature-review/SKILL.md b/.claude/skills/feature-review/SKILL.md index 5f67157b3b..e211a40718 100644 --- a/.claude/skills/feature-review/SKILL.md +++ b/.claude/skills/feature-review/SKILL.md @@ -104,6 +104,12 @@ Go through these areas. Skip an area if it doesn't apply, but say so in one line than the same kind of file in the comparison features (`wc -l`), a file that grew a lot (`git log --stat`), the same lines found twice with `git grep`, a helper from the "Shared helpers" list in [references/conventions.md](references/conventions.md) re-implemented in the feature. +10. **Tests** — which logic of the feature has no unit tests in `Source/NETworkManager.Tests`: parsing, mapping and + conversion (e.g. frequency → channel), decisions (e.g. which dialog / mode, what counts as a change), comparisons, + validation, export field lists. Logic hidden in a view model or a private method that could be a small public + static method in `NETworkManager.Models` (no `InternalsVisibleTo` in the solution, reference: + `IPScannerNeighborCheck`, `IPScannerScanComparer`). A bug that a test would have caught is a strong hint + (report it as `T1`, ... with the bugs it would have caught). #### Refactoring: only if the code gets simpler @@ -181,7 +187,7 @@ Compared with: ### Missing essentials | # | Gap | Why it's essential | Size (small fix / issue) | -### Other (security, localization, docs) +### Other (security, localization, docs, tests) | # | Finding | Proposed fix | ### Refactoring / simplification @@ -220,6 +226,12 @@ When fixing: already exists in two or more places. Keep the code simple: no new abstraction for a single use. - One commit per finding, with its ID in the subject (e.g. `Fix: Port Scanner: ... (B3)`); a refactoring gets its own commit without behaviour changes. +- Write unit tests with every fix and feature where possible, in the same commit (xUnit, + `Source/NETworkManager.Tests//Tests.cs`), so the coverage of the tool grows with each change: a bug fix + gets a test that fails without the fix, new logic gets tests for its cases and edge cases. Move testable logic + (parsing, mapping, decisions, comparisons) out of the view model / private methods into a small public static + method or class in `NETworkManager.Models` first. What can't be tested (UI, WinRT / system APIs, network) goes into + the manual Windows tests of the handover file. - Add strings to `Strings.resx` and, in alphabetical order, to `Strings.Designer.cs`. - Update the feature documentation and add a changelog entry in `Website/docs/changelog/next-release.md`. - Never modify `Source/3rdparty/`. From df8782665b62554f24b06670795e97edf3d0b0a1 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:25:52 +0100 Subject: [PATCH 37/66] Docs: Changelog: Tool sections in the order of the application list The sections of each block of next-release.md were in no particular order (e.g. Whois before IP Scanner). The tool sections follow the order of the applications (ApplicationName) now, the cross-cutting sections (Run command, Settings, Profiles, History, Input validation) stay in front of them. The two WiFi sections of the bug fixes are merged. No entry changed. Co-Authored-By: Claude Opus 5.5 --- Website/docs/changelog/next-release.md | 237 ++++++++++++------------- 1 file changed, 117 insertions(+), 120 deletions(-) diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index 461cf4900c..3ace9da910 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -34,14 +34,6 @@ Release date: **xx.xx.2026** - Run command: the **Port Scanner** needs ports, which can also be names of port profiles, also several and together with ports (e.g. `portscan 10.0.0.1 webserver` or `portscan 10.0.0.1 "DNS (via TCP)";webserver;22`, suggested after the host and after a `;`). Own history size for the run command (default 20, [Settings > General](../settings/general.md#number-of-stored-entries-run-command)). `Tab` also completes profiles and port profiles, `PageUp`/`PageDown` move the selection by 5 suggestions. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) - Run command dialog redesigned: the icon of the recognized feature, the syntax with the part being typed highlighted, the values as they were understood (e.g. `Hosts: borntoberoot.net`, `Type: AAAA`), validation while typing, grouped suggestions with the typed text highlighted, examples and key hints (can be hidden in the settings). The dialog uses more space in a large window. The title bar shows a **Run command...** box in the center (like the command center of VS Code) instead of the icon. Type only a target (e.g. `10.0.0.1`, `server-01`, `00:11:22:33:44:55`, `10.0.0.0/24`) to get the commands that accept it, recent commands are also suggested while typing (e.g. a host); optionally, a target in the clipboard is suggested ([Settings > General](../settings/general.md#suggest-the-clipboard-content-as-target)). `Ctrl+Enter` runs and keeps the dialog open, `Shift+Enter` fills in the input without starting, `Shift+Del` or the remove button removes a recent command. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) -**RDAP** - -- New [**RDAP**](../application/rdap.md) tool to look up registration data via the Registration Data Access Protocol, the standardized, JSON-based successor of Whois. Supports domains, nameservers, top-level domains, IP addresses/CIDR prefixes, AS numbers and entity handles; the type is detected automatically or can be selected. The RDAP server is determined automatically using the IANA bootstrap files, which are cached locally and can be updated in the new **Settings > RDAP** page. Results are shown in a structured view (details, status, events, nameservers, DNSSEC, networks and AS numbers of an organization, contacts, notices) or as raw JSON, and can be exported as JSON or text. For domains (e.g. `.com`/`.net`), the referral to the registrar's RDAP server is followed as well (can be disabled in **Settings > RDAP**). Includes profile support. If no RDAP server is known for a domain, it can be opened in **Whois** with a single click. IP addresses and hostnames can be queried from the context menu of **IP Scanner** and **Traceroute**, AS numbers from **Traceroute**; for a hostname (e.g. `www.borntoberoot.net`), the registered domain is queried (determined with the included [Public Suffix List](https://publicsuffix.org/)). [#3607](https://github.com/BornToBeRoot/NETworkManager/pull/3607) [#3642](https://github.com/BornToBeRoot/NETworkManager/pull/3642) - -**Traceroute** - -- New **Map** view below the hop list, visualizing each resolved hop's geolocation on an offline world map. Consecutive hops are connected with curved, directional arrows; hovering a marker shows its location, ISP/ASN, hostname, IP address and average round-trip time, while hovering an arrow shows the source and destination location of that segment. The map supports mouse-wheel zoom and drag-to-pan, and can be collapsed via a toggle button on the map itself, similar to the Profiles panel. The map is only shown if **Check IP geolocation** and the new **Show map** setting are both enabled, since hops need a resolved geolocation to be plotted. [#3520](https://github.com/BornToBeRoot/NETworkManager/pull/3520) - **Settings** - New global **DNS suffix** options in [Settings > Network](../settings/network.md): **Add DNS suffix (primary) to hostname** appends the Windows primary (or, if none is set, the active network adapter's connection-specific) DNS suffix to a bare hostname before resolving it, and **Use custom DNS suffix** lets you override it with a suffix of your own. Previously only available in DNS Lookup, this now also applies to every other tool that resolves hostnames through NETworkManager's shared DNS resolver (e.g. Ping, Traceroute, Port Scanner, IP Scanner, SNTP Lookup) — DNS Lookup stays independent. [#3591](https://github.com/BornToBeRoot/NETworkManager/pull/3591) @@ -51,6 +43,14 @@ Release date: **xx.xx.2026** - Changes since the last scan: each scan is compared with the previous scan of the same adapter (by BSSID). The new column **Since last scan** shows networks that are **New**, **Gone** (shown faded until the next scan) or **Changed** (channel, channel width or security, the tooltip shows the previous values), the header shows the counters (e.g. `2 New · 1 Gone`). Also in the search and the export (`Change`). Useful with **Automatically update every** to see new access points or channel changes. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +**Traceroute** + +- New **Map** view below the hop list, visualizing each resolved hop's geolocation on an offline world map. Consecutive hops are connected with curved, directional arrows; hovering a marker shows its location, ISP/ASN, hostname, IP address and average round-trip time, while hovering an arrow shows the source and destination location of that segment. The map supports mouse-wheel zoom and drag-to-pan, and can be collapsed via a toggle button on the map itself, similar to the Profiles panel. The map is only shown if **Check IP geolocation** and the new **Show map** setting are both enabled, since hops need a resolved geolocation to be plotted. [#3520](https://github.com/BornToBeRoot/NETworkManager/pull/3520) + +**RDAP** + +- New [**RDAP**](../application/rdap.md) tool to look up registration data via the Registration Data Access Protocol, the standardized, JSON-based successor of Whois. Supports domains, nameservers, top-level domains, IP addresses/CIDR prefixes, AS numbers and entity handles; the type is detected automatically or can be selected. The RDAP server is determined automatically using the IANA bootstrap files, which are cached locally and can be updated in the new **Settings > RDAP** page. Results are shown in a structured view (details, status, events, nameservers, DNSSEC, networks and AS numbers of an organization, contacts, notices) or as raw JSON, and can be exported as JSON or text. For domains (e.g. `.com`/`.net`), the referral to the registrar's RDAP server is followed as well (can be disabled in **Settings > RDAP**). Includes profile support. If no RDAP server is known for a domain, it can be opened in **Whois** with a single click. IP addresses and hostnames can be queried from the context menu of **IP Scanner** and **Traceroute**, AS numbers from **Traceroute**; for a hostname (e.g. `www.borntoberoot.net`), the registered domain is queried (determined with the included [Public Suffix List](https://publicsuffix.org/)). [#3607](https://github.com/BornToBeRoot/NETworkManager/pull/3607) [#3642](https://github.com/BornToBeRoot/NETworkManager/pull/3642) + ## Improvements - Links (e.g. in **About**, **Web Console** and the notices in **RDAP**) are now keyboard accessible: they can be reached with `Tab` and opened with `Enter`. [#3607](https://github.com/BornToBeRoot/NETworkManager/pull/3607) @@ -58,13 +58,32 @@ Release date: **xx.xx.2026** - The collapsed/expanded state of profile groups (e.g. **linux-server**) is now remembered per profile file and shared across all tools, instead of resetting every time you switch tools or restart the application. [#3539](https://github.com/BornToBeRoot/NETworkManager/pull/3539) - The **Experimental features** setting in **Settings > Update** is removed: features in testing are marked with a **Beta** label at their own setting instead (e.g. **Read Windows host information** of the **IP Scanner**). [#3691](https://github.com/BornToBeRoot/NETworkManager/pull/3691) +**Profiles** + +- **Settings > Profiles**: `Enter` in the search box filters the profiles right away instead of after the delay while typing. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) + +**Dashboard** + +- Checking the **IP geolocation** and the **DNS resolver** is faster (the minimum of 2.5 seconds runs during the request, not before); the refresh icons spin until the check is finished. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) + **Network Interface** - Members of the **Network Configuration Operators** group can now change the network configuration (IP address, DNS servers, release/renew) without being an administrator. NETworkManager has to run elevated (**Restart as Administrator**, confirm with your own credentials). The hint is now also shown as tooltip on **Apply** in the profile context menu. [#3606](https://github.com/BornToBeRoot/NETworkManager/issues/3606) -**Whois** +**WiFi** -- Added an **Export...** button below the result, like in the other tools. [#3607](https://github.com/BornToBeRoot/NETworkManager/pull/3607) +- The search filters after a short delay while typing instead of on every key press, `Enter` filters right away. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) +- The time of the last scan of the networks (`Last scan at 14:32`, the date in the tooltip) is shown in their header, with **Automatically update every** a countdown to the next scan; the line below only shows errors and the connection status. Reloading the network adapters is faster (the minimum of 2.5 seconds runs while loading) and the reload icon spins until it is finished. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) +- A channel width that could not be read from the beacon of the access point and is estimated is shown as `~80 MHz` (grid, copy and the tooltip of the **Channels** tab), the tooltip of the cell explains it. Estimated widths on 2.4 GHz are 20 MHz (40 MHz is rarely used there). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- After allowing the access to the WiFi adapter in the Windows settings (location), **Refresh** below the message (or switching back to WiFi) loads the adapters. A restart of the application is no longer needed. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- The BSSID is shown, copied and exported in the same format as the MAC addresses of the other tools (`AA:BB:CC:DD:EE:FF` instead of `aa:bb:cc:dd:ee:ff`). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Reloading the adapters keeps the networks visible while they are scanned again (the refresh icon spins), instead of replacing them by the loading indicator. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- An unknown security or PHY kind is shown as `-/-` (like an unknown vendor) instead of the untranslated text `Unknown`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- The export contains the values shown in the grid that were missing: `IsConnected`, `Security`, `Channel`, `ChannelWidth` (MHz), `ChannelWidthEstimated` and `Vendor` (appended as the last columns / elements). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- **Export...** > all exports the networks shown in the grid (filtered by band and search) in the order shown, the selected networks are exported in the order shown too. The file is written in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Scanning the networks (also **Automatically update every**) no longer freezes the window briefly: the connected network is read from the WiFi API instead of `netsh` via PowerShell, and the vendor lookups run in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- The selected network stays selected (and in view) when the networks are scanned again, e.g. with **Automatically update every**. The list is replaced at once instead of network by network. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- If several networks are selected, **Copy...** > **SSID** / **BSSID** copies the values of all selected networks (one per line, in the order shown, without duplicates). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **IP Scanner** @@ -194,9 +213,9 @@ Release date: **xx.xx.2026** - `Enter` in the search box filters the rules right away instead of after the delay while typing. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) - The time of the last refresh (`Reloaded at 14:32`, the date in the tooltip) is shown in the header instead of a status line below the list; the line below the list only shows errors (e.g. rules loaded with errors, a failed action). A manual refresh is faster (the minimum of 2.5 seconds runs while loading, not before) and the refresh icon spins until the rules are loaded (also with **Show all rules**). [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) -**Profiles** +**Whois** -- **Settings > Profiles**: `Enter` in the search box filters the profiles right away instead of after the delay while typing. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) +- Added an **Export...** button below the result, like in the other tools. [#3607](https://github.com/BornToBeRoot/NETworkManager/pull/3607) **Connections** @@ -213,25 +232,6 @@ Release date: **xx.xx.2026** - The search filters after a short delay while typing instead of on every key press (smoother with many entries), `Enter` filters right away. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) - The time of the last refresh (`Reloaded at 14:32`, the date in the tooltip) is shown in the header instead of a status line below the list; with **Automatically update every**, a countdown to the next refresh (`Next refresh in 00:04`). The line below the list only shows errors. A manual refresh is faster (the minimum of 2.5 seconds runs while loading, not before) and the refresh icon spins until it is finished. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) -**WiFi** - -- The search filters after a short delay while typing instead of on every key press, `Enter` filters right away. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) -- The time of the last scan of the networks (`Last scan at 14:32`, the date in the tooltip) is shown in their header, with **Automatically update every** a countdown to the next scan; the line below only shows errors and the connection status. Reloading the network adapters is faster (the minimum of 2.5 seconds runs while loading) and the reload icon spins until it is finished. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) -- A channel width that could not be read from the beacon of the access point and is estimated is shown as `~80 MHz` (grid, copy and the tooltip of the **Channels** tab), the tooltip of the cell explains it. Estimated widths on 2.4 GHz are 20 MHz (40 MHz is rarely used there). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- After allowing the access to the WiFi adapter in the Windows settings (location), **Refresh** below the message (or switching back to WiFi) loads the adapters. A restart of the application is no longer needed. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- The BSSID is shown, copied and exported in the same format as the MAC addresses of the other tools (`AA:BB:CC:DD:EE:FF` instead of `aa:bb:cc:dd:ee:ff`). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Reloading the adapters keeps the networks visible while they are scanned again (the refresh icon spins), instead of replacing them by the loading indicator. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- An unknown security or PHY kind is shown as `-/-` (like an unknown vendor) instead of the untranslated text `Unknown`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- The export contains the values shown in the grid that were missing: `IsConnected`, `Security`, `Channel`, `ChannelWidth` (MHz), `ChannelWidthEstimated` and `Vendor` (appended as the last columns / elements). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- **Export...** > all exports the networks shown in the grid (filtered by band and search) in the order shown, the selected networks are exported in the order shown too. The file is written in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Scanning the networks (also **Automatically update every**) no longer freezes the window briefly: the connected network is read from the WiFi API instead of `netsh` via PowerShell, and the vendor lookups run in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- The selected network stays selected (and in view) when the networks are scanned again, e.g. with **Automatically update every**. The list is replaced at once instead of network by network. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- If several networks are selected, **Copy...** > **SSID** / **BSSID** copies the values of all selected networks (one per line, in the order shown, without duplicates). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - -**Dashboard** - -- Checking the **IP geolocation** and the **DNS resolver** is faster (the minimum of 2.5 seconds runs during the request, not before); the refresh icons spin until the check is finished. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) - ## Bug Fixes - Fixed changes to lists in the settings (e.g. query histories, port profiles, custom commands) not being saved if no other setting was changed in the same session. This happened since the settings are stored as JSON. [#3607](https://github.com/BornToBeRoot/NETworkManager/pull/3607) @@ -241,57 +241,39 @@ Release date: **xx.xx.2026** - Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper) in **About** and the DNS server profiles in **Settings > Network**. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) - Fixed the screenshot that is shown in place of embedded windows (**Remote Desktop**, **PowerShell**, **PuTTY**, **TigerVNC**, **Web Console**) while a dialog is open being cropped / stretched with a display scaling above 100% or on a monitor with a different scaling, and being stretched / scaled if the window is resized while the dialog is open (it keeps its size now). The `AirspacePanel` of [AirspaceFixer](https://github.com/chris84948/AirspaceFixer) is now part of NETworkManager, based on the fork [AirspaceFixerDotNet](https://github.com/ellipticbit/AirspaceFixerDotNet) with per monitor DPI support, which also fixes a GDI handle leak. [#3681](https://github.com/BornToBeRoot/NETworkManager/pull/3681) -**Firewall** - -- Fixed the name of the feature not being translatable in the list of features, the settings and the run command (missing translation key). [#3667](https://github.com/BornToBeRoot/NETworkManager/pull/3667) -- Fixed `F5` not refreshing the rule list, although it is documented as shortcut. [#3637](https://github.com/BornToBeRoot/NETworkManager/pull/3637) -- Fixed an empty rule list with "Reloaded at ..." being shown if the rules could not be loaded (e.g. the Windows Firewall service is not running). An error is shown now, and a message if the rules could only be loaded partially. [#3637](https://github.com/BornToBeRoot/NETworkManager/pull/3637) -- Fixed the Firewall not working until the application was restarted if loading the PowerShell module `NetSecurity` failed once. [#3637](https://github.com/BornToBeRoot/NETworkManager/pull/3637) -- Fixed keywords like `LocalSubnet` or `DNS` being accepted for **Local addresses** in the add / edit / copy rule dialog, although Windows only accepts `Any` there (saving the rule failed). The same applies to `Any4` / `Any6` for local and remote addresses. [#3637](https://github.com/BornToBeRoot/NETworkManager/pull/3637) -- Fixed a horizontal scrollbar appearing in the add / edit / copy rule dialog when the name or description is very long. [#3630](https://github.com/BornToBeRoot/NETworkManager/pull/3630) -- Fixed port keywords (e.g. `RPC`) and combinations of interface types being shown as **Any**. Editing a rule that was changed outside of NETworkManager to use such values no longer silently removes them (the rule can't be edited in this case). [#3630](https://github.com/BornToBeRoot/NETworkManager/pull/3630) -- Fixed the program of a rule not being shown in the row details and the edit dialog. Saving the edit dialog then removed the program from the rule, so the rule applied to all programs. [#3630](https://github.com/BornToBeRoot/NETworkManager/pull/3630) -- Fixed editing a rule deleting and re-creating it, which removed properties that are not supported by NETworkManager (e.g. ICMP types or a service set in the Windows Firewall management console). Only the changed properties are updated now (ICMP types are reset if the protocol is changed). [#3630](https://github.com/BornToBeRoot/NETworkManager/pull/3630) -- Fixed program paths with environment variables (e.g. `%SystemRoot%\System32\svchost.exe`) being rejected as non-existent in the add / edit / copy rule dialog. [#3630](https://github.com/BornToBeRoot/NETworkManager/pull/3630) -- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) - -**Ping Monitor** - -- Fixed long error messages (e.g. from a failed host resolution) in the tooltip of the error icon not being wrapped. [#3626](https://github.com/BornToBeRoot/NETworkManager/pull/3626) -- Fixed the ping not working when the ICMP **Buffer** was set to more than `65500` bytes (Windows limit). The maximum is now `65500`, higher values are lowered to `65500`. [#3653](https://github.com/BornToBeRoot/NETworkManager/pull/3653) -- Fixed hosts being added twice if the inputs overlap (e.g. `10.0.0.1; 10.0.0.0/24`). If an IP address is also entered as hostname, the hostname is kept; different hostnames of the same IP address (e.g. two names of one server) are all kept. [#3653](https://github.com/BornToBeRoot/NETworkManager/pull/3653) -- Fixed **Copy** > **Hostname** copying a hostname resolved via DNS (`PTR`) with a trailing dot (e.g. `server.example.com.`). [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) - -**Traceroute** +**History** -- Fixed the trace not working when the ICMP **Buffer** was set to more than `65500` bytes (Windows limit). The maximum is now `65500`, higher values are lowered to `65500`. [#3653](https://github.com/BornToBeRoot/NETworkManager/pull/3653) -- Fixed hostnames of the hops resolved via DNS (`PTR`) being shown with a trailing dot (e.g. `server.example.com.`), also in the export and when opened in another feature (e.g. **RDAP**). A single-label name (e.g. `gateway.`) keeps the dot, so the DNS suffix isn't appended, except for **Remote Desktop**, **PuTTY**, **TigerVNC** and **PowerShell**, which resolve it via Windows. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) -- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper), e.g. to read a long hostname. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) +- Fixed adding an entry to the history of an input (e.g. hosts, ports, domains) failing when the number of stored entries is set to `0` in [Settings > General](../settings/general.md#number-of-stored-entries). With `0`, no entries are stored. Removing an entry from the history (also the oldest one, shared by several tabs) no longer clears the input that shows it. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) -**Network Interface** +**Input validation** -- 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) +- Fixed host names being accepted with a hyphen at the start or end of a label other than the first (e.g. `server.-bad-.com`) and with only digits (e.g. `10.0.0.` or `192.168.1`, which are an incomplete IPv4 address). The same applies to the domain in **Whois**. IPv4 addresses are still accepted in all host fields, now checked explicitly in the **Remote Desktop** host field. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) +- Fixed MAC addresses and their first 3 bytes (**Wake on LAN**, **Lookup** > **OUI**, profiles) being accepted with any character instead of a dot in the format `0000.0000.0000` (e.g. `0011 2233 4455`). [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) +- Fixed IPv6 subnets in the **Subnet Calculator** being accepted with a leading `s` (e.g. `sss2001:db8::/32`) and rejected with an embedded IPv4 address (e.g. `::ffff:192.168.0.1/96`). [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) +- Fixed the port of the **Remote Desktop** host field (`host:port`) being accepted empty or as `0`. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) +- Fixed the application freezing when validating an invalid domain with many labels in **Whois** (exponential backtracking of the regular expression). [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) +- Fixed IPv6 subnets with whitespace or a zone index (e.g. `fe80::1%eth0/64`) being accepted in the **Subnet Calculator**, which can't calculate them. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) +- Fixed an empty entry in **Lookup** > **OUI** / **Port** (e.g. `22;;80`) finding every vendor or service. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) +- Fixed **Lookup** > **Port** searching for a port with an upper-case protocol (e.g. `22/TCP`) as a service instead of the port and protocol. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) -**Connections** +**Profiles** -- 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 **Automatically update every** `1` / `5` minutes refreshing only every hour / every 5 hours. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) -- Fixed the hostname of the remote address (DNS `PTR`) being shown with a trailing dot (e.g. `server.example.com.`), also in the export. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) -- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) +- Fixed `Enter` in the search box of the import result importing the profiles (default button). It filters the found profiles right away now, instead of after the delay while typing. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) +- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper) in the groups (Settings > Profiles) and the import result. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) +- Fixed the names of the features in the group dialog shown without spaces (e.g. `RemoteDesktop` instead of **Remote Desktop**). [#3667](https://github.com/BornToBeRoot/NETworkManager/pull/3667) +- Fixed the profiles of a group renamed only by case (e.g. `servers` → `Servers`) keeping the old group name. Opening them in a feature with group settings (e.g. **Remote Desktop**, **PuTTY**) failed, and editing one could create a second group with the old name. Profile files with such profiles are repaired when they are loaded. [#3667](https://github.com/BornToBeRoot/NETworkManager/pull/3667) -**Listeners** +**Dashboard** -- 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 **Automatically update every** `1` / `5` minutes refreshing only every hour / every 5 hours. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) -- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) +- 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) +- Fixed the DNS hostname (`PTR`) in the **Network Connection** widget being shown with a trailing dot (e.g. `router.example.com.`). [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) -**Neighbor Table** +**Network Interface** -- Fixed the **State** of the entries being shifted by one (e.g. `Reachable` entries were shown as `Stale`, `Permanent` entries as `Reachable`, `Unreachable` entries as `0`) since the table is read with the Windows API (2026.7.7). [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) -- 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) -- Fixed **Automatically update every** `1` / `5` minutes refreshing only every hour / every 5 hours. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) -- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) +- 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) **WiFi** @@ -319,22 +301,7 @@ Release date: **xx.xx.2026** - Fixed `F5` scanning and **Automatically update every** refreshing the networks behind an open dialog (e.g. **Connect...** or **Export...**). The auto refresh waits until the dialog is closed. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed the CSV export breaking the row of a network whose SSID contains a comma or a quote. SSID, security and vendor are quoted. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed a network being marked as **Connected** that the selected adapter isn't connected to, if the computer has several WiFi adapters and the selected one was disconnected. An error while reading the connected network no longer ends the scan. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - -**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) -- Fixed the DNS hostname (`PTR`) in the **Network Connection** widget being shown with a trailing dot (e.g. `router.example.com.`). [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) - -**DNS Lookup** - -- Fixed **Inherit host from general** of a profile being saved with the value of the **Traceroute**, so the host of the DNS lookup could be replaced with the host of the profile. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) -- Fixed a DNS server opened with the run command in another case than configured (e.g. `cloudflare` for `Cloudflare`) being looked up as hostname instead of using the configured DNS server. Names of DNS servers are case-insensitive now. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) -- Fixed **Add DNS suffix (primary) to hostname** silently appending no suffix at all on machines without a Windows primary DNS suffix configured (e.g. not domain-joined), even though a usable suffix was available via the active network adapter's connection-specific DNS suffix (shown under **DNS Suffix Search List** in `ipconfig /all`). It now falls back to that adapter's suffix in this case. [#3591](https://github.com/BornToBeRoot/NETworkManager/pull/3591) -- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper) in the result and the DNS server profiles in the settings. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) -- Fixed a technical error (*An invalid IP address was specified*) being shown for a hostname looked up with `PTR`. A message is shown and the hostname is skipped, the other hosts are looked up. [#3667](https://github.com/BornToBeRoot/NETworkManager/pull/3667) +- Fixed the connection status message (e.g. "Connecting to ...") being hidden too early, while still connecting, if a previous message (e.g. after connecting or disconnecting) was shown shortly before. Each message is now shown for 15 seconds. [#3638](https://github.com/BornToBeRoot/NETworkManager/pull/3638) **IP Scanner** @@ -392,40 +359,30 @@ Release date: **xx.xx.2026** - Fixed the ports of different hosts with the same hostname (DNS `PTR`, e.g. a generic name of a provider or a server with two IP addresses) being shown in one group. The results are grouped per IP address, the group header shows the hostname and the IP address. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) - Fixed **Edit** (`F2`, double-click) and **Delete** (`Del`) of a port profile in the settings being available without a selected profile (edit created a new profile). The delete confirmation shows the name of the profile. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) -**IP Geolocation** - -- Fixed the query history of **IP Geolocation** being written to the history of **Whois** instead of its own. [#3607](https://github.com/BornToBeRoot/NETworkManager/pull/3607) - -**WiFi** - -- Fixed the connection status message (e.g. "Connecting to ...") being hidden too early, while still connecting, if a previous message (e.g. after connecting or disconnecting) was shown shortly before. Each message is now shown for 15 seconds. [#3638](https://github.com/BornToBeRoot/NETworkManager/pull/3638) - -**History** +**Ping Monitor** -- Fixed adding an entry to the history of an input (e.g. hosts, ports, domains) failing when the number of stored entries is set to `0` in [Settings > General](../settings/general.md#number-of-stored-entries). With `0`, no entries are stored. Removing an entry from the history (also the oldest one, shared by several tabs) no longer clears the input that shows it. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) +- Fixed long error messages (e.g. from a failed host resolution) in the tooltip of the error icon not being wrapped. [#3626](https://github.com/BornToBeRoot/NETworkManager/pull/3626) +- Fixed the ping not working when the ICMP **Buffer** was set to more than `65500` bytes (Windows limit). The maximum is now `65500`, higher values are lowered to `65500`. [#3653](https://github.com/BornToBeRoot/NETworkManager/pull/3653) +- Fixed hosts being added twice if the inputs overlap (e.g. `10.0.0.1; 10.0.0.0/24`). If an IP address is also entered as hostname, the hostname is kept; different hostnames of the same IP address (e.g. two names of one server) are all kept. [#3653](https://github.com/BornToBeRoot/NETworkManager/pull/3653) +- Fixed **Copy** > **Hostname** copying a hostname resolved via DNS (`PTR`) with a trailing dot (e.g. `server.example.com.`). [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) -**Input validation** +**Traceroute** -- Fixed host names being accepted with a hyphen at the start or end of a label other than the first (e.g. `server.-bad-.com`) and with only digits (e.g. `10.0.0.` or `192.168.1`, which are an incomplete IPv4 address). The same applies to the domain in **Whois**. IPv4 addresses are still accepted in all host fields, now checked explicitly in the **Remote Desktop** host field. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) -- Fixed MAC addresses and their first 3 bytes (**Wake on LAN**, **Lookup** > **OUI**, profiles) being accepted with any character instead of a dot in the format `0000.0000.0000` (e.g. `0011 2233 4455`). [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) -- Fixed IPv6 subnets in the **Subnet Calculator** being accepted with a leading `s` (e.g. `sss2001:db8::/32`) and rejected with an embedded IPv4 address (e.g. `::ffff:192.168.0.1/96`). [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) -- Fixed the port of the **Remote Desktop** host field (`host:port`) being accepted empty or as `0`. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) -- Fixed the application freezing when validating an invalid domain with many labels in **Whois** (exponential backtracking of the regular expression). [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) -- Fixed IPv6 subnets with whitespace or a zone index (e.g. `fe80::1%eth0/64`) being accepted in the **Subnet Calculator**, which can't calculate them. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) -- Fixed an empty entry in **Lookup** > **OUI** / **Port** (e.g. `22;;80`) finding every vendor or service. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) -- Fixed **Lookup** > **Port** searching for a port with an upper-case protocol (e.g. `22/TCP`) as a service instead of the port and protocol. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) +- Fixed the trace not working when the ICMP **Buffer** was set to more than `65500` bytes (Windows limit). The maximum is now `65500`, higher values are lowered to `65500`. [#3653](https://github.com/BornToBeRoot/NETworkManager/pull/3653) +- Fixed hostnames of the hops resolved via DNS (`PTR`) being shown with a trailing dot (e.g. `server.example.com.`), also in the export and when opened in another feature (e.g. **RDAP**). A single-label name (e.g. `gateway.`) keeps the dot, so the DNS suffix isn't appended, except for **Remote Desktop**, **PuTTY**, **TigerVNC** and **PowerShell**, which resolve it via Windows. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) +- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper), e.g. to read a long hostname. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) -**Subnet Calculator** +**DNS Lookup** -- Fixed **Subnetting** getting stuck when the new subnet mask is smaller than the subnet mask of the subnet (e.g. `10.0.0.0/24` with `/16`) or too large for the address family (e.g. `/40` for IPv4). An error is shown instead. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) -- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper) in the subnetting result. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) +- Fixed **Inherit host from general** of a profile being saved with the value of the **Traceroute**, so the host of the DNS lookup could be replaced with the host of the profile. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) +- Fixed a DNS server opened with the run command in another case than configured (e.g. `cloudflare` for `Cloudflare`) being looked up as hostname instead of using the configured DNS server. Names of DNS servers are case-insensitive now. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) +- Fixed **Add DNS suffix (primary) to hostname** silently appending no suffix at all on machines without a Windows primary DNS suffix configured (e.g. not domain-joined), even though a usable suffix was available via the active network adapter's connection-specific DNS suffix (shown under **DNS Suffix Search List** in `ipconfig /all`). It now falls back to that adapter's suffix in this case. [#3591](https://github.com/BornToBeRoot/NETworkManager/pull/3591) +- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper) in the result and the DNS server profiles in the settings. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) +- Fixed a technical error (*An invalid IP address was specified*) being shown for a hostname looked up with `PTR`. A message is shown and the hostname is skipped, the other hosts are looked up. [#3667](https://github.com/BornToBeRoot/NETworkManager/pull/3667) -**Profiles** +**Web Console** -- Fixed `Enter` in the search box of the import result importing the profiles (default button). It filters the found profiles right away now, instead of after the delay while typing. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) -- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper) in the groups (Settings > Profiles) and the import result. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) -- Fixed the names of the features in the group dialog shown without spaces (e.g. `RemoteDesktop` instead of **Remote Desktop**). [#3667](https://github.com/BornToBeRoot/NETworkManager/pull/3667) -- Fixed the profiles of a group renamed only by case (e.g. `servers` → `Servers`) keeping the old group name. Opening them in a feature with group settings (e.g. **Remote Desktop**, **PuTTY**) failed, and editing one could create a second group with the old name. Profile files with such profiles are repaired when they are loaded. [#3667](https://github.com/BornToBeRoot/NETworkManager/pull/3667) +- Fixed no message being shown after **Delete browsing data** in the settings (whether the browsing data was deleted or an error occurred), and an error (e.g. the WebView2 runtime is not installed) not being handled. **SNMP** @@ -436,21 +393,61 @@ Release date: **xx.xx.2026** - Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper) in the result and the SNTP server profiles in the settings. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) +**Hosts File Editor** + +- Fixed the retry of a locked hosts file waiting 5 seconds between the attempts (the message said 2) and once more after the last attempt. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) + +**Firewall** + +- Fixed the name of the feature not being translatable in the list of features, the settings and the run command (missing translation key). [#3667](https://github.com/BornToBeRoot/NETworkManager/pull/3667) +- Fixed `F5` not refreshing the rule list, although it is documented as shortcut. [#3637](https://github.com/BornToBeRoot/NETworkManager/pull/3637) +- Fixed an empty rule list with "Reloaded at ..." being shown if the rules could not be loaded (e.g. the Windows Firewall service is not running). An error is shown now, and a message if the rules could only be loaded partially. [#3637](https://github.com/BornToBeRoot/NETworkManager/pull/3637) +- Fixed the Firewall not working until the application was restarted if loading the PowerShell module `NetSecurity` failed once. [#3637](https://github.com/BornToBeRoot/NETworkManager/pull/3637) +- Fixed keywords like `LocalSubnet` or `DNS` being accepted for **Local addresses** in the add / edit / copy rule dialog, although Windows only accepts `Any` there (saving the rule failed). The same applies to `Any4` / `Any6` for local and remote addresses. [#3637](https://github.com/BornToBeRoot/NETworkManager/pull/3637) +- Fixed a horizontal scrollbar appearing in the add / edit / copy rule dialog when the name or description is very long. [#3630](https://github.com/BornToBeRoot/NETworkManager/pull/3630) +- Fixed port keywords (e.g. `RPC`) and combinations of interface types being shown as **Any**. Editing a rule that was changed outside of NETworkManager to use such values no longer silently removes them (the rule can't be edited in this case). [#3630](https://github.com/BornToBeRoot/NETworkManager/pull/3630) +- Fixed the program of a rule not being shown in the row details and the edit dialog. Saving the edit dialog then removed the program from the rule, so the rule applied to all programs. [#3630](https://github.com/BornToBeRoot/NETworkManager/pull/3630) +- Fixed editing a rule deleting and re-creating it, which removed properties that are not supported by NETworkManager (e.g. ICMP types or a service set in the Windows Firewall management console). Only the changed properties are updated now (ICMP types are reset if the protocol is changed). [#3630](https://github.com/BornToBeRoot/NETworkManager/pull/3630) +- Fixed program paths with environment variables (e.g. `%SystemRoot%\System32\svchost.exe`) being rejected as non-existent in the add / edit / copy rule dialog. [#3630](https://github.com/BornToBeRoot/NETworkManager/pull/3630) +- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) + **RDAP** - Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper) in the result and the bootstrap files in the settings. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) +**IP Geolocation** + +- Fixed the query history of **IP Geolocation** being written to the history of **Whois** instead of its own. [#3607](https://github.com/BornToBeRoot/NETworkManager/pull/3607) + +**Subnet Calculator** + +- Fixed **Subnetting** getting stuck when the new subnet mask is smaller than the subnet mask of the subnet (e.g. `10.0.0.0/24` with `/16`) or too large for the address family (e.g. `/40` for IPv4). An error is shown instead. [#3646](https://github.com/BornToBeRoot/NETworkManager/pull/3646) +- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper) in the subnetting result. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) + **Lookup** - Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper) in the OUI and port lookup. The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) -**Web Console** +**Connections** -- Fixed no message being shown after **Delete browsing data** in the settings (whether the browsing data was deleted or an error occurred), and an error (e.g. the WebView2 runtime is not installed) not being handled. +- 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 **Automatically update every** `1` / `5` minutes refreshing only every hour / every 5 hours. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) +- Fixed the hostname of the remote address (DNS `PTR`) being shown with a trailing dot (e.g. `server.example.com.`), also in the export. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) +- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) -**Hosts File Editor** +**Listeners** -- Fixed the retry of a locked hosts file waiting 5 seconds between the attempts (the message said 2) and once more after the last attempt. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) +- 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 **Automatically update every** `1` / `5` minutes refreshing only every hour / every 5 hours. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) +- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) + +**Neighbor Table** + +- Fixed the **State** of the entries being shifted by one (e.g. `Reachable` entries were shown as `Stale`, `Permanent` entries as `Reachable`, `Unreachable` entries as `0`) since the table is read with the Windows API (2026.7.7). [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) +- 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) +- Fixed **Automatically update every** `1` / `5` minutes refreshing only every hour / every 5 hours. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) +- Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) ## Dependencies, Refactoring & Documentation From d4d73c18dd715e75e7c61119916080328fe066a0 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:26:56 +0100 Subject: [PATCH 38/66] Fix: WiFi: Error reading the adapter states failed the scan (B22) UpdateAdapterStates (icon of the adapter selection, B18) runs after a successful scan inside its try block: an exception (e.g. a NetworkInformationException) showed the scan as failed. It is optional, so the error is logged and the previous states are kept. Duplicate interface ids no longer throw (TryAdd instead of ToDictionary). Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager.Models/Network/WiFi.cs | 23 +++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Source/NETworkManager.Models/Network/WiFi.cs b/Source/NETworkManager.Models/Network/WiFi.cs index 6571f77c89..5f698a3a08 100644 --- a/Source/NETworkManager.Models/Network/WiFi.cs +++ b/Source/NETworkManager.Models/Network/WiFi.cs @@ -65,13 +65,24 @@ public static async Task> GetAdapterAsync() /// Wi-Fi adapters to update. public static void UpdateAdapterStates(IEnumerable adapters) { - var states = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces() - .ToDictionary(x => x.Id, x => x.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up, - StringComparer.OrdinalIgnoreCase); + // Optional (only the icon of the adapter selection): an error keeps the previous states instead of failing the + // scan it is called after + try + { + var states = new Dictionary(StringComparer.OrdinalIgnoreCase); + + foreach (var networkInterface in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()) + states.TryAdd(networkInterface.Id, + networkInterface.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up); - foreach (var adapter in adapters) - if (states.TryGetValue(adapter.NetworkInterfaceInfo.Id, out var isOperational)) - adapter.IsOperational = isOperational; + foreach (var adapter in adapters) + if (states.TryGetValue(adapter.NetworkInterfaceInfo.Id, out var isOperational)) + adapter.IsOperational = isOperational; + } + catch (Exception ex) + { + Log.Error("Error while reading the state of the WiFi adapters.", ex); + } } /// From dc8f23eea65cdaaf58da782cea6b3d7f36e7ff08 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:27:17 +0100 Subject: [PATCH 39/66] Fix: WiFi: Header kept the last scan of the previous adapter (B21) If the first scan of another adapter failed, the networks were cleared, but the header still showed the time of the last scan and the changes (New / Gone counters) of the previous adapter. They are reset as well. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 952561b841..93d1fc8120 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -994,6 +994,13 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals // another adapter (first scan) are cleared. if (!refreshing) { + // No time of the last scan and no changes of the previous adapter in the header + LastRefreshTime = null; + HasComparison = false; + NetworksNew = 0; + NetworksGone = 0; + NetworksChanged = 0; + Networks.Clear(); Radio2Dot4GHzSeries = []; Radio5GHzSeries = []; From 9cdca426742c312b25ad5f1462f66e2137710c01 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:34:16 +0100 Subject: [PATCH 40/66] Feature: WiFi: Notification for changes of the auto refresh (M5) Like the IP Scanner after a repeated scan: when an automatic refresh found changes since the previous scan (New / Gone / Changed), a notification shows them (up to three networks, otherwise the counters), with the status icon from NotificationStatusHelper. A click opens WiFi. New WiFi settings page (SettingsName.WiFi) with the settings of the IP Scanner and the same defaults: WiFi_ShowNotificationPopup (on), WiFi_NotificationSound (off), WiFi_NotificationCloseTime (10 s). Co-Authored-By: Claude Opus 5.5 --- .../DocumentationManager.cs | 1 + .../Resources/Strings.Designer.cs | 9 ++ .../Resources/Strings.resx | 3 + .../GlobalStaticConfiguration.cs | 4 + .../NETworkManager.Settings/SettingsInfo.cs | 48 +++++++++ .../NETworkManager.Settings/SettingsName.cs | 1 + .../SettingsViewManager.cs | 2 + .../ViewModels/SettingsViewModel.cs | 6 ++ .../ViewModels/WiFiSettingsViewModel.cs | 98 +++++++++++++++++++ .../ViewModels/WiFiViewModel.cs | 74 +++++++++++++- .../Views/WiFiSettingsView.xaml | 31 ++++++ .../Views/WiFiSettingsView.xaml.cs | 23 +++++ Website/docs/application/wifi.md | 28 +++++- Website/docs/changelog/next-release.md | 1 + 14 files changed, 326 insertions(+), 3 deletions(-) create mode 100644 Source/NETworkManager/ViewModels/WiFiSettingsViewModel.cs create mode 100644 Source/NETworkManager/Views/WiFiSettingsView.xaml create mode 100644 Source/NETworkManager/Views/WiFiSettingsView.xaml.cs diff --git a/Source/NETworkManager.Documentation/DocumentationManager.cs b/Source/NETworkManager.Documentation/DocumentationManager.cs index 4a436cf7dc..5cf844de12 100644 --- a/Source/NETworkManager.Documentation/DocumentationManager.cs +++ b/Source/NETworkManager.Documentation/DocumentationManager.cs @@ -260,6 +260,7 @@ public static DocumentationIdentifier GetIdentifierBySettingsName(SettingsName n SettingsName.Settings => DocumentationIdentifier.SettingsSettings, SettingsName.Dashboard => GetIdentifierByApplicationName(ApplicationName.Dashboard), SettingsName.NetworkInterface => GetIdentifierByApplicationName(ApplicationName.NetworkInterface), + SettingsName.WiFi => GetIdentifierByApplicationName(ApplicationName.WiFi), SettingsName.IPScanner => GetIdentifierByApplicationName(ApplicationName.IPScanner), SettingsName.PortScanner => GetIdentifierByApplicationName(ApplicationName.PortScanner), SettingsName.PingMonitor => GetIdentifierByApplicationName(ApplicationName.PingMonitor), diff --git a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs index 86a32066c0..59d4543c33 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.Designer.cs +++ b/Source/NETworkManager.Localization/Resources/Strings.Designer.cs @@ -6338,6 +6338,15 @@ public static string HelpMessage_UseCustomThemes { } } + /// + /// Looks up a localized string similar to Only when the networks are scanned automatically ("Automatically update every") and WiFi is shown: one notification per scan with the changes since the previous scan of the adapter.. + /// + public static string HelpMessage_WiFiChangesNotification { + get { + return ResourceManager.GetString("HelpMessage_WiFiChangesNotification", resourceCulture); + } + } + /// /// Looks up a localized string similar to Windows credentials for the Windows host information of this tab (also for repeated scans and Rescan), replacing the ones of the profile / group. They are not saved and are discarded when the tab is closed. Without credentials, the user running NETworkManager is used.. /// diff --git a/Source/NETworkManager.Localization/Resources/Strings.resx b/Source/NETworkManager.Localization/Resources/Strings.resx index 17a46c9d0c..98dc2d0292 100644 --- a/Source/NETworkManager.Localization/Resources/Strings.resx +++ b/Source/NETworkManager.Localization/Resources/Strings.resx @@ -5465,4 +5465,7 @@ Do you want to start the scan? Previously: {0} + + Only when the networks are scanned automatically ("Automatically update every") and WiFi is shown: one notification per scan with the changes since the previous scan of the adapter. + \ No newline at end of file diff --git a/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs b/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs index 9510cc5c14..164f09a5b1 100644 --- a/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs +++ b/Source/NETworkManager.Settings/GlobalStaticConfiguration.cs @@ -144,6 +144,10 @@ public static class GlobalStaticConfiguration public static AutoRefreshTimeInfo WiFi_AutoRefreshTime => AutoRefreshTime.GetDefaults.First(x => x.Value == 30 && x.TimeUnit == TimeUnit.Second); + public static bool WiFi_ShowNotificationPopup => true; + public static bool WiFi_NotificationSound => false; + public static int WiFi_NotificationCloseTime => 10; + public static ExportFileType WiFi_ExportFileType => ExportFileType.Csv; // Application: IP Scanner diff --git a/Source/NETworkManager.Settings/SettingsInfo.cs b/Source/NETworkManager.Settings/SettingsInfo.cs index fb066d7d30..15dd18dcc3 100644 --- a/Source/NETworkManager.Settings/SettingsInfo.cs +++ b/Source/NETworkManager.Settings/SettingsInfo.cs @@ -1151,6 +1151,54 @@ public AutoRefreshTimeInfo WiFi_AutoRefreshTime } } = GlobalStaticConfiguration.WiFi_AutoRefreshTime; + /// + /// Show a notification when an automatic refresh found changes. + /// + public bool WiFi_ShowNotificationPopup + { + get; + set + { + if (value == field) + return; + + field = value; + OnPropertyChanged(); + } + } = GlobalStaticConfiguration.WiFi_ShowNotificationPopup; + + /// + /// Play a sound when an automatic refresh found changes. + /// + public bool WiFi_NotificationSound + { + get; + set + { + if (value == field) + return; + + field = value; + OnPropertyChanged(); + } + } = GlobalStaticConfiguration.WiFi_NotificationSound; + + /// + /// Seconds until the notification of an automatic refresh is closed. + /// + public int WiFi_NotificationCloseTime + { + get; + set + { + if (value == field) + return; + + field = value; + OnPropertyChanged(); + } + } = GlobalStaticConfiguration.WiFi_NotificationCloseTime; + public string WiFi_ExportFilePath { get; diff --git a/Source/NETworkManager.Settings/SettingsName.cs b/Source/NETworkManager.Settings/SettingsName.cs index fe1bd17791..75fb9a3afd 100644 --- a/Source/NETworkManager.Settings/SettingsName.cs +++ b/Source/NETworkManager.Settings/SettingsName.cs @@ -15,6 +15,7 @@ public enum SettingsName Settings, Dashboard, NetworkInterface, + WiFi, IPScanner, PortScanner, PingMonitor, diff --git a/Source/NETworkManager.Settings/SettingsViewManager.cs b/Source/NETworkManager.Settings/SettingsViewManager.cs index d5d13ddd1a..b19c8e7eb7 100644 --- a/Source/NETworkManager.Settings/SettingsViewManager.cs +++ b/Source/NETworkManager.Settings/SettingsViewManager.cs @@ -50,6 +50,8 @@ public static class SettingsViewManager SettingsGroup.Application), new(SettingsName.NetworkInterface, ApplicationManager.GetIcon(ApplicationName.NetworkInterface), SettingsGroup.Application), + new(SettingsName.WiFi, ApplicationManager.GetIcon(ApplicationName.WiFi), + SettingsGroup.Application), new(SettingsName.IPScanner, ApplicationManager.GetIcon(ApplicationName.IPScanner), SettingsGroup.Application), new(SettingsName.PortScanner, ApplicationManager.GetIcon(ApplicationName.PortScanner), diff --git a/Source/NETworkManager/ViewModels/SettingsViewModel.cs b/Source/NETworkManager/ViewModels/SettingsViewModel.cs index 900f4db799..ef7bf08b10 100644 --- a/Source/NETworkManager/ViewModels/SettingsViewModel.cs +++ b/Source/NETworkManager/ViewModels/SettingsViewModel.cs @@ -121,6 +121,7 @@ public SettingsViewInfo SelectedSettingsView private SettingsProfilesView _settingsProfilesView; private DashboardSettingsView _dashboardSettingsView; private NetworkInterfaceSettingsView _networkInterfaceSettingsView; + private WiFiSettingsView _wiFiSettingsView; private IPScannerSettingsView _ipScannerSettingsView; private PortScannerSettingsView _portScannerSettingsView; private PingMonitorSettingsView _pingMonitorSettingsView; @@ -273,6 +274,11 @@ private void ChangeSettingsContent(SettingsViewInfo settingsViewInfo) SettingsContent = _networkInterfaceSettingsView; break; + case SettingsName.WiFi: + _wiFiSettingsView ??= new WiFiSettingsView(); + + SettingsContent = _wiFiSettingsView; + break; case SettingsName.IPScanner: _ipScannerSettingsView ??= new IPScannerSettingsView(); diff --git a/Source/NETworkManager/ViewModels/WiFiSettingsViewModel.cs b/Source/NETworkManager/ViewModels/WiFiSettingsViewModel.cs new file mode 100644 index 0000000000..3753e3e2b4 --- /dev/null +++ b/Source/NETworkManager/ViewModels/WiFiSettingsViewModel.cs @@ -0,0 +1,98 @@ +using NETworkManager.Settings; + +namespace NETworkManager.ViewModels; + +/// +/// ViewModel for the WiFi settings. +/// +public class WiFiSettingsViewModel : ViewModelBase +{ + #region Variables + + private readonly bool _isLoading; + + /// + /// Gets or sets a value indicating whether a notification is shown when an automatic refresh found changes. + /// + public bool ShowNotificationPopup + { + get; + set + { + if (value == field) + return; + + if (!_isLoading) + SettingsManager.Current.WiFi_ShowNotificationPopup = value; + + field = value; + OnPropertyChanged(); + } + } + + /// + /// Gets or sets a value indicating whether a sound is played when an automatic refresh found changes. + /// + public bool NotificationSound + { + get; + set + { + if (value == field) + return; + + if (!_isLoading) + SettingsManager.Current.WiFi_NotificationSound = value; + + field = value; + OnPropertyChanged(); + } + } + + /// + /// Gets or sets the seconds until the notification is closed. + /// + public int NotificationCloseTime + { + get; + set + { + if (value == field) + return; + + if (!_isLoading) + SettingsManager.Current.WiFi_NotificationCloseTime = value; + + field = value; + OnPropertyChanged(); + } + } + + #endregion + + #region Constructor, load settings + + /// + /// Initializes a new instance of the class. + /// + public WiFiSettingsViewModel() + { + _isLoading = true; + + LoadSettings(); + + _isLoading = false; + } + + /// + /// Loads the settings into the ViewModel. + /// + private void LoadSettings() + { + ShowNotificationPopup = SettingsManager.Current.WiFi_ShowNotificationPopup; + NotificationSound = SettingsManager.Current.WiFi_NotificationSound; + NotificationCloseTime = SettingsManager.Current.WiFi_NotificationCloseTime; + } + + #endregion +} diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 93d1fc8120..218a404f88 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -11,6 +11,7 @@ using NETworkManager.Converters; using NETworkManager.Localization; using NETworkManager.Localization.Resources; +using NETworkManager.Models; using NETworkManager.Models.Export; using NETworkManager.Models.Network; using NETworkManager.Settings; @@ -631,7 +632,7 @@ public WiFiViewModel() // Auto refresh (enabled when the access is allowed, see Start) // Not without an adapter, while a dialog is open (e.g. connect), or while networks are loading or a connection // is made (tried again after the interval) - _autoRefreshTimer = new AutoRefreshTimer(() => ScanAsync(SelectedAdapter, true), + _autoRefreshTimer = new AutoRefreshTimer(() => ScanAsync(SelectedAdapter, true, isAutoRefresh: true), () => SelectedAdapter != null && !IsDialogOpen() && !IsNetworksLoading && !IsBackgroundSearchRunning && !IsConnecting); @@ -881,7 +882,17 @@ private async Task LoadAdaptersAsync(string adapterId = null) Log.Debug("LoadAdaptersAsync - Done."); } - private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = false, int delayInMs = 0) + /// + /// Scans the networks of an adapter and shows them (with the changes since the previous scan). + /// + /// Adapter to scan. + /// + /// A refresh of the shown networks (in the background, they stay visible), not the first scan of the adapter. + /// + /// Delay before the scan (e.g. after connecting). + /// The scan is an automatic refresh: changes are notified (see settings). + private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = false, int delayInMs = 0, + bool isAutoRefresh = false) { Log.Debug($"ScanAsync - Scanning WiFi adapter \"{adapterInfo.NetworkInterfaceInfo.Name}\" with delay of {delayInMs} ms..."); @@ -911,6 +922,9 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals // networks that are gone since the previous scan of this adapter. Networks.ReplaceAll(CompareWithPreviousScan(adapterInfo, wiFiNetworkScanInfo.WiFiNetworkInfos)); + if (isAutoRefresh && HasComparison) + NotifyChanges(adapterInfo); + // Select the network again (e.g. after an auto refresh), so the selection and the scroll position are kept. // If several networks were selected, only this one is selected again. Not if it is hidden by the filter. if (selectedBssid != null) @@ -1330,6 +1344,62 @@ private List CompareWithPreviousScan(WiFiAdapterInfo adapterInf return rows; } + /// + /// Shows a notification with the changes since the previous scan (popup and / or sound, see settings), if there + /// are any. Like the IP Scanner, only for an automatic refresh. A click on it shows WiFi. + /// + /// Adapter of the scan (title of the notification). + private void NotifyChanges(WiFiAdapterInfo adapterInfo) + { + var showPopup = SettingsManager.Current.WiFi_ShowNotificationPopup; + var playSound = SettingsManager.Current.WiFi_NotificationSound; + + if (!showPopup && !playSound) + return; + + var changes = Networks.Where(x => x.Change != WiFiNetworkChange.None) + .OrderBy(GetDisplaySsid, StringComparer.CurrentCultureIgnoreCase) + .ThenBy(x => x.Bssid, StringComparer.OrdinalIgnoreCase) + .ToList(); + + if (changes.Count == 0) + return; + + // "MyNetwork (AA:BB:CC:DD:EE:FF) · New" - new = up, gone = down, changed = changed + var lines = changes.Select(x => new NotificationLine($"{GetDisplaySsid(x)} ({x.Bssid})", + WiFiNetworkChangeToStringConverter.ToLocalizedString(x.Change), GetNotificationStatus(x.Change))).ToList(); + + var summary = new[] + { + (Count: NetworksNew, Format: Strings.XNew, Status: NotificationStatus.Up), + (Count: NetworksGone, Format: Strings.XGone, Status: NotificationStatus.Down), + (Count: NetworksChanged, Format: Strings.XChanged, Status: NotificationStatus.Changed) + } + .Where(x => x.Count > 0) + .Select(x => new NotificationLine(null, string.Format(x.Format, x.Count), x.Status)).ToList(); + + // New = up, gone = down, both = up and down, only changed = changed + var status = NotificationStatusHelper.FromChanges(NetworksNew, NetworksGone, NetworksChanged); + + NotificationManager.Show(new NotificationInfo(ApplicationName.WiFi, status, + adapterInfo.NetworkInterfaceInfo.Name, NotificationManager.FormatChanges(lines, summary), + SettingsManager.Current.WiFi_NotificationCloseTime), + showPopup, playSound); + } + + /// + /// Gets the status (icon / color) of a change in the notification. + /// + private static NotificationStatus GetNotificationStatus(WiFiNetworkChange change) + { + return change switch + { + WiFiNetworkChange.New => NotificationStatus.Up, + WiFiNetworkChange.Gone => NotificationStatus.Down, + _ => NotificationStatus.Changed + }; + } + /// /// Gets the SSID of a network as shown in the grid ("Hidden Network" for a hidden network). /// diff --git a/Source/NETworkManager/Views/WiFiSettingsView.xaml b/Source/NETworkManager/Views/WiFiSettingsView.xaml new file mode 100644 index 0000000000..a8650e1246 --- /dev/null +++ b/Source/NETworkManager/Views/WiFiSettingsView.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + @@ -850,16 +887,11 @@ + Style="{StaticResource ResourceKey=WiFiChannelChart}" + Series="{Binding Path=Chart2Dot4GHz.Series}" + XAxes="{Binding Path=Chart2Dot4GHz.XAxes}" + YAxes="{Binding Path=Chart2Dot4GHz.YAxes}" + Sections="{Binding Path=Chart2Dot4GHz.Sections}"> @@ -868,44 +900,17 @@ HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" Margin="0,4,0,0"> - - - - - - - - - - - - - - - - - - + + Style="{StaticResource ResourceKey=WiFiChannelChart}" + Series="{Binding Path=Chart5GHz.Series}" + XAxes="{Binding Path=Chart5GHz.XAxes}" + YAxes="{Binding Path=Chart5GHz.YAxes}" + Sections="{Binding Path=Chart5GHz.Sections}"> @@ -914,30 +919,8 @@ HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" Margin="0,4,0,0"> - - - - - - - - - - - - - - - - - - + @@ -955,16 +938,11 @@ + Style="{StaticResource ResourceKey=WiFiChannelChart}" + Series="{Binding Path=Chart6GHzLower.Series}" + XAxes="{Binding Path=Chart6GHzLower.XAxes}" + YAxes="{Binding Path=Chart6GHzLower.YAxes}" + Sections="{Binding Path=Chart6GHzLower.Sections}"> @@ -973,44 +951,17 @@ HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" Margin="0,4,0,0"> - - - - - - - - - - - - - - - - - - + + Style="{StaticResource ResourceKey=WiFiChannelChart}" + Series="{Binding Path=Chart6GHzUpper.Series}" + XAxes="{Binding Path=Chart6GHzUpper.XAxes}" + YAxes="{Binding Path=Chart6GHzUpper.YAxes}" + Sections="{Binding Path=Chart6GHzUpper.Sections}"> @@ -1019,30 +970,8 @@ HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" Margin="0,4,0,0"> - - - - - - - - - - - - - - - - - - + From aeb94915838938b2b9861a142d0744bff6c4ff65 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:08:08 +0100 Subject: [PATCH 58/66] Refactor: WiFi: Position on the channel charts in the model, with tests (T1) The mapping from a frequency to the X axis of the channel charts (5 GHz gap, 6 GHz split, axis labels) moves from private methods of the view model to WiFiChannelAxis, so it can be tested (B9, B19, B32 had no tests). No behaviour change. Co-Authored-By: Claude Opus 5.5 --- .../Network/WiFiChannelAxis.cs | 90 +++++++++++++++++++ .../Network/WiFiChannelAxisTests.cs | 77 ++++++++++++++++ .../ViewModels/WiFiViewModel.cs | 75 +++------------- 3 files changed, 181 insertions(+), 61 deletions(-) create mode 100644 Source/NETworkManager.Models/Network/WiFiChannelAxis.cs create mode 100644 Source/NETworkManager.Tests/Network/WiFiChannelAxisTests.cs diff --git a/Source/NETworkManager.Models/Network/WiFiChannelAxis.cs b/Source/NETworkManager.Models/Network/WiFiChannelAxis.cs new file mode 100644 index 0000000000..c62344bba4 --- /dev/null +++ b/Source/NETworkManager.Models/Network/WiFiChannelAxis.cs @@ -0,0 +1,90 @@ +using System; + +namespace NETworkManager.Models.Network; + +/// +/// Position of a WiFi channel on the X axis of a channel chart. The axis is in channel-number space (5 MHz per +/// unit, linear with the frequency). In the 5 GHz chart the unused range between channel 64 (UNII-2) and channel +/// 100 (UNII-2 Extended) is compressed; the 6 GHz band is split into a lower (1 - 125) and an upper (129 - 233) +/// chart. +/// +public static class WiFiChannelAxis +{ + /// + /// Channel that splits the 6 GHz band into the lower (1 - 125) and the upper (129 - 233) chart. It sits between + /// the operating channels 125 and 129. + /// + public const int SixGHzSplitChannel = 127; + + // The 5 GHz range 64 - 100 is shown with 16 units instead of 36: channels above 64 are shifted left, leaving a + // small gap that still has room for the channel-width trapezoids. + private const int FiveGHzGapStartChannel = 64; + private const int FiveGHzGapEndChannel = 100; + private const int FiveGHzGapDisplayUnits = 16; + private const int FiveGHzGapShift = FiveGHzGapEndChannel - FiveGHzGapStartChannel - FiveGHzGapDisplayUnits; + + /// + /// Converts a frequency (e.g. the center of a channel) to channel-number space (5 MHz per unit). + /// + /// Frequency in MHz like 2422 or 5210. + /// Band of the frequency. + /// Channel number, fractional between two channels (e.g. 3 for 2422 MHz, 42 for 5210 MHz). + public static double FrequencyToChannel(double frequencyMHz, WiFiRadio radio) + { + return radio switch + { + // Channel 14 is at 2484 MHz and does not follow the standard ch×5 + 2407 spacing. + WiFiRadio.GHz2dot4 => (int)Math.Round(frequencyMHz) == 2484 ? 14.0 : (frequencyMHz - 2407) / 5.0, + WiFiRadio.GHz5 => (frequencyMHz - 5000) / 5.0, + // Channel 2 is at 5935 MHz, below channel 1 (5955 MHz) - drawn at its real position (-3) + WiFiRadio.GHz6 => (frequencyMHz - 5950) / 5.0, + _ => 0 + }; + } + + /// + /// Maps a channel number to its position on the X axis (the 5 GHz gap is compressed). + /// + /// Channel number (see ). + /// Band of the channel. + /// Position on the X axis. + public static double ChannelToPosition(double channel, WiFiRadio radio) + { + if (radio == WiFiRadio.GHz5 && channel > FiveGHzGapStartChannel) + return channel - FiveGHzGapShift; + + return channel; + } + + /// + /// Maps a position on the X axis back to the channel number (the inverse of ), + /// for the labels of the axis. + /// + /// Position on the X axis (rounded to a whole channel). + /// Band of the chart. + /// Channel number at the position. + public static int PositionToChannel(int position, WiFiRadio radio) + { + if (radio == WiFiRadio.GHz5 && position > FiveGHzGapStartChannel) + return position + FiveGHzGapShift; + + return position; + } + + /// + /// Gets the 6 GHz charts a channel is drawn in: the lower (1 - 125), the upper (129 - 233) or both, if the + /// channel crosses the split (e.g. 320 MHz around channel 127 covers 95 - 159). + /// + /// Center frequency of the whole channel in MHz. + /// Channel width in MHz (20, 40, 80, 160, 320). + /// Whether the channel is drawn in the lower and / or the upper chart. + public static (bool Lower, bool Upper) GetSixGHzCharts(double centerFrequencyMHz, int bandwidthMHz) + { + var center = FrequencyToChannel(centerFrequencyMHz, WiFiRadio.GHz6); + + // Channel-number space uses 5 MHz per unit: half of the width is bandwidth / 10 units + var halfWidth = bandwidthMHz / 10.0; + + return (center - halfWidth < SixGHzSplitChannel, center + halfWidth > SixGHzSplitChannel); + } +} diff --git a/Source/NETworkManager.Tests/Network/WiFiChannelAxisTests.cs b/Source/NETworkManager.Tests/Network/WiFiChannelAxisTests.cs new file mode 100644 index 0000000000..ed9ef1c7d6 --- /dev/null +++ b/Source/NETworkManager.Tests/Network/WiFiChannelAxisTests.cs @@ -0,0 +1,77 @@ +using NETworkManager.Models.Network; +using Xunit; + +namespace NETworkManager.Tests.Network; + +public class WiFiChannelAxisTests +{ + [Theory] + [InlineData(2412, WiFiRadio.GHz2dot4, 1)] + [InlineData(2484, WiFiRadio.GHz2dot4, 14)] + // 40 MHz on the channels 1 + 5: center at channel 3 + [InlineData(2422, WiFiRadio.GHz2dot4, 3)] + // 80 MHz on the channels 36 - 48: center at channel 42 (B19) + [InlineData(5210, WiFiRadio.GHz5, 42)] + [InlineData(5180, WiFiRadio.GHz5, 36)] + [InlineData(5955, WiFiRadio.GHz6, 1)] + // 6 GHz channel 2 is below channel 1 + [InlineData(5935, WiFiRadio.GHz6, -3)] + public void FrequencyToChannel_ReturnsTheChannelNumber(double frequencyMHz, WiFiRadio radio, double expected) + { + Assert.Equal(expected, WiFiChannelAxis.FrequencyToChannel(frequencyMHz, radio), 6); + } + + [Theory] + [InlineData(36, 36)] + [InlineData(64, 64)] + // The range 64 - 100 is compressed to 16 units + [InlineData(100, 80)] + [InlineData(149, 129)] + [InlineData(177, 157)] + public void ChannelToPosition_CompressesTheFiveGHzGap(double channel, double expected) + { + Assert.Equal(expected, WiFiChannelAxis.ChannelToPosition(channel, WiFiRadio.GHz5)); + } + + [Theory] + [InlineData(WiFiRadio.GHz2dot4, 13)] + [InlineData(WiFiRadio.GHz6, 129)] + public void ChannelToPosition_KeepsTheChannelOutsideOfFiveGHz(WiFiRadio radio, double channel) + { + Assert.Equal(channel, WiFiChannelAxis.ChannelToPosition(channel, radio)); + } + + [Theory] + [InlineData(36)] + [InlineData(64)] + [InlineData(100)] + [InlineData(144)] + // Labels above 144 (B9) + [InlineData(149)] + [InlineData(165)] + [InlineData(177)] + public void PositionToChannel_IsTheInverseOfChannelToPosition(int channel) + { + var position = (int)WiFiChannelAxis.ChannelToPosition(channel, WiFiRadio.GHz5); + + Assert.Equal(channel, WiFiChannelAxis.PositionToChannel(position, WiFiRadio.GHz5)); + } + + [Theory] + // 20 MHz on channel 1 / 233 + [InlineData(5955, 20, true, false)] + [InlineData(7115, 20, false, true)] + // 160 MHz on the channels 97 - 125 (center 111) / 129 - 157 (center 143) + [InlineData(6505, 160, true, false)] + [InlineData(6665, 160, false, true)] + // 320 MHz around channel 127 covers 95 - 159: both charts (B32) + [InlineData(6585, 320, true, true)] + // Channel 2 (5935 MHz) + [InlineData(5935, 20, true, false)] + public void GetSixGHzCharts_ReturnsTheChartsOfTheChannel(double centerFrequencyMHz, int bandwidthMHz, + bool expectedLower, bool expectedUpper) + { + Assert.Equal((expectedLower, expectedUpper), + WiFiChannelAxis.GetSixGHzCharts(centerFrequencyMHz, bandwidthMHz)); + } +} diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index e15834e14d..1be379c328 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -915,14 +915,13 @@ void AddToChart(WiFiChannelChart chart, WiFiNetworkInfo network) // Split into the lower (1-125) and upper (129-233) chart by the channels the network covers // (channel-number space, 5 MHz per unit). A network that crosses the split (e.g. 320 MHz // around channel 127 covers 95 - 159) is drawn in both charts. - var centerChannel = FrequencyToChannelAxis( - network.ChannelBandwidthCenterFrequencyInGigahertz * 1000, WiFiRadio.GHz6); - var halfWidth = network.ChannelBandwidth / 10.0; + var (lower, upper) = WiFiChannelAxis.GetSixGHzCharts( + network.ChannelBandwidthCenterFrequencyInGigahertz * 1000, network.ChannelBandwidth); - if (centerChannel - halfWidth < SixGHzSplitChannel) + if (lower) AddToChart(Chart6GHzLower, network); - if (centerChannel + halfWidth > SixGHzSplitChannel) + if (upper) AddToChart(Chart6GHzUpper, network); break; @@ -1012,19 +1011,6 @@ .. BuildChannelSet(149, 177, 4) // Channel 2 (5935 MHz) is below channel 1, at -3 on the axis - not labeled (the tooltip shows it). private static readonly HashSet ValidChannels6GHz = BuildChannelSet(1, 233, 4); - // Channel that splits the 6 GHz band into the lower (1-125) and upper (129-233) chart. 127 sits - // cleanly between the operating channels 125 and 129. - private const int SixGHzSplitChannel = 127; - - // The 5 GHz band has a large unused range between channel 64 (UNII-2) and channel 100 - // (UNII-2 Extended). On a frequency-linear axis this would render as dead space, so it is - // compressed: channels above 64 are shifted left, leaving only a small visual gap that still - // provides room for the channel-width trapezoids. - private const int FiveGHzGapStartChannel = 64; - private const int FiveGHzGapEndChannel = 100; - private const int FiveGHzGapDisplayUnits = 16; - private const int FiveGHzGapShift = FiveGHzGapEndChannel - FiveGHzGapStartChannel - FiveGHzGapDisplayUnits; - private static HashSet BuildChannelSet(int first, int last, int step) { var set = new HashSet(); @@ -1052,23 +1038,22 @@ private void InitializeCharts() // (min, max) in display space. The lower bound is extended below the first channel so the // left flank of its trapezoid reaches the baseline instead of being clipped. The 5 GHz // upper bound is reduced because the 64..100 dead zone is compressed. - Chart2Dot4GHz = new WiFiChannelChart(BuildXAxes(-2, 16, ValidChannels2Dot4GHz, false, labelColor), + Chart2Dot4GHz = new WiFiChannelChart(BuildXAxes(-2, 16, ValidChannels2Dot4GHz, WiFiRadio.GHz2dot4, labelColor), BuildYAxes(labelColor, separatorColor), BuildSections()); - Chart5GHz = new WiFiChannelChart(BuildXAxes(30, 160, ValidChannels5GHz, true, labelColor), + Chart5GHz = new WiFiChannelChart(BuildXAxes(30, 160, ValidChannels5GHz, WiFiRadio.GHz5, labelColor), BuildYAxes(labelColor, separatorColor), BuildSections()); - Chart6GHzLower = new WiFiChannelChart(BuildXAxes(-6, 128, ValidChannels6GHz, false, labelColor), + Chart6GHzLower = new WiFiChannelChart(BuildXAxes(-6, 128, ValidChannels6GHz, WiFiRadio.GHz6, labelColor), BuildYAxes(labelColor, separatorColor), BuildSections()); - Chart6GHzUpper = new WiFiChannelChart(BuildXAxes(126, 236, ValidChannels6GHz, false, labelColor), + Chart6GHzUpper = new WiFiChannelChart(BuildXAxes(126, 236, ValidChannels6GHz, WiFiRadio.GHz6, labelColor), BuildYAxes(labelColor, separatorColor), BuildSections()); } /// /// Builds an X-axis in channel-number space (which is linear with the channel frequency). /// Only channels contained in are labeled; all other tick - /// positions stay blank. When is set, the 5 GHz gap shift - /// is reversed before the label lookup. + /// positions stay blank (see ). /// - private static Axis[] BuildXAxes(double min, double max, HashSet validChannels, bool applyFiveGHzGap, + private static Axis[] BuildXAxes(double min, double max, HashSet validChannels, WiFiRadio radio, SKColor labelColor) { return @@ -1084,10 +1069,7 @@ private static Axis[] BuildXAxes(double min, double max, HashSet validChann ForceStepToMin = true, Labeler = value => { - var channel = (int)Math.Round(value); - - if (applyFiveGHzGap && channel > FiveGHzGapStartChannel) - channel += FiveGHzGapShift; + var channel = WiFiChannelAxis.PositionToChannel((int)Math.Round(value), radio); return validChannels.Contains(channel) ? channel.ToString() : string.Empty; }, @@ -1166,9 +1148,9 @@ private static (LineSeries Series, WiFiChannelLegendEntry Lege var color = ChartPalette[colorIndex % ChartPalette.Length]; double dbm = network.AvailableNetwork.NetworkRssiInDecibelMilliwatts; - var center = ChannelNumberToDisplay( - FrequencyToChannelAxis(network.ChannelBandwidthCenterFrequencyInGigahertz * 1000, network.Radio), - network.Radio); + var center = WiFiChannelAxis.ChannelToPosition( + WiFiChannelAxis.FrequencyToChannel(network.ChannelBandwidthCenterFrequencyInGigahertz * 1000, + network.Radio), network.Radio); // Channel-number space uses 5 MHz per unit, so a bandwidth in MHz spans bandwidth/5 units. var bandwidth = network.ChannelBandwidth; @@ -1334,35 +1316,6 @@ private static NotificationStatus GetNotificationStatus(WiFiNetworkChange change }; } - /// - /// Converts a channel center frequency (MHz) to channel-number space for the chart X axis. - /// This mapping is linear with frequency (5 MHz per unit). - /// - private static double FrequencyToChannelAxis(double frequencyMHz, WiFiRadio radio) - { - return radio switch - { - // Channel 14 is at 2484 MHz and does not follow the standard ch×5 + 2407 spacing. - WiFiRadio.GHz2dot4 => (int)Math.Round(frequencyMHz) == 2484 ? 14.0 : (frequencyMHz - 2407) / 5.0, - WiFiRadio.GHz5 => (frequencyMHz - 5000) / 5.0, - // Channel 2 is at 5935 MHz, below channel 1 (5955 MHz) - drawn at its real position (-3) - WiFiRadio.GHz6 => (frequencyMHz - 5950) / 5.0, - _ => 0 - }; - } - - /// - /// Maps a channel number to its display position on the X axis. For 5 GHz the unused - /// 64..100 range is compressed so it does not render as dead space. - /// - private static double ChannelNumberToDisplay(double channelNumber, WiFiRadio radio) - { - if (radio == WiFiRadio.GHz5 && channelNumber > FiveGHzGapStartChannel) - return channelNumber - FiveGHzGapShift; - - return channelNumber; - } - private void Connect() { var selectedAdapter = SelectedAdapter; From 7810b1f8cfd32a0f651952d2962652e5a539c85b Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:08:49 +0100 Subject: [PATCH 59/66] Fix: WiFi: 6 GHz network across the chart split in two colors (B34) A network drawn in both 6 GHz charts (e.g. 320 MHz around channel 127, B32) got its color from its position in each chart, so the two halves and their legend entries could have different colors. The two 6 GHz charts count the colors together now. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 1be379c328..7288945b54 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -881,7 +881,8 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals SelectedNetwork = network; } - // Series and legend of each chart (the color of a network depends on its position in its chart) + // Series and legend of each chart. The color of a network depends on its position in its chart; the two 6 GHz + // charts count together, so a network that is drawn in both has the same color in both. var charts = new Dictionary Series, List Legend)> { [Chart2Dot4GHz] = ([], []), @@ -890,10 +891,12 @@ private async Task ScanAsync(WiFiAdapterInfo adapterInfo, bool refreshing = fals [Chart6GHzUpper] = ([], []) }; - void AddToChart(WiFiChannelChart chart, WiFiNetworkInfo network) + var sixGHzColorIndex = 0; + + void AddToChart(WiFiChannelChart chart, WiFiNetworkInfo network, int? colorIndex = null) { var (series, legend) = charts[chart]; - var (networkSeries, networkLegend) = BuildNetworkSeries(network, series.Count); + var (networkSeries, networkLegend) = BuildNetworkSeries(network, colorIndex ?? series.Count); series.Add(networkSeries); legend.Add(networkLegend); @@ -919,10 +922,12 @@ void AddToChart(WiFiChannelChart chart, WiFiNetworkInfo network) network.ChannelBandwidthCenterFrequencyInGigahertz * 1000, network.ChannelBandwidth); if (lower) - AddToChart(Chart6GHzLower, network); + AddToChart(Chart6GHzLower, network, sixGHzColorIndex); if (upper) - AddToChart(Chart6GHzUpper, network); + AddToChart(Chart6GHzUpper, network, sixGHzColorIndex); + + sixGHzColorIndex++; break; } From eccb4a16f802849747b7568f55949b11349c95b4 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:09:20 +0100 Subject: [PATCH 60/66] Fix: WiFi: Grid jumped to the selected network on a selection change (B35) The selected network was scrolled into view on every change of the selection (P2), also when the user changed it, e.g. Ctrl+click on the first selected row while scrolled away: the grid jumped to the next selected row. It is only scrolled into view after the networks were replaced by a scan now. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/Views/WiFiView.xaml.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Source/NETworkManager/Views/WiFiView.xaml.cs b/Source/NETworkManager/Views/WiFiView.xaml.cs index 83871508dd..82015a5dc4 100644 --- a/Source/NETworkManager/Views/WiFiView.xaml.cs +++ b/Source/NETworkManager/Views/WiFiView.xaml.cs @@ -1,5 +1,5 @@ using System; -using System.ComponentModel; +using System.Collections.Specialized; using System.Windows; using System.Windows.Controls; using System.Windows.Threading; @@ -21,19 +21,20 @@ public WiFiView() DataContext = _viewModel; - _viewModel.PropertyChanged += ViewModel_PropertyChanged; + _viewModel.Networks.CollectionChanged += Networks_CollectionChanged; } /// - /// Scrolls the selected network into view, e.g. when it is selected again after the networks were scanned - /// again (see ). + /// Scrolls the selected network into view after the networks were replaced by a scan (it is selected again, + /// see ). Not when the user changes the selection (e.g. Ctrl+click), + /// the grid would jump. /// - private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) + private void Networks_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { - if (e.PropertyName != nameof(WiFiViewModel.SelectedNetwork) || _viewModel.SelectedNetwork == null) + if (e.Action != NotifyCollectionChangedAction.Reset) return; - // Wait until the DataGrid has processed the new items and the selection + // Wait until the network is selected again and the DataGrid has processed the new items and the selection Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { var network = _viewModel.SelectedNetwork; From e7428074991e699fa51524dd7a524b50b047dbd6 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:16:56 +0100 Subject: [PATCH 61/66] Chore: Feature review skill: Own table for missing tests in the report Missing tests (area 10, T1, ...) were reported under "Other" and could get lost. They get their own table with the bugs they would have caught and the proposed move to NETworkManager.Models. Co-Authored-By: Claude Opus 5.5 --- .claude/skills/feature-review/SKILL.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.claude/skills/feature-review/SKILL.md b/.claude/skills/feature-review/SKILL.md index e211a40718..42395206e2 100644 --- a/.claude/skills/feature-review/SKILL.md +++ b/.claude/skills/feature-review/SKILL.md @@ -187,9 +187,12 @@ Compared with: ### Missing essentials | # | Gap | Why it's essential | Size (small fix / issue) | -### Other (security, localization, docs, tests) +### Other (security, localization, docs) | # | Finding | Proposed fix | +### Tests +| # | Untested logic (`path:line`) | Bugs it would have caught | Proposal (move to `NETworkManager.Models` if needed + test cases) | + ### Refactoring / simplification | # | Where | Problem (duplication / complexity) | Proposal | Gain | Must stay identical / test | From de06b3b74431b0d3db74d2c88d817d1f2d27c097 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:22:30 +0100 Subject: [PATCH 62/66] Fix: WiFi: Connect / Disconnect during a reload of the adapters started a second scan (B36) Connect... / Disconnect were not blocked while the adapters were reloaded (the networks stay visible when the same adapter is reloaded). Disconnect scanned the old adapter while the reload scanned the reloaded one: two scans at the same time, and the changes since the last scan could be counted twice or lost. Both wait until the reload is finished now, like the other actions. Changelog entry of B31 extended. Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/ViewModels/WiFiViewModel.cs | 9 +++++---- Website/docs/changelog/next-release.md | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 7288945b54..19775daf97 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -672,13 +672,14 @@ private async Task ScanNetworksAction() public ICommand ConnectCommand => new RelayCommand(_ => ConnectAction(), ConnectDisconnect_CanExecute); /// - /// A network is selected that is still visible (not gone since the last scan), no connection is made and no scan - /// is running at the moment (connecting and disconnecting scan the networks again afterwards). + /// A network is selected that is still visible (not gone since the last scan), no connection is made, no scan is + /// running and the adapters are not reloaded at the moment (connecting and disconnecting scan the networks again + /// afterwards, the reload scans the reloaded adapter). /// private bool ConnectDisconnect_CanExecute(object obj) { - return SelectedNetwork is { Change: not WiFiNetworkChange.Gone } && !IsConnecting && !IsNetworksLoading && - !IsBackgroundSearchRunning; + return SelectedNetwork is { Change: not WiFiNetworkChange.Gone } && !IsConnecting && !IsAdaptersLoading && + !IsNetworksLoading && !IsBackgroundSearchRunning; } private void ConnectAction() diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index f7c61badf0..df92fc7d96 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -305,7 +305,7 @@ Release date: **xx.xx.2026** - Fixed the connection status message (e.g. "Connecting to ...") being hidden too early, while still connecting, if a previous message (e.g. after connecting or disconnecting) was shown shortly before. Each message is now shown for 15 seconds. [#3638](https://github.com/BornToBeRoot/NETworkManager/pull/3638) - Fixed the adapter list and the auto refresh keeping a removed adapter (e.g. an unplugged USB adapter) after **Refresh** found no adapter or failed: "No WiFi adapters found" is shown now. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) - Fixed WEP networks with open authentication being treated as unsecured: the connect dialog asked for no key (the connection failed) and the signal icon showed no lock. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed **Disconnect** (and **Connect...**) while the networks were scanned starting a second scan at the same time (the scan could fail with "busy"). Both wait until the scan is finished. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed **Disconnect** (and **Connect...**) while the networks were scanned or the adapters were reloaded starting a second scan at the same time (the scan could fail with "busy"). Both wait until the scan / reload is finished. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) **IP Scanner** From 90f309a70f545e671b0f2d797797e249678a5449 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 19:10:10 +0100 Subject: [PATCH 63/66] Docs: WiFi: PR number in the changelog (#3695) Co-Authored-By: Claude Opus 5.5 --- Website/docs/changelog/next-release.md | 70 +++++++++++++------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/Website/docs/changelog/next-release.md b/Website/docs/changelog/next-release.md index df92fc7d96..55d37ec050 100644 --- a/Website/docs/changelog/next-release.md +++ b/Website/docs/changelog/next-release.md @@ -41,8 +41,8 @@ Release date: **xx.xx.2026** **WiFi** -- Changes since the last scan: each scan is compared with the previous scan of the same adapter (by BSSID). The new column **Since last scan** shows networks that are **New**, **Gone** (shown faded until the next scan) or **Changed** (channel, channel width or security, the tooltip shows the previous values), the header shows the counters (e.g. `2 New · 1 Gone`). Also in the search and the export (`Change`). Useful with **Automatically update every** to see new access points or channel changes. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Notification for changes: when **Automatically update every** finds new, gone or changed networks, a notification popup (and optionally a sound) shows them, like the **IP Scanner**. Configurable in the new [WiFi settings](../application/wifi.md#settings) (**Show notification popup on changes**, **Play sound on changes**, **Display duration**). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Changes since the last scan: each scan is compared with the previous scan of the same adapter (by BSSID). The new column **Since last scan** shows networks that are **New**, **Gone** (shown faded until the next scan) or **Changed** (channel, channel width or security, the tooltip shows the previous values), the header shows the counters (e.g. `2 New · 1 Gone`). Also in the search and the export (`Change`). Useful with **Automatically update every** to see new access points or channel changes. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Notification for changes: when **Automatically update every** finds new, gone or changed networks, a notification popup (and optionally a sound) shows them, like the **IP Scanner**. Configurable in the new [WiFi settings](../application/wifi.md#settings) (**Show notification popup on changes**, **Play sound on changes**, **Display duration**). [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) **Traceroute** @@ -75,16 +75,16 @@ Release date: **xx.xx.2026** - The search filters after a short delay while typing instead of on every key press, `Enter` filters right away. [#3660](https://github.com/BornToBeRoot/NETworkManager/pull/3660) - The time of the last scan of the networks (`Last scan at 14:32`, the date in the tooltip) is shown in their header, with **Automatically update every** a countdown to the next scan; the line below only shows errors and the connection status. Reloading the network adapters is faster (the minimum of 2.5 seconds runs while loading) and the reload icon spins until it is finished. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) -- A channel width that could not be read from the beacon of the access point and is estimated is shown as `~80 MHz` (grid, copy and the tooltip of the **Channels** tab), the tooltip of the cell explains it. Estimated widths on 2.4 GHz are 20 MHz (40 MHz is rarely used there). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- After allowing the access to the WiFi adapter in the Windows settings (location), **Refresh** below the message (or switching back to WiFi) loads the adapters. A restart of the application is no longer needed. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- The BSSID is shown, copied and exported in the same format as the MAC addresses of the other tools (`AA:BB:CC:DD:EE:FF` instead of `aa:bb:cc:dd:ee:ff`). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Reloading the adapters keeps the networks visible while they are scanned again (the refresh icon spins), instead of replacing them by the loading indicator. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- An unknown security or PHY kind is shown as `-/-` (like an unknown vendor) instead of the untranslated text `Unknown`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- The export contains the values shown in the grid that were missing: `IsConnected`, `Security`, `Channel`, `ChannelWidth` (MHz), `ChannelWidthEstimated` and `Vendor` (appended as the last columns / elements). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- **Export...** > all exports the networks shown in the grid (filtered by band and search) in the order shown, the selected networks are exported in the order shown too. The file is written in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Scanning the networks (also **Automatically update every**) no longer freezes the window briefly: the connected network is read from the WiFi API instead of `netsh` via PowerShell, and the vendor lookups run in the background. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- The selected network stays selected (and in view) when the networks are scanned again, e.g. with **Automatically update every**. The list is replaced at once instead of network by network. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- If several networks are selected, **Copy...** > **SSID** / **BSSID** copies the values of all selected networks (one per line, in the order shown, without duplicates). [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- A channel width that could not be read from the beacon of the access point and is estimated is shown as `~80 MHz` (grid, copy and the tooltip of the **Channels** tab), the tooltip of the cell explains it. Estimated widths on 2.4 GHz are 20 MHz (40 MHz is rarely used there). [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- After allowing the access to the WiFi adapter in the Windows settings (location), **Refresh** below the message (or switching back to WiFi) loads the adapters. A restart of the application is no longer needed. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- The BSSID is shown, copied and exported in the same format as the MAC addresses of the other tools (`AA:BB:CC:DD:EE:FF` instead of `aa:bb:cc:dd:ee:ff`). [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Reloading the adapters keeps the networks visible while they are scanned again (the refresh icon spins), instead of replacing them by the loading indicator. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- An unknown security or PHY kind is shown as `-/-` (like an unknown vendor) instead of the untranslated text `Unknown`. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- The export contains the values shown in the grid that were missing: `IsConnected`, `Security`, `Channel`, `ChannelWidth` (MHz), `ChannelWidthEstimated` and `Vendor` (appended as the last columns / elements). [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- **Export...** > all exports the networks shown in the grid (filtered by band and search) in the order shown, the selected networks are exported in the order shown too. The file is written in the background. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Scanning the networks (also **Automatically update every**) no longer freezes the window briefly: the connected network is read from the WiFi API instead of `netsh` via PowerShell, and the vendor lookups run in the background. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- The selected network stays selected (and in view) when the networks are scanned again, e.g. with **Automatically update every**. The list is replaced at once instead of network by network. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- If several networks are selected, **Copy...** > **SSID** / **BSSID** copies the values of all selected networks (one per line, in the order shown, without duplicates). [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) **IP Scanner** @@ -282,30 +282,30 @@ Release date: **xx.xx.2026** - Fixed **Automatically update every** `1` / `5` minutes refreshing only every hour / every 5 hours. [#3685](https://github.com/BornToBeRoot/NETworkManager/pull/3685) - Fixed the auto refresh not being resumed after switching back from another tool. [#3639](https://github.com/BornToBeRoot/NETworkManager/pull/3639) - Fixed columns that couldn't be made wider than the window (by dragging or double-clicking the gripper). The grid scrolls horizontally now, the last (or main) column still fills the remaining width. [#3557](https://github.com/BornToBeRoot/NETworkManager/issues/3557) -- Fixed the application crashing when **Automatically update every** was enabled and no WiFi adapter was found (e.g. disabled or unplugged). `F5` no longer tries to scan without an adapter. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed the **Refresh** button below "No WiFi adapters found" being disabled while **Automatically update every** was enabled. The adapters could only be loaded again after a restart. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed the application crashing if connecting to or disconnecting from a network failed with an error (e.g. the adapter was disabled meanwhile). The error is shown in the status below the networks, and scanning is no longer blocked afterwards. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed **Connect...** and **Disconnect** being available while a connection is made, and **Connect...** failing if the networks were scanned again while the context menu was open. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed **Use credentials** being ignored when connecting to a WPA / WPA2 / WPA3 Enterprise network (EAP). If it is disabled, no username and password are sent and Windows uses the logged-on user or a certificate. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed the **WPS** button of the connect dialog never being shown. Whether a network supports WPS (push button) is checked again when the dialog is opened. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed the connect dialog not focusing the first input: the SSID of a hidden network or the username (EAP) was not focused. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed the connect dialog asking for a pre-shared key for WPA3 Enterprise networks (instead of username and password) and for OWE (Enhanced Open) networks, which need no password. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed networks with a channel width of 40, 80 or 160 MHz being drawn at the wrong position on the **Channels** tab: they were centered on their primary channel (e.g. 80 MHz on channel 36 over the channels 28 - 44 instead of 36 - 48), so overlapping networks were shown wrong. The center of the whole channel is read from the beacon now. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed WiFi 7 (802.11be) networks with a channel width of 320 MHz being shown with 160 MHz. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed the 5 GHz chart of the **Channels** tab labeling the channels above 144 as 148, 152 ... 164 instead of 149, 153 ... 165. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed networks on the 5 GHz channels 169 - 177 (UNII-4) and 32 being shown with channel `-1`, without band (always shown, not affected by the band filter) and missing on the **Channels** tab. 6 GHz channel 2 (5935 MHz) is shown as channel `2` instead of `-1`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed sorting by the signal icon (first column) and by **Encryption** not changing the order of the networks. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed the networks of the previously selected adapter possibly being shown after selecting another adapter while a scan was running. The adapter can't be changed while scanning or connecting. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed all networks and charts being removed if a refresh (manual, **Automatically update every** or after connecting) failed. The networks of the last scan stay, the error is shown below them. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed the message after disconnecting from a hidden network missing the name (" disconnected!"), and the search not finding hidden networks by the shown text `Hidden Network`. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed the icon of the adapter selection (connected / disconnected) keeping the state of when the adapters were loaded. It is updated after each scan, e.g. after connecting or disconnecting. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed `F5` scanning and **Automatically update every** refreshing the networks behind an open dialog (e.g. **Connect...** or **Export...**). The auto refresh waits until the dialog is closed. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed the CSV export breaking the row of a network whose SSID contains a comma or a quote. SSID, security and vendor are quoted. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed a network being marked as **Connected** that the selected adapter isn't connected to, if the computer has several WiFi adapters and the selected one was disconnected. An error while reading the connected network no longer ends the scan. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the application crashing when **Automatically update every** was enabled and no WiFi adapter was found (e.g. disabled or unplugged). `F5` no longer tries to scan without an adapter. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed the **Refresh** button below "No WiFi adapters found" being disabled while **Automatically update every** was enabled. The adapters could only be loaded again after a restart. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed the application crashing if connecting to or disconnecting from a network failed with an error (e.g. the adapter was disabled meanwhile). The error is shown in the status below the networks, and scanning is no longer blocked afterwards. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed **Connect...** and **Disconnect** being available while a connection is made, and **Connect...** failing if the networks were scanned again while the context menu was open. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed **Use credentials** being ignored when connecting to a WPA / WPA2 / WPA3 Enterprise network (EAP). If it is disabled, no username and password are sent and Windows uses the logged-on user or a certificate. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed the **WPS** button of the connect dialog never being shown. Whether a network supports WPS (push button) is checked again when the dialog is opened. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed the connect dialog not focusing the first input: the SSID of a hidden network or the username (EAP) was not focused. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed the connect dialog asking for a pre-shared key for WPA3 Enterprise networks (instead of username and password) and for OWE (Enhanced Open) networks, which need no password. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed networks with a channel width of 40, 80 or 160 MHz being drawn at the wrong position on the **Channels** tab: they were centered on their primary channel (e.g. 80 MHz on channel 36 over the channels 28 - 44 instead of 36 - 48), so overlapping networks were shown wrong. The center of the whole channel is read from the beacon now. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed WiFi 7 (802.11be) networks with a channel width of 320 MHz being shown with 160 MHz. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed the 5 GHz chart of the **Channels** tab labeling the channels above 144 as 148, 152 ... 164 instead of 149, 153 ... 165. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed networks on the 5 GHz channels 169 - 177 (UNII-4) and 32 being shown with channel `-1`, without band (always shown, not affected by the band filter) and missing on the **Channels** tab. 6 GHz channel 2 (5935 MHz) is shown as channel `2` instead of `-1`. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed sorting by the signal icon (first column) and by **Encryption** not changing the order of the networks. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed the networks of the previously selected adapter possibly being shown after selecting another adapter while a scan was running. The adapter can't be changed while scanning or connecting. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed all networks and charts being removed if a refresh (manual, **Automatically update every** or after connecting) failed. The networks of the last scan stay, the error is shown below them. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed the message after disconnecting from a hidden network missing the name (" disconnected!"), and the search not finding hidden networks by the shown text `Hidden Network`. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed the icon of the adapter selection (connected / disconnected) keeping the state of when the adapters were loaded. It is updated after each scan, e.g. after connecting or disconnecting. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed `F5` scanning and **Automatically update every** refreshing the networks behind an open dialog (e.g. **Connect...** or **Export...**). The auto refresh waits until the dialog is closed. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed the CSV export breaking the row of a network whose SSID contains a comma or a quote. SSID, security and vendor are quoted. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed a network being marked as **Connected** that the selected adapter isn't connected to, if the computer has several WiFi adapters and the selected one was disconnected. An error while reading the connected network no longer ends the scan. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) - Fixed the connection status message (e.g. "Connecting to ...") being hidden too early, while still connecting, if a previous message (e.g. after connecting or disconnecting) was shown shortly before. Each message is now shown for 15 seconds. [#3638](https://github.com/BornToBeRoot/NETworkManager/pull/3638) -- Fixed the adapter list and the auto refresh keeping a removed adapter (e.g. an unplugged USB adapter) after **Refresh** found no adapter or failed: "No WiFi adapters found" is shown now. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed WEP networks with open authentication being treated as unsecured: the connect dialog asked for no key (the connection failed) and the signal icon showed no lock. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) -- Fixed **Disconnect** (and **Connect...**) while the networks were scanned or the adapters were reloaded starting a second scan at the same time (the scan could fail with "busy"). Both wait until the scan / reload is finished. [#PR](https://github.com/BornToBeRoot/NETworkManager/pull/PR) +- Fixed the adapter list and the auto refresh keeping a removed adapter (e.g. an unplugged USB adapter) after **Refresh** found no adapter or failed: "No WiFi adapters found" is shown now. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed WEP networks with open authentication being treated as unsecured: the connect dialog asked for no key (the connection failed) and the signal icon showed no lock. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) +- Fixed **Disconnect** (and **Connect...**) while the networks were scanned or the adapters were reloaded starting a second scan at the same time (the scan could fail with "busy"). Both wait until the scan / reload is finished. [#3695](https://github.com/BornToBeRoot/NETworkManager/pull/3695) **IP Scanner** From 3d724cf5ba20f6ff4b86b7200ebc98fe7a2221a5 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 21:27:12 +0100 Subject: [PATCH 64/66] Refactor: WiFi: Shared check for an open dialog (DialogHelper.IsAnyDialogOpen) Co-Authored-By: Claude Opus 5.5 --- Source/NETworkManager/DialogHelper.cs | 15 ++++++++++++++- .../NETworkManager/ViewModels/WiFiViewModel.cs | 17 +++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Source/NETworkManager/DialogHelper.cs b/Source/NETworkManager/DialogHelper.cs index 59d40aa040..6da99c2531 100644 --- a/Source/NETworkManager/DialogHelper.cs +++ b/Source/NETworkManager/DialogHelper.cs @@ -1,4 +1,5 @@ -using MahApps.Metro.SimpleChildWindow; +using MahApps.Metro.Controls; +using MahApps.Metro.SimpleChildWindow; using NETworkManager.Localization.Resources; using NETworkManager.Settings; using NETworkManager.Utilities; @@ -108,6 +109,18 @@ public static async Task ShowConfirmationMessageAsync(Window parentWindow, return result; } + /// + /// Gets whether a dialog (MahApps dialog or child window) is open in the main window, or the main window doesn't + /// exist yet - commands that would open another dialog, or run (e.g. refresh) behind it, can't be executed. + /// + /// True if a dialog is open or there is no main window. + public static bool IsAnyDialogOpen() + { + return Application.Current.MainWindow is not MetroWindow mainWindow || + mainWindow.IsAnyDialogOpen || + ConfigurationManager.Current.IsChildWindowOpen; + } + /// /// Formats the given items as a bulleted list (one item per line, prefixed with "- ") to show them /// in a dialog message, e.g. the entries that will be deleted. Only the first diff --git a/Source/NETworkManager/ViewModels/WiFiViewModel.cs b/Source/NETworkManager/ViewModels/WiFiViewModel.cs index 19775daf97..283a4da165 100644 --- a/Source/NETworkManager/ViewModels/WiFiViewModel.cs +++ b/Source/NETworkManager/ViewModels/WiFiViewModel.cs @@ -5,7 +5,6 @@ using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.Painting.Effects; using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Controls; using NETworkManager.Converters; @@ -554,7 +553,7 @@ public WiFiViewModel() // the adapter again, which scans it), networks are loading or a connection is made (tried again after the // interval) _autoRefreshTimer = new AutoRefreshTimer(() => ScanAsync(SelectedAdapter, true, isAutoRefresh: true), - () => SelectedAdapter != null && !IsDialogOpen() && !IsAdaptersLoading && !IsNetworksLoading && + () => SelectedAdapter != null && !DialogHelper.IsAnyDialogOpen() && !IsAdaptersLoading && !IsNetworksLoading && !IsBackgroundSearchRunning && !IsConnecting); AutoRefreshTimes = CollectionViewSource.GetDefaultView(AutoRefreshTime.GetDefaults); @@ -636,20 +635,10 @@ private void LoadSettings() private bool ReloadAdapter_CanExecute(object obj) { // Not blocked by the auto refresh (it only scans the networks): without an adapter its toggle is hidden - return !IsDialogOpen() && !IsAdaptersLoading && !IsNetworksLoading && !IsBackgroundSearchRunning && + return !DialogHelper.IsAnyDialogOpen() && !IsAdaptersLoading && !IsNetworksLoading && !IsBackgroundSearchRunning && !IsConnecting; } - /// - /// A dialog (e.g. connect, export) is open: no refresh behind it (F5), and no auto refresh. - /// - private static bool IsDialogOpen() - { - return Application.Current.MainWindow == null || - ((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen || - ConfigurationManager.Current.IsChildWindowOpen; - } - private void ReloadAdapterAction() { _ = LoadAdaptersAsync(SelectedAdapter?.NetworkInterfaceInfo.Id); @@ -660,7 +649,7 @@ private void ReloadAdapterAction() private bool ScanNetworks_CanExecute(object obj) { - return SelectedAdapter != null && !IsDialogOpen() && !IsAdaptersLoading && !IsNetworksLoading && + return SelectedAdapter != null && !DialogHelper.IsAnyDialogOpen() && !IsAdaptersLoading && !IsNetworksLoading && !IsBackgroundSearchRunning && !AutoRefreshEnabled && !IsConnecting; } From 55d4f8c330ef288918b6a2bcbe4751b6edd17c45 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 21:27:12 +0100 Subject: [PATCH 65/66] Refactor: Use DialogHelper.IsAnyDialogOpen in all view models Replaces the copied check (main window, MahApps dialog, child window) in 21 view models; no behaviour change. Co-Authored-By: Claude Opus 5.5 --- .../ViewModels/BitCalculatorViewModel.cs | 5 +---- .../ViewModels/ConnectionsViewModel.cs | 5 +---- .../NETworkManager/ViewModels/DNSLookupViewModel.cs | 5 +---- .../NETworkManager/ViewModels/FirewallViewModel.cs | 5 +---- .../ViewModels/HostsFileEditorViewModel.cs | 9 ++------- .../ViewModels/IPGeolocationViewModel.cs | 5 +---- .../NETworkManager/ViewModels/IPScannerViewModel.cs | 5 +---- .../NETworkManager/ViewModels/ListenersViewModel.cs | 5 +---- .../ViewModels/LookupOUILookupViewModel.cs | 5 +---- .../ViewModels/LookupPortViewModel.cs | 5 +---- .../ViewModels/NeighborTableViewModel.cs | 9 ++------- .../ViewModels/NetworkInterfaceViewModel.cs | 13 +++---------- .../ViewModels/PingMonitorHostViewModel.cs | 5 +---- .../ViewModels/PortScannerViewModel.cs | 5 +---- Source/NETworkManager/ViewModels/RDAPViewModel.cs | 5 +---- Source/NETworkManager/ViewModels/SNMPViewModel.cs | 5 +---- .../ViewModels/SNTPLookupViewModel.cs | 4 +--- .../SubnetCalculatorCalculatorViewModel.cs | 5 +---- .../SubnetCalculatorSubnettingViewModel.cs | 5 +---- .../SubnetCalculatorWideSubnetViewModel.cs | 5 +---- .../ViewModels/TracerouteViewModel.cs | 4 +--- .../NETworkManager/ViewModels/WakeOnLANViewModel.cs | 5 +---- Source/NETworkManager/ViewModels/WhoisViewModel.cs | 5 +---- 23 files changed, 27 insertions(+), 102 deletions(-) diff --git a/Source/NETworkManager/ViewModels/BitCalculatorViewModel.cs b/Source/NETworkManager/ViewModels/BitCalculatorViewModel.cs index 9d9141aa88..8bd4da2372 100644 --- a/Source/NETworkManager/ViewModels/BitCalculatorViewModel.cs +++ b/Source/NETworkManager/ViewModels/BitCalculatorViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Localization.Resources; using NETworkManager.Models.Export; @@ -181,9 +180,7 @@ private void LoadSettings() /// true if the command can be executed; otherwise, false. private bool Calculate_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } /// diff --git a/Source/NETworkManager/ViewModels/ConnectionsViewModel.cs b/Source/NETworkManager/ViewModels/ConnectionsViewModel.cs index 555ed6decd..9b3b191627 100644 --- a/Source/NETworkManager/ViewModels/ConnectionsViewModel.cs +++ b/Source/NETworkManager/ViewModels/ConnectionsViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Localization; using NETworkManager.Localization.Resources; @@ -281,9 +280,7 @@ private set /// true if the command can be executed; otherwise, false. private bool Refresh_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen && + return !DialogHelper.IsAnyDialogOpen() && !IsRefreshing && !AutoRefreshEnabled; } diff --git a/Source/NETworkManager/ViewModels/DNSLookupViewModel.cs b/Source/NETworkManager/ViewModels/DNSLookupViewModel.cs index 1fe380227e..4edb355348 100644 --- a/Source/NETworkManager/ViewModels/DNSLookupViewModel.cs +++ b/Source/NETworkManager/ViewModels/DNSLookupViewModel.cs @@ -1,6 +1,5 @@ using DnsClient; using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Controls; using NETworkManager.Localization.Resources; @@ -342,9 +341,7 @@ private void LoadTypes() /// true if the command can be executed; otherwise, false. private bool Query_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } /// diff --git a/Source/NETworkManager/ViewModels/FirewallViewModel.cs b/Source/NETworkManager/ViewModels/FirewallViewModel.cs index 2df7ca0155..dd96babc4f 100644 --- a/Source/NETworkManager/ViewModels/FirewallViewModel.cs +++ b/Source/NETworkManager/ViewModels/FirewallViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Controls; using NETworkManager.Converters; @@ -554,9 +553,7 @@ private async Task DeleteRules() private bool ModifyRule_CanExecute() { return ConfigurationManager.Current.IsAdmin && - Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen && + !DialogHelper.IsAnyDialogOpen() && !IsRefreshing && !IsModifying; } diff --git a/Source/NETworkManager/ViewModels/HostsFileEditorViewModel.cs b/Source/NETworkManager/ViewModels/HostsFileEditorViewModel.cs index 0a95474a86..d61ed5d59c 100644 --- a/Source/NETworkManager/ViewModels/HostsFileEditorViewModel.cs +++ b/Source/NETworkManager/ViewModels/HostsFileEditorViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Localization.Resources; using NETworkManager.Models; @@ -270,9 +269,7 @@ private void LoadSettings() /// true if the command can be executed; otherwise, false. private bool Refresh_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen && + return !DialogHelper.IsAnyDialogOpen() && !IsRefreshing && !IsModifying; } @@ -635,9 +632,7 @@ private async Task DeleteEntryAction() private bool ModifyEntry_CanExecute(object obj) { return ConfigurationManager.Current.IsAdmin && - Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen && + !DialogHelper.IsAnyDialogOpen() && !IsRefreshing && !IsModifying; } diff --git a/Source/NETworkManager/ViewModels/IPGeolocationViewModel.cs b/Source/NETworkManager/ViewModels/IPGeolocationViewModel.cs index 8f24b9eabd..5b8821c809 100644 --- a/Source/NETworkManager/ViewModels/IPGeolocationViewModel.cs +++ b/Source/NETworkManager/ViewModels/IPGeolocationViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Controls; using NETworkManager.Localization.Resources; @@ -194,9 +193,7 @@ private void LoadSettings() /// true if the command can be executed; otherwise, false. private bool Query_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } /// diff --git a/Source/NETworkManager/ViewModels/IPScannerViewModel.cs b/Source/NETworkManager/ViewModels/IPScannerViewModel.cs index 0374f001ac..8d43f81cf2 100644 --- a/Source/NETworkManager/ViewModels/IPScannerViewModel.cs +++ b/Source/NETworkManager/ViewModels/IPScannerViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Controls; using NETworkManager.Converters; @@ -733,9 +732,7 @@ public void OnLoaded() private bool Scan_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void ScanAction() diff --git a/Source/NETworkManager/ViewModels/ListenersViewModel.cs b/Source/NETworkManager/ViewModels/ListenersViewModel.cs index 33814dfbe0..0b4ae001ae 100644 --- a/Source/NETworkManager/ViewModels/ListenersViewModel.cs +++ b/Source/NETworkManager/ViewModels/ListenersViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Localization.Resources; using NETworkManager.Models.Export; @@ -272,9 +271,7 @@ private set /// true if the command can be executed; otherwise, false. private bool Refresh_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen && + return !DialogHelper.IsAnyDialogOpen() && !IsRefreshing && !AutoRefreshEnabled; } diff --git a/Source/NETworkManager/ViewModels/LookupOUILookupViewModel.cs b/Source/NETworkManager/ViewModels/LookupOUILookupViewModel.cs index 0a3ca4a7ff..35b0ea1b5e 100644 --- a/Source/NETworkManager/ViewModels/LookupOUILookupViewModel.cs +++ b/Source/NETworkManager/ViewModels/LookupOUILookupViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Localization.Resources; using NETworkManager.Models.Export; @@ -188,9 +187,7 @@ public bool NothingFound /// true if the command can be executed; otherwise, false. private bool OUILookup_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen && + return !DialogHelper.IsAnyDialogOpen() && !HasError; } diff --git a/Source/NETworkManager/ViewModels/LookupPortViewModel.cs b/Source/NETworkManager/ViewModels/LookupPortViewModel.cs index 7a5cda2a85..9dfa14b708 100644 --- a/Source/NETworkManager/ViewModels/LookupPortViewModel.cs +++ b/Source/NETworkManager/ViewModels/LookupPortViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Localization.Resources; using NETworkManager.Models.Export; @@ -186,9 +185,7 @@ public bool NothingFound /// true if the command can be executed; otherwise, false. private bool PortLookup_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen && !HasError; + return !DialogHelper.IsAnyDialogOpen() && !HasError; } /// diff --git a/Source/NETworkManager/ViewModels/NeighborTableViewModel.cs b/Source/NETworkManager/ViewModels/NeighborTableViewModel.cs index 6613a2c2bb..d6b3b2fc3d 100644 --- a/Source/NETworkManager/ViewModels/NeighborTableViewModel.cs +++ b/Source/NETworkManager/ViewModels/NeighborTableViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Localization.Resources; using NETworkManager.Models.Export; @@ -284,9 +283,7 @@ private set private bool Refresh_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen && + return !DialogHelper.IsAnyDialogOpen() && !IsRefreshing && !IsModifying && !AutoRefreshEnabled; @@ -401,9 +398,7 @@ private async Task AddEntryAction() private bool ModifyEntry_CanExecute(object parameter) { return ConfigurationManager.Current.IsAdmin && - Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen && + !DialogHelper.IsAnyDialogOpen() && !IsRefreshing && !IsModifying; } diff --git a/Source/NETworkManager/ViewModels/NetworkInterfaceViewModel.cs b/Source/NETworkManager/ViewModels/NetworkInterfaceViewModel.cs index 70f1e90188..9a77766a01 100644 --- a/Source/NETworkManager/ViewModels/NetworkInterfaceViewModel.cs +++ b/Source/NETworkManager/ViewModels/NetworkInterfaceViewModel.cs @@ -5,7 +5,6 @@ using LiveChartsCore.SkiaSharpView.Painting; using LiveChartsCore.SkiaSharpView.Painting.Effects; using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Localization.Resources; using NETworkManager.Models; @@ -748,9 +747,7 @@ private async Task LoadNetworkInterfaces() private bool ReloadNetworkInterfaces_CanExecute(object obj) { return !IsNetworkInterfaceLoading && - Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + !DialogHelper.IsAnyDialogOpen(); } /// @@ -841,15 +838,11 @@ private void ApplyProfileAction() private bool AdditionalCommands_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private bool ConfigureCommands_CanExecute(object parameter) => HasPermissionToConfigure && - Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + !DialogHelper.IsAnyDialogOpen(); /// /// Gets the command to restart the application with administrator privileges. diff --git a/Source/NETworkManager/ViewModels/PingMonitorHostViewModel.cs b/Source/NETworkManager/ViewModels/PingMonitorHostViewModel.cs index 3ea8185627..625abfbdb3 100644 --- a/Source/NETworkManager/ViewModels/PingMonitorHostViewModel.cs +++ b/Source/NETworkManager/ViewModels/PingMonitorHostViewModel.cs @@ -1,4 +1,3 @@ -using MahApps.Metro.Controls; using NETworkManager.Converters; using NETworkManager.Localization.Resources; using NETworkManager.Models; @@ -196,9 +195,7 @@ public PingMonitorHostViewModel() private bool Ping_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void PingAction() diff --git a/Source/NETworkManager/ViewModels/PortScannerViewModel.cs b/Source/NETworkManager/ViewModels/PortScannerViewModel.cs index aa2c83892a..567f8ffba7 100644 --- a/Source/NETworkManager/ViewModels/PortScannerViewModel.cs +++ b/Source/NETworkManager/ViewModels/PortScannerViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Controls; using NETworkManager.Converters; @@ -693,9 +692,7 @@ public void OnClose() private bool Scan_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void ScanAction() diff --git a/Source/NETworkManager/ViewModels/RDAPViewModel.cs b/Source/NETworkManager/ViewModels/RDAPViewModel.cs index 487560ab72..ce5e91f3d6 100644 --- a/Source/NETworkManager/ViewModels/RDAPViewModel.cs +++ b/Source/NETworkManager/ViewModels/RDAPViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Controls; using NETworkManager.Localization.Resources; @@ -247,9 +246,7 @@ private void LoadSettings() private bool Query_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void QueryAction() diff --git a/Source/NETworkManager/ViewModels/SNMPViewModel.cs b/Source/NETworkManager/ViewModels/SNMPViewModel.cs index ac69b07627..8ffdcf8914 100644 --- a/Source/NETworkManager/ViewModels/SNMPViewModel.cs +++ b/Source/NETworkManager/ViewModels/SNMPViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Controls; using NETworkManager.Localization; @@ -438,9 +437,7 @@ private set private bool Work_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void WorkAction() diff --git a/Source/NETworkManager/ViewModels/SNTPLookupViewModel.cs b/Source/NETworkManager/ViewModels/SNTPLookupViewModel.cs index ce64260c65..65bfee71ed 100644 --- a/Source/NETworkManager/ViewModels/SNTPLookupViewModel.cs +++ b/Source/NETworkManager/ViewModels/SNTPLookupViewModel.cs @@ -169,9 +169,7 @@ private void LoadSettings() private bool Query_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void QueryAction() diff --git a/Source/NETworkManager/ViewModels/SubnetCalculatorCalculatorViewModel.cs b/Source/NETworkManager/ViewModels/SubnetCalculatorCalculatorViewModel.cs index 6c62b44e98..359b370bf9 100644 --- a/Source/NETworkManager/ViewModels/SubnetCalculatorCalculatorViewModel.cs +++ b/Source/NETworkManager/ViewModels/SubnetCalculatorCalculatorViewModel.cs @@ -4,7 +4,6 @@ using System.Windows; using System.Windows.Data; using System.Windows.Input; -using MahApps.Metro.Controls; using NETworkManager.Models.Network; using NETworkManager.Settings; using NETworkManager.Utilities; @@ -88,9 +87,7 @@ private set private bool Calculate_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void CalculateAction() diff --git a/Source/NETworkManager/ViewModels/SubnetCalculatorSubnettingViewModel.cs b/Source/NETworkManager/ViewModels/SubnetCalculatorSubnettingViewModel.cs index 904b9162e4..8847bdacd7 100644 --- a/Source/NETworkManager/ViewModels/SubnetCalculatorSubnettingViewModel.cs +++ b/Source/NETworkManager/ViewModels/SubnetCalculatorSubnettingViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Localization.Resources; using NETworkManager.Models.Export; @@ -150,9 +149,7 @@ public IList SelectedResults private bool Calculate_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void CalculateAction() diff --git a/Source/NETworkManager/ViewModels/SubnetCalculatorWideSubnetViewModel.cs b/Source/NETworkManager/ViewModels/SubnetCalculatorWideSubnetViewModel.cs index 4410227493..7d5e6d6cc8 100644 --- a/Source/NETworkManager/ViewModels/SubnetCalculatorWideSubnetViewModel.cs +++ b/Source/NETworkManager/ViewModels/SubnetCalculatorWideSubnetViewModel.cs @@ -4,7 +4,6 @@ using System.Windows; using System.Windows.Data; using System.Windows.Input; -using MahApps.Metro.Controls; using NETworkManager.Models.Network; using NETworkManager.Settings; using NETworkManager.Utilities; @@ -106,9 +105,7 @@ private set private bool Calculate_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void CalculateAction() diff --git a/Source/NETworkManager/ViewModels/TracerouteViewModel.cs b/Source/NETworkManager/ViewModels/TracerouteViewModel.cs index d125f1caba..d7ec5ec390 100644 --- a/Source/NETworkManager/ViewModels/TracerouteViewModel.cs +++ b/Source/NETworkManager/ViewModels/TracerouteViewModel.cs @@ -283,9 +283,7 @@ private void LoadSettings() private bool Trace_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow)!.IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void TraceAction() diff --git a/Source/NETworkManager/ViewModels/WakeOnLANViewModel.cs b/Source/NETworkManager/ViewModels/WakeOnLANViewModel.cs index f34adb2788..c686513669 100644 --- a/Source/NETworkManager/ViewModels/WakeOnLANViewModel.cs +++ b/Source/NETworkManager/ViewModels/WakeOnLANViewModel.cs @@ -1,4 +1,3 @@ -using MahApps.Metro.Controls; using NETworkManager.Localization.Resources; using NETworkManager.Models; using NETworkManager.Models.Network; @@ -169,9 +168,7 @@ public WakeOnLANViewModel() private bool WakeUpAction_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void WakeUpAction() diff --git a/Source/NETworkManager/ViewModels/WhoisViewModel.cs b/Source/NETworkManager/ViewModels/WhoisViewModel.cs index 03f0c4d8d5..fc55bf03ab 100644 --- a/Source/NETworkManager/ViewModels/WhoisViewModel.cs +++ b/Source/NETworkManager/ViewModels/WhoisViewModel.cs @@ -1,5 +1,4 @@ using log4net; -using MahApps.Metro.Controls; using MahApps.Metro.SimpleChildWindow; using NETworkManager.Controls; using NETworkManager.Localization.Resources; @@ -149,9 +148,7 @@ private void LoadSettings() private bool Query_CanExecute(object parameter) { - return Application.Current.MainWindow != null && - !((MetroWindow)Application.Current.MainWindow).IsAnyDialogOpen && - !ConfigurationManager.Current.IsChildWindowOpen; + return !DialogHelper.IsAnyDialogOpen(); } private void QueryAction() From 685856a535d48d75f051758c19a13f25fa8285d8 Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Sun, 8 Nov 2026 21:27:20 +0100 Subject: [PATCH 66/66] Chore: Feature review skill: DialogHelper.IsAnyDialogOpen in the conventions Co-Authored-By: Claude Opus 5.5 --- .claude/skills/feature-review/references/conventions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.claude/skills/feature-review/references/conventions.md b/.claude/skills/feature-review/references/conventions.md index c8090b97f1..fef65d97ea 100644 --- a/.claude/skills/feature-review/references/conventions.md +++ b/.claude/skills/feature-review/references/conventions.md @@ -134,6 +134,8 @@ Reference: `HostsFileEditorView.xaml`, `FirewallView.xaml`. - Child windows: set `ConfigurationManager.Current.IsChildWindowOpen` before showing and reset it in both OK and Cancel handlers; dialog view models get OK/Cancel actions. +- Commands that open a dialog or run behind one (scan, refresh, auto refresh, modify) check + `!DialogHelper.IsAnyDialogOpen()` in their `CanExecute` (main window, MahApps dialog, child window), no own copy. - Add/edit/copy dialogs share one view model with `EditMode` (`Add`, `Edit`, `Copy`; profiles use `ProfileEditMode`). Copy appends `" - " + Strings.CopyNoun` to a name where names identify items. - Deletes are confirmed with `DialogHelper.ShowConfirmationMessageAsync(..., ChildWindowIcon.Info, Strings.Delete)`.