Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ A huge thank you to our supporters and contributors who make NETworkManager poss
- [Dragablz](https://dragablz.net/) - Tearable TabControl for WPF.
- [GongSolutions.Wpf.DragDrop](https://github.com/punker76/gong-wpf-dragdrop) - An easy to use drag'n'drop framework for WPF.
- [IPNetwork](https://github.com/lduchosal/ipnetwork) - .NET library for complex network, IP, and subnet calculations.
- [LiveCharts2](https://github.com/Live-Charts/LiveCharts2) - Beautiful, interactive charts, maps, and gauges.
- [LoadingIndicators.WPF](https://github.com/zeluisping/LoadingIndicators.WPF) - A collection of loading indicators for WPF.
- [MahApps.Metro](https://mahapps.com/) - UI toolkit for WPF applications.
- [MahApps.Metro.IconPacks](https://github.com/MahApps/MahApps.Metro.IconPacks) - Awesome icon packs for WPF and UWP in one library.
Expand Down
42 changes: 21 additions & 21 deletions Source/NETworkManager.Documentation/LibraryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,83 +20,83 @@ public static class LibraryManager
/// </summary>
public static List<LibraryInfo> List =>
[
new LibraryInfo("#SNMP Library", "https://github.com/lextudio/sharpsnmplib",
new("#SNMP Library", "https://github.com/lextudio/sharpsnmplib",
Strings.Library_SharpSNMP_Description,
Strings.License_MITLicense,
"https://github.com/lextudio/sharpsnmplib/blob/master/LICENSE"),
new LibraryInfo("AirspaceFixer", "https://github.com/chris84948/AirspaceFixer",
new("AirspaceFixer", "https://github.com/chris84948/AirspaceFixer",
Strings.Library_AirspaceFixer_Description,
Strings.License_MITLicense,
"https://github.com/chris84948/AirspaceFixer/blob/master/LICENSE"),
new LibraryInfo("ControlzEx", "https://github.com/ControlzEx/ControlzEx",
new("ControlzEx", "https://github.com/ControlzEx/ControlzEx",
Strings.Library_ControlzEx_Description,
Strings.License_MITLicense,
"https://github.com/ButchersBoy/Dragablz/blob/master/LICENSE"),
new LibraryInfo("DnsClient.NET", "https://github.com/MichaCo/DnsClient.NET",
new("DnsClient.NET", "https://github.com/MichaCo/DnsClient.NET",
Strings.Library_DnsClientNET_Description,
Strings.License_ApacheLicense2dot0,
"https://github.com/MichaCo/DnsClient.NET/blob/dev/LICENSE"),
new LibraryInfo("Dragablz", "https://github.com/ButchersBoy/Dragablz",
new("Dragablz", "https://github.com/ButchersBoy/Dragablz",
Strings.Library_Dragablz_Description,
Strings.License_MITLicense,
"https://github.com/ButchersBoy/Dragablz/blob/master/LICENSE"),
new LibraryInfo("GongSolutions.Wpf.DragDrop", "https://github.com/punker76/gong-wpf-dragdrop",
new("GongSolutions.Wpf.DragDrop", "https://github.com/punker76/gong-wpf-dragdrop",
Strings.Library_GongSolutionsWpfDragDrop_Description,
Strings.License_BDS3Clause,
"https://github.com/punker76/gong-wpf-dragdrop/blob/develop/LICENSE"),
new LibraryInfo("IPNetwork", "https://github.com/lduchosal/ipnetwork",
new("IPNetwork", "https://github.com/lduchosal/ipnetwork",
Strings.Library_IPNetwork_Description,
Strings.License_BDS2Clause,
"https://github.com/lduchosal/ipnetwork/blob/master/LICENSE"),
new LibraryInfo("LiveCharts", "https://github.com/Live-Charts/Live-Charts",
new("LiveCharts2", "https://github.com/Live-Charts/LiveCharts2",
Strings.Library_LiveCharts_Description,
Strings.License_MITLicense,
"https://github.com/Live-Charts/Live-Charts/blob/master/LICENSE.TXT"),
new LibraryInfo("LoadingIndicators.WPF", "https://github.com/zeluisping/LoadingIndicators.WPF",
"https://github.com/Live-Charts/LiveCharts2/blob/master/LICENSE"),
new("LoadingIndicators.WPF", "https://github.com/zeluisping/LoadingIndicators.WPF",
Strings.Library_LoadingIndicatorsWPF_Description,
Strings.License_Unlicense,
"https://github.com/zeluisping/LoadingIndicators.WPF/blob/master/LICENSE"),
new LibraryInfo("log4net", "https://logging.apache.org/log4net/",
new("log4net", "https://logging.apache.org/log4net/",
Strings.Library_log4net_Description,
Strings.License_ApacheLicense2dot0,
"https://github.com/apache/logging-log4net/blob/master/LICENSE"),
new LibraryInfo("MahApps.Metro", "https://github.com/mahapps/mahapps.metro",
new("MahApps.Metro", "https://github.com/mahapps/mahapps.metro",
Strings.Library_MahAppsMetro_Description,
Strings.License_MITLicense,
"https://github.com/MahApps/MahApps.Metro/blob/master/LICENSE"),
new LibraryInfo("MahApps.Metro.IconPacks", "https://github.com/MahApps/MahApps.Metro.IconPacks",
new("MahApps.Metro.IconPacks", "https://github.com/MahApps/MahApps.Metro.IconPacks",
Strings.Library_MahAppsMetroIconPacks_Description,
Strings.License_MITLicense,
"https://github.com/MahApps/MahApps.Metro.IconPacks/blob/master/LICENSE"),
new LibraryInfo("Microsoft.PowerShell.SDK", "https://github.com/PowerShell/PowerShell",
new("Microsoft.PowerShell.SDK", "https://github.com/PowerShell/PowerShell",
Strings.Library_PowerShellSDK_Description,
Strings.License_MITLicense,
"https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt"),
new LibraryInfo("Microsoft.Web.WebView2", "https://docs.microsoft.com/en-us/microsoft-edge/webview2/",
new("Microsoft.Web.WebView2", "https://docs.microsoft.com/en-us/microsoft-edge/webview2/",
Strings.Library_WebView2_Description,
Strings.License_MicrosoftWebView2License,
"https://www.nuget.org/packages/Microsoft.Web.WebView2/1.0.824-prerelease/License"),
new LibraryInfo("Microsoft.Windows.CsWinRT", "https://github.com/microsoft/cswinrt/tree/master/",
new("Microsoft.Windows.CsWinRT", "https://github.com/microsoft/cswinrt/tree/master/",
Strings.Library_CsWinRT_Description,
Strings.License_MITLicense,
"https://github.com/microsoft/CsWinRT/blob/master/LICENSE"),
new LibraryInfo("Microsoft.Xaml.Behaviors.Wpf", "https://github.com/microsoft/XamlBehaviorsWpf",
new("Microsoft.Xaml.Behaviors.Wpf", "https://github.com/microsoft/XamlBehaviorsWpf",
Strings.Library_XamlBehaviorsWpf_Description,
Strings.License_MITLicense,
"https://github.com/microsoft/XamlBehaviorsWpf/blob/master/LICENSE"),
new LibraryInfo("Newtonsoft.Json", "https://github.com/JamesNK/Newtonsoft.Json",
new("Newtonsoft.Json", "https://github.com/JamesNK/Newtonsoft.Json",
Strings.Library_NewtonsoftJson_Description,
Strings.License_MITLicense,
"https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md"),
new LibraryInfo("nulastudio.NetBeauty", "https://github.com/nulastudio/NetBeauty2",
new("nulastudio.NetBeauty", "https://github.com/nulastudio/NetBeauty2",
Strings.Library_nulastudioNetBeauty_Description,
Strings.License_MITLicense,
"https://github.com/nulastudio/NetBeauty2/blob/master/LICENSE"),
new LibraryInfo("Octokit", "https://github.com/octokit/octokit.net",
new("Octokit", "https://github.com/octokit/octokit.net",
Strings.Library_Octokit_Description,
Strings.License_MITLicense,
"https://github.com/octokit/octokit.net/blob/master/LICENSE.txt"),
new LibraryInfo("PSDiscoveryProtocol", "https://github.com/lahell/PSDiscoveryProtocol",
new("PSDiscoveryProtocol", "https://github.com/lahell/PSDiscoveryProtocol",
Strings.Library_PSDicoveryProtocol_Description,
Strings.License_MITLicense,
"https://github.com/lahell/PSDiscoveryProtocol/blob/master/LICENSE")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)
MIT License

Copyright (c) 2016 Alberto Rodriguez & LiveCharts contributors
Copyright (c) 2021 Alberto Rodriguez Orozco

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<None Remove="Licenses\Dragablz.txt" />
<None Remove="Licenses\GongSolutions.Wpf.DragDrop.txt" />
<None Remove="Licenses\IPNetwork.txt" />
<None Remove="Licenses\LiveCharts.txt" />
<None Remove="Licenses\LiveCharts2.txt" />
<None Remove="Licenses\LoadingIndicators.WPF.txt" />
<None Remove="Licenses\log4net.txt" />
<None Remove="Licenses\MahApps.Metro.IconPack.txt" />
Expand Down Expand Up @@ -61,7 +61,7 @@
<Content Include="Licenses\IPNetwork.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Licenses\LiveCharts.txt">
<Content Include="Licenses\LiveCharts2.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Licenses\LoadingIndicators.WPF.txt">
Expand Down
2 changes: 1 addition & 1 deletion Source/NETworkManager.Localization/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2845,7 +2845,7 @@ Error message:
<value>C# library take care of complex network, IP, IPv4, IPv6, netmask, CIDR, subnet, subnetting, supernet, and supernetting calculation for .NET developers.</value>
</data>
<data name="Library_LiveCharts_Description" xml:space="preserve">
<value>Simple, flexible, interactive &amp; powerful charts, maps and gauges for .Net</value>
<value>Beautiful, interactive charts, maps, and gauges.</value>
</data>
<data name="Library_LoadingIndicatorsWPF_Description" xml:space="preserve">
<value>A collection of loading indicators for WPF</value>
Expand Down
12 changes: 3 additions & 9 deletions Source/NETworkManager.Utilities/LvlChartsDefaultInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@

namespace NETworkManager.Utilities;

public class LvlChartsDefaultInfo
public class LvlChartsDefaultInfo(DateTime dateTime, double value)
{
public LvlChartsDefaultInfo(DateTime dateTime, double value)
{
DateTime = dateTime;
Value = value;
}

public DateTime DateTime { get; }
public double Value { get; set; }
public DateTime DateTime { get; } = dateTime;
public double Value { get; } = value;
}
46 changes: 46 additions & 0 deletions Source/NETworkManager/Controls/LiveChartsPingTimeTooltip.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<UserControl x:Class="NETworkManager.Controls.LiveChartsPingTimeTooltip"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">
<Border Background="{DynamicResource MahApps.Brushes.Window.Background}"
BorderBrush="{DynamicResource MahApps.Brushes.Gray8}"
BorderThickness="1">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="10" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0"
Style="{StaticResource InfoTextBlock}"
HorizontalAlignment="Center"
Text="{Binding HeaderText}" />
<ItemsControl Grid.Row="2" Grid.Column="0"
ItemsSource="{Binding TooltipEntries}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Height="2" Width="14"
Fill="{Binding SeriesColor}" />
<TextBlock Grid.Column="2" Text="{Binding Value}"
Style="{StaticResource DefaultTextBlock}"
VerticalAlignment="Center" Foreground="{DynamicResource MahApps.Brushes.Gray3}" />
<TextBlock Grid.Column="4" Text="{Binding SeriesName}"
Style="{StaticResource AccentTextBlock}"
VerticalAlignment="Center" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Border>
</UserControl>
94 changes: 94 additions & 0 deletions Source/NETworkManager/Controls/LiveChartsPingTimeTooltip.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using LiveChartsCore;
using LiveChartsCore.Kernel;
using LiveChartsCore.Kernel.Sketches;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.Painting;
using NETworkManager.Utilities;
using SkiaSharp;

namespace NETworkManager.Controls;

public partial class LiveChartsPingTimeTooltip : IChartTooltip, INotifyPropertyChanged
{
private readonly Popup _popup;

public LiveChartsPingTimeTooltip()
{
InitializeComponent();
DataContext = this;
_popup = new Popup
{
AllowsTransparency = true,
Placement = PlacementMode.MousePoint,
StaysOpen = true,
Child = this
};
}

public event PropertyChangedEventHandler PropertyChanged;

public string HeaderText
{
get;
private set
{
if (field == value) return;
field = value;
OnPropertyChanged();
}
}

public ObservableCollection<TooltipEntry> TooltipEntries { get; } = [];

public void Show(IEnumerable<ChartPoint> tooltipPoints, Chart chart)
{
var points = tooltipPoints.ToList();
if (points.Count == 0) return;

if (points[0].Context.DataSource is LvlChartsDefaultInfo firstInfo)
HeaderText = DateTimeHelper.DateTimeToTimeString(firstInfo.DateTime);

TooltipEntries.Clear();
foreach (var point in points)
{
var value = point.Context.DataSource is LvlChartsDefaultInfo info
? $"{info.Value} ms"
: "-/-";
TooltipEntries.Add(new TooltipEntry(
SkColorToBrush(GetSeriesColor(point)),
value,
point.Context.Series.Name ?? string.Empty));
}

_popup.PlacementTarget = chart.View as FrameworkElement;
_popup.IsOpen = true;
}

public void Hide(Chart chart)
{
_popup.IsOpen = false;
}

protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));

private static SKColor GetSeriesColor(ChartPoint point)
{
if (point.Context.Series is LineSeries<LvlChartsDefaultInfo> ls && ls.Stroke is SolidColorPaint paint)
return paint.Color;
return SKColors.Gray;
}

private static Brush SkColorToBrush(SKColor color)
=> new SolidColorBrush(Color.FromArgb(color.Alpha, color.Red, color.Green, color.Blue));

public record TooltipEntry(Brush SeriesColor, string Value, string SeriesName);
}
38 changes: 38 additions & 0 deletions Source/NETworkManager/Controls/LiveChartsSpeedTestTooltip.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<UserControl x:Class="NETworkManager.Controls.LiveChartsSpeedTestTooltip"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">
<Border Background="{DynamicResource MahApps.Brushes.Window.Background}"
BorderBrush="{DynamicResource MahApps.Brushes.Gray8}"
BorderThickness="1">
<Grid>
<StackPanel Margin="10">
<ItemsControl ItemsSource="{Binding TooltipEntries}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Height="2" Width="14"
Fill="{Binding SeriesColor}" />
<TextBlock Grid.Column="2" Text="{Binding Value}"
Style="{StaticResource DefaultTextBlock}"
VerticalAlignment="Center" Foreground="{DynamicResource MahApps.Brushes.Gray3}" />
<TextBlock Grid.Column="4" Text="{Binding SeriesName}"
Style="{StaticResource AccentTextBlock}"
VerticalAlignment="Center" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
</Border>
</UserControl>
Loading
Loading