Feature: Improve bandwidth meter & fix bugs#3457
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes the Network Interface bandwidth meter by migrating its charting to LiveCharts2, improving sampling accuracy, and adding a configurable chart time window with settings/documentation support.
Changes:
- Replaced the bandwidth chart and tooltip with LiveCharts2 equivalents, including live/pan/zoom behavior.
- Refactored bandwidth sampling to use elapsed time and handle interface/statistics failures more robustly.
- Added Network Interface chart-time settings, converters, and documentation updates.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
Website/docs/application/network-interface.md |
Documents bandwidth chart behavior and the new chart-time setting. |
Source/NETworkManager/Views/NetworkInterfaceView.xaml |
Migrates bandwidth UI chart to LiveCharts2 and updates speed/byte tooltips. |
Source/NETworkManager/Views/NetworkInterfaceSettingsView.xaml |
Adds Network Interface settings UI. |
Source/NETworkManager/Views/NetworkInterfaceSettingsView.xaml.cs |
Wires the settings view to its view model. |
Source/NETworkManager/ViewModels/SettingsViewModel.cs |
Registers the Network Interface settings page. |
Source/NETworkManager/ViewModels/NetworkInterfaceViewModel.cs |
Adds LiveCharts2 chart state, live mode, history, and settings reactions. |
Source/NETworkManager/ViewModels/NetworkInterfaceSettingsViewModel.cs |
Adds chart-time setting binding. |
Source/NETworkManager/Controls/LvlChartsBandwidthTooltip.xaml |
Removes old LiveCharts v1 tooltip UI. |
Source/NETworkManager/Controls/LvlChartsBandwidthTooltip.xaml.cs |
Removes old LiveCharts v1 tooltip code. |
Source/NETworkManager/Controls/LiveChartsBandwidthTooltip.xaml |
Adds LiveCharts2 bandwidth tooltip UI. |
Source/NETworkManager/Controls/LiveChartsBandwidthTooltip.xaml.cs |
Adds LiveCharts2 bandwidth tooltip behavior. |
Source/NETworkManager.Settings/SettingsViewManager.cs |
Adds Network Interface to application settings list. |
Source/NETworkManager.Settings/SettingsName.cs |
Adds Network Interface settings enum value. |
Source/NETworkManager.Settings/SettingsInfo.cs |
Adds persisted bandwidth chart-time setting. |
Source/NETworkManager.Settings/GlobalStaticConfiguration.cs |
Adds default bandwidth chart-time value. |
Source/NETworkManager.Models/Network/BandwidthMeter.cs |
Improves bandwidth sampling timing and error handling. |
Source/NETworkManager.Documentation/DocumentationManager.cs |
Maps Network Interface settings to documentation. |
Source/NETworkManager.Converters/LvlChartsBandwidthValueConverter.cs |
Removes obsolete LiveCharts v1 converter. |
Source/NETworkManager.Converters/BytesToExactStringConverter.cs |
Adds exact byte-count tooltip converter. |
Source/NETworkManager.Converters/BandwidthBytesWithSizeConverter.cs |
Removes replaced byte-size converter. |
Source/NETworkManager.Converters/BandwidthBytesToSpeedConverter.cs |
Updates speed formatting to support bit/s and byte/s modes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+755
to
+757
| _bandwidthReceivedValues = []; | ||
| _bandwidthSentValues = []; | ||
| _bandwidthSessionStartTime = DateTime.Now; |
| - Migrated from `LiveCharts` to `LiveCharts2` (`LiveChartsCore.SkiaSharpView.WPF`) for chart rendering. [#3449](https://github.com/BornToBeRoot/NETworkManager/pull/3449) | ||
| - Fixed `CancellationTokenSource` leak in `IPScanner`, `PortScanner`, `Traceroute`, `PingMonitor`, `PingMonitorHost` and `SNMP` ViewModels. The previous instance was never disposed before being overwritten on each run, leaking the underlying `WaitHandle`. [#3448](https://github.com/BornToBeRoot/NETworkManager/pull/3448) | ||
| - Fixed a `Dispatcher.ShutdownStarted` handler leak in the Dragablz tab items (PowerShell, PuTTY, TigerVNC, Remote Desktop and Web Console controls, plus the IP Scanner, Port Scanner, Traceroute, DNS Lookup, IP Geolocation, SNMP, SNTP Lookup and Whois views). The handler was subscribed in the constructor but never removed, keeping each closed tab (view and view model) alive until the application exited. It is now unsubscribed in `CloseTab()`; the Web Console additionally disposes its WebView2 instance. [#3454](https://github.com/BornToBeRoot/NETworkManager/pull/3454) | ||
| - Migrated from `LiveCharts` to `LiveCharts2` (`LiveChartsCore.SkiaSharpView.WPF`) for chart rendering. [#3449](https://github.com/BornToBeRoot/NETworkManager/pull/3449) [#3457](https://github.com/BornToBeRoot/NETworkManager/pull/3457) |
Comment on lines
+1942
to
1944
| // Amount transferred since the measurement started (this session) | ||
| BandwidthDiffBytesReceived = BandwidthTotalBytesReceived - _bandwidthTotalBytesReceivedTemp; | ||
| BandwidthDiffBytesSent = BandwidthTotalBytesSent - _bandwidthTotalBytesSentTemp; |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…BornToBeRoot/NETworkManager into feature/improve-bandwidth-meter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request
Related issue(s)
Copilot generated summary
Provide a Copilot generated summary of the changes in this pull request.
Copilot summary
This pull request introduces several improvements and refactorings related to bandwidth measurement, charting, and tooltips in the Network Interface section. The changes modernize the bandwidth meter logic, unify and enhance chart tooltips using LiveCharts v2, and clean up obsolete converters and code.
Bandwidth measurement and charting improvements:
BandwidthMeterto use precise timing with aStopwatch, robust error handling for interface state changes, and per-second rate calculation based on elapsed time. Added a constant for the default sample interval and improved handling of interface removal and counter resets. [1] [2] [3] [4]NetworkInterface_BandwidthChartTimeto control the bandwidth chart time window, with corresponding static configuration and property inSettingsInfo. [1] [2]Chart tooltip modernization:
LvlChartsBandwidthTooltip(and related converter) with a newLiveChartsBandwidthTooltipcontrol and code-behind, supporting LiveCharts v2, improved appearance, and more flexible data binding. [1] [2] [3] [4] [5] [6]Converters and formatting:
BandwidthBytesToSpeedConverterto allow formatting as either bytes per second or bits per second, with improved parameter handling and documentation.BytesToExactStringConverterfor displaying exact byte counts with thousands separators and unit, intended for tooltips.Settings and documentation integration:
NetworkInterfacetoSettingsNameand integrated it into the settings view manager and documentation identifier mapping, ensuring proper settings and documentation support for the Network Interface module. [1] [2] [3]Summary of most important changes:
1. Bandwidth measurement and charting
BandwidthMeterfor accurate per-second rate calculation using aStopwatch, robust interface state handling, and improved sample interval management. [1] [2] [3] [4]NetworkInterface_BandwidthChartTime) and integrated it into the configuration and settings model. [1] [2]2. Chart tooltip modernization
LvlChartsBandwidthTooltip) and its converter with a newLiveChartsBandwidthTooltipcontrol for LiveCharts v2, providing better formatting, appearance, and data binding. [1] [2] [3] [4] [5] [6]3. Converters and formatting
BandwidthBytesToSpeedConverterto allow both byte/s and bit/s formatting, with clearer documentation and parameter handling.BytesToExactStringConverterfor displaying exact byte counts in tooltips.4. Settings and documentation integration
NetworkInterfacetoSettingsName, integrated it into the settings view manager, and mapped it in documentation identifier logic for proper settings and help support. [1] [2] [3]To-Do
Contributing
By submitting this pull request, I confirm the following: