-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f19100a
commit e900c78
Showing
2 changed files
with
277 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
<Window | ||
x:Class="InternetTest.Windows.AdapterWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:InternetTest.Windows" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
Title="AdapterWindow" | ||
Width="650" | ||
Height="550" | ||
MinWidth="450" | ||
MinHeight="550" | ||
AllowsTransparency="True" | ||
Background="Transparent" | ||
FontFamily="/Fonts/#Hauora" | ||
Foreground="{Binding Source={StaticResource Foreground1}}" | ||
WindowStartupLocation="CenterScreen" | ||
WindowStyle="None" | ||
mc:Ignorable="d"> | ||
<WindowChrome.WindowChrome> | ||
<WindowChrome CaptionHeight="32" ResizeBorderThickness="10" /> | ||
</WindowChrome.WindowChrome> | ||
|
||
<Window.Resources> | ||
<Style x:Key="WindowMainPanelStyle" TargetType="{x:Type Border}"> | ||
<Setter Property="BorderBrush" Value="{DynamicResource WindowBorderBrush}" /> | ||
<Setter Property="BorderThickness" Value="1" /> | ||
</Style> | ||
<Style x:Key="TitleBarButtonStyle" TargetType="Button"> | ||
<Setter Property="Foreground" Value="White" /> | ||
<Setter Property="Padding" Value="0" /> | ||
<Setter Property="Height" Value="32" /> | ||
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" /> | ||
<Setter Property="IsTabStop" Value="False" /> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="{x:Type Button}"> | ||
<Border | ||
x:Name="border" | ||
Background="{TemplateBinding Background}" | ||
BorderThickness="0" | ||
CornerRadius="5" | ||
SnapsToDevicePixels="true"> | ||
<ContentPresenter | ||
x:Name="contentPresenter" | ||
Margin="0" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
Focusable="False" | ||
RecognizesAccessKey="True" /> | ||
</Border> | ||
<ControlTemplate.Triggers> | ||
<Trigger Property="IsMouseOver" Value="true"> | ||
<Setter TargetName="border" Property="Background" Value="{Binding Source={StaticResource WindowButtonsHover1}}" /> | ||
</Trigger> | ||
<Trigger Property="IsPressed" Value="true"> | ||
<Setter TargetName="border" Property="Background" Value="{Binding Source={StaticResource WindowButtonsPressed1}}" /> | ||
</Trigger> | ||
</ControlTemplate.Triggers> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
<Style x:Key="TitleBarCloseButtonStyle" TargetType="Button"> | ||
<Setter Property="Foreground" Value="White" /> | ||
<Setter Property="Height" Value="32" /> | ||
<Setter Property="Padding" Value="0" /> | ||
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" /> | ||
<Setter Property="IsTabStop" Value="False" /> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="{x:Type Button}"> | ||
<Border | ||
x:Name="border" | ||
Background="Transparent" | ||
BorderThickness="0" | ||
CornerRadius="5" | ||
SnapsToDevicePixels="true"> | ||
<ContentPresenter | ||
x:Name="contentPresenter" | ||
Margin="0" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
Focusable="False" | ||
RecognizesAccessKey="True" /> | ||
</Border> | ||
<ControlTemplate.Triggers> | ||
<Trigger Property="IsMouseOver" Value="true"> | ||
<Setter TargetName="border" Property="Background" Value="Red" /> | ||
<Setter Property="Foreground" Value="White" /> | ||
</Trigger> | ||
<Trigger Property="IsPressed" Value="true"> | ||
<Setter TargetName="border" Property="Background" Value="Red" /> | ||
<Setter Property="Foreground" Value="White" /> | ||
</Trigger> | ||
</ControlTemplate.Triggers> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
</Window.Resources> | ||
|
||
<Window.Effect> | ||
<DropShadowEffect | ||
BlurRadius="10" | ||
Opacity="0.4" | ||
RenderingBias="Performance" | ||
ShadowDepth="0" | ||
Color="Black" /> | ||
</Window.Effect> | ||
<Border | ||
Name="WindowBorder" | ||
Margin="10" | ||
d:Background="#fff" | ||
BorderThickness="0" | ||
CornerRadius="5"> | ||
<Border.Background> | ||
<ImageBrush ImageSource="{Binding Source={StaticResource BackgroundImg}}" /> | ||
</Border.Background> | ||
<Grid VerticalAlignment="Stretch"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
|
||
<Border Height="Auto" Style="{StaticResource WindowMainPanelStyle}"> | ||
<Grid Height="Auto" VerticalAlignment="Top"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
|
||
<StackPanel Margin="10" Orientation="Horizontal"> | ||
<TextBlock | ||
x:Name="AdapterIcon" | ||
Margin="5 0" | ||
VerticalAlignment="Center" | ||
FontFamily="../Fonts/#FluentSystemIcons-Regular" | ||
FontSize="18" | ||
Foreground="{Binding Source={StaticResource AccentColor}}" | ||
Text="" /> | ||
<TextBlock | ||
x:Name="NameTxt" | ||
VerticalAlignment="Center" | ||
d:Text="Long Adapter Name Will Be Displayed Here" | ||
FontSize="18" | ||
FontWeight="Bold" | ||
TextWrapping="Wrap" /> | ||
</StackPanel> | ||
|
||
<Button | ||
x:Name="CloseBtn" | ||
Grid.Column="1" | ||
Width="46" | ||
Height="32" | ||
VerticalAlignment="Top" | ||
Background="Transparent" | ||
Click="CloseBtn_Click" | ||
Content="" | ||
FontFamily="/Fonts/#FluentSystemIcons-Regular" | ||
FontSize="14" | ||
Foreground="{Binding Source={StaticResource Foreground1}}" | ||
RenderOptions.EdgeMode="Aliased" | ||
Style="{StaticResource TitleBarCloseButtonStyle}" /> | ||
</Grid> | ||
</Border> | ||
|
||
<Grid Grid.Row="2"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition /> | ||
<ColumnDefinition /> | ||
</Grid.ColumnDefinitions> | ||
<TextBlock | ||
x:Name="HeadTxt" | ||
Margin="10" | ||
FontSize="14" | ||
FontWeight="Bold" /> | ||
<TextBlock | ||
x:Name="InfoTxt" | ||
Grid.Column="1" | ||
Margin="10" | ||
FontSize="14" | ||
FontWeight="Bold" /> | ||
</Grid> | ||
</Grid> | ||
</Border> | ||
</Window> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
MIT License | ||
Copyright (c) Léo Corporation | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
|
||
using InternetTest.Classes; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
|
||
namespace InternetTest.Windows | ||
{ | ||
/// <summary> | ||
/// Interaction logic for AdapterWindow.xaml | ||
/// </summary> | ||
public partial class AdapterWindow : Window | ||
{ | ||
public AdapterInfo AdapterInfo { get; } | ||
public AdapterWindow(AdapterInfo adapterInfo) | ||
{ | ||
InitializeComponent(); | ||
AdapterInfo = adapterInfo; | ||
InitUI(); | ||
} | ||
|
||
private void InitUI() | ||
{ | ||
NameTxt.Text = AdapterInfo.Name; | ||
InfoTxt.Text = AdapterInfo.ToFormattedString(); | ||
HeadTxt.Text = $"{Properties.Resources.Name}\n" + | ||
$"{Properties.Resources.InterfaceType}\n" + | ||
$"{Properties.Resources.Status}\n" + | ||
$"{Properties.Resources.IpVersion}\n" + | ||
$"{Properties.Resources.DNSSuffix}\n" + | ||
$"{Properties.Resources.MTU}\n" + | ||
$"{Properties.Resources.DnsEnabled}\n" + | ||
$"{Properties.Resources.DnsDynamicConfigured}\n" + | ||
$"{Properties.Resources.ReceiveOnly}\n" + | ||
$"{Properties.Resources.Multicast}\n" + | ||
$"{Properties.Resources.Speed}\n" + | ||
$"{Properties.Resources.TotalBytesReceived}\n" + | ||
$"{Properties.Resources.TotalBytesSent}\n" + | ||
$"{Properties.Resources.IncomingPacketsDiscarded}\n" + | ||
$"{Properties.Resources.IncomingPacketsWithErrors}\n" + | ||
$"{Properties.Resources.IncomingUnknownProtocolPackets}\n" + | ||
$"{Properties.Resources.NonUnicastPacketsReceived}\n" + | ||
$"{Properties.Resources.NonUnicastPacketsSent}\n" + | ||
$"{Properties.Resources.OutgoingPacketsDiscarded}\n" + | ||
$"{Properties.Resources.OutgoingPacketsWithErrors}\n" + | ||
$"{Properties.Resources.OutputQueueLength}\n" + | ||
$"{Properties.Resources.UnicastPacketsReceived}\n" + | ||
$"{Properties.Resources.UnicastPacketsSent}"; | ||
} | ||
|
||
private void CloseBtn_Click(object sender, RoutedEventArgs e) | ||
{ | ||
Close(); | ||
} | ||
} | ||
} |