-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
325 lines (307 loc) · 19.3 KB
/
MainWindow.xaml
File metadata and controls
325 lines (307 loc) · 19.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<Window x:Class="NetworkSpeedTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:conv="clr-namespace:NetworkSpeedTest.Converters"
Title="Network Speed Test" Height="780" Width="850"
WindowStartupLocation="CenterScreen" Background="#FF1A1A2E">
<Window.Resources>
<conv:BooleanToVisibilityConverter x:Key="BoolToVis"/>
<conv:InverseBooleanConverter x:Key="InverseBool"/>
<Style x:Key="DarkLabel" TargetType="TextBlock">
<Setter Property="Foreground" Value="#FFCCCCCC"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,0,8,0"/>
</Style>
<Style x:Key="DarkTextBox" TargetType="TextBox">
<Setter Property="Background" Value="#FF0F3460"/>
<Setter Property="Foreground" Value="#FFFFFFFF"/>
<Setter Property="BorderBrush" Value="#FF1A5276"/>
<Setter Property="Padding" Value="6,4"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="AccentButton" TargetType="Button">
<Setter Property="Background" Value="#FF00D4FF"/>
<Setter Property="Foreground" Value="#FF0A0A1A"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Padding" Value="20,8"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="4" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FF00BFEA"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#FF555555"/>
<Setter Property="Foreground" Value="#FF999999"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="StopButton" TargetType="Button">
<Setter Property="Background" Value="#FFE74C3C"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Padding" Value="20,8"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="4" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFC0392B"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#FF555555"/>
<Setter Property="Foreground" Value="#FF999999"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Title -->
<TextBlock Grid.Row="0" Text="Network Speed Test" FontSize="24" FontWeight="Bold"
Foreground="#FF00D4FF" HorizontalAlignment="Center" Margin="0,0,0,15"/>
<!-- Mode Selection -->
<TabControl Grid.Row="1" x:Name="ModeTab" Background="#FF16213E" Foreground="#FFCCCCCC"
BorderBrush="#FF0F3460" Margin="0,0,0,15" SelectionChanged="ModeTab_SelectionChanged">
<!-- Server Tab -->
<TabItem Header=" Server Mode " Background="#FF16213E" Foreground="#FFCCCCCC">
<StackPanel Margin="15">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Listen Port:" Style="{StaticResource DarkLabel}"/>
<TextBox Grid.Column="1" x:Name="ServerPortBox" Text="5201" Style="{StaticResource DarkTextBox}" Margin="0,0,15,0"/>
<Button Grid.Column="3" x:Name="StartServerBtn" Content="Start Server" Style="{StaticResource AccentButton}"
Click="StartServerBtn_Click" Margin="0,0,8,0"/>
<Button Grid.Column="4" x:Name="StopServerBtn" Content="Stop Server" Style="{StaticResource StopButton}"
Click="StopServerBtn_Click" IsEnabled="False"/>
</Grid>
</StackPanel>
</TabItem>
<!-- Client Tab -->
<TabItem Header=" Client Mode " Background="#FF16213E" Foreground="#FFCCCCCC">
<StackPanel Margin="15">
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Target IP:" Style="{StaticResource DarkLabel}"/>
<TextBox Grid.Column="1" x:Name="TargetIpBox" Text="127.0.0.1" Style="{StaticResource DarkTextBox}" Margin="0,0,15,0"/>
<TextBlock Grid.Column="2" Text="Port:" Style="{StaticResource DarkLabel}"/>
<TextBox Grid.Column="3" x:Name="ClientPortBox" Text="5201" Style="{StaticResource DarkTextBox}"/>
</Grid>
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Threads:" Style="{StaticResource DarkLabel}"/>
<TextBox Grid.Column="1" x:Name="ThreadCountBox" Text="8" Style="{StaticResource DarkTextBox}" Margin="0,0,15,0"/>
<TextBlock Grid.Column="2" Text="Duration (s):" Style="{StaticResource DarkLabel}"/>
<TextBox Grid.Column="3" x:Name="DurationBox" Text="10" Style="{StaticResource DarkTextBox}" Margin="0,0,15,0"/>
<CheckBox Grid.Column="5" x:Name="BidirectionalCheck" Content="Bidirectional"
Foreground="#FFCCCCCC" VerticalAlignment="Center" IsChecked="True"/>
</Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="StartTestBtn" Content="Start Test" Style="{StaticResource AccentButton}"
Click="StartTestBtn_Click" Margin="0,0,8,0"/>
<Button x:Name="StopTestBtn" Content="Stop Test" Style="{StaticResource StopButton}"
Click="StopTestBtn_Click" IsEnabled="False"/>
</StackPanel>
</StackPanel>
</TabItem>
<!-- Latency Test Tab -->
<TabItem Header=" Latency Test " Background="#FF16213E" Foreground="#FFCCCCCC">
<StackPanel Margin="15">
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Target IP:" Style="{StaticResource DarkLabel}"/>
<TextBox Grid.Column="1" x:Name="LatencyTargetBox" Text="127.0.0.1" Style="{StaticResource DarkTextBox}" Margin="0,0,15,0"/>
<TextBlock Grid.Column="2" Text="Port:" Style="{StaticResource DarkLabel}"/>
<TextBox Grid.Column="3" x:Name="LatencyPortBox" Text="5201" Style="{StaticResource DarkTextBox}" Margin="0,0,15,0"/>
<TextBlock Grid.Column="4" Text="Duration (s):" Style="{StaticResource DarkLabel}"/>
<TextBox Grid.Column="5" x:Name="LatencyDurationBox" Text="10" Style="{StaticResource DarkTextBox}"/>
</Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="StartLatencyBtn" Content="Start Latency Test" Style="{StaticResource AccentButton}"
Click="StartLatencyBtn_Click" Margin="0,0,8,0"/>
<Button x:Name="StopLatencyBtn" Content="Stop" Style="{StaticResource StopButton}"
Click="StopLatencyBtn_Click" IsEnabled="False"/>
</StackPanel>
</StackPanel>
</TabItem>
</TabControl>
<!-- Throughput Results Panel -->
<Grid Grid.Row="2" x:Name="ThroughputResultsPanel" Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="#FF16213E" CornerRadius="8" Padding="15" Margin="0,0,8,0"
BorderBrush="#FF0F3460" BorderThickness="1">
<StackPanel HorizontalAlignment="Center">
<TextBlock Text="Download" Foreground="#FF00D4FF" FontWeight="Bold" FontSize="14"
HorizontalAlignment="Center" Margin="0,0,0,5"/>
<TextBlock x:Name="DownloadSpeedMB" Text="-- MB/s" Foreground="White" FontSize="28"
FontWeight="Bold" HorizontalAlignment="Center"/>
<TextBlock x:Name="DownloadSpeedMbps" Text="-- Mbps" Foreground="#FF888888" FontSize="14"
HorizontalAlignment="Center" Margin="0,2,0,0"/>
</StackPanel>
</Border>
<Border Grid.Column="1" Background="#FF16213E" CornerRadius="8" Padding="15" Margin="8,0,8,0"
BorderBrush="#FF0F3460" BorderThickness="1">
<StackPanel HorizontalAlignment="Center">
<TextBlock Text="Upload" Foreground="#FFE74C3C" FontWeight="Bold" FontSize="14"
HorizontalAlignment="Center" Margin="0,0,0,5"/>
<TextBlock x:Name="UploadSpeedMB" Text="-- MB/s" Foreground="White" FontSize="28"
FontWeight="Bold" HorizontalAlignment="Center"/>
<TextBlock x:Name="UploadSpeedMbps" Text="-- Mbps" Foreground="#FF888888" FontSize="14"
HorizontalAlignment="Center" Margin="0,2,0,0"/>
</StackPanel>
</Border>
<Border Grid.Column="2" x:Name="AsymmetryWarning" Background="#FF4A3520" CornerRadius="8"
Padding="12" BorderBrush="#FFE67E22" BorderThickness="1" Visibility="Collapsed"
VerticalAlignment="Center" MinWidth="130">
<StackPanel HorizontalAlignment="Center">
<TextBlock Text="ASYMMETRY" Foreground="#FFF39C12" FontWeight="Bold" FontSize="12"
HorizontalAlignment="Center"/>
<TextBlock x:Name="AsymmetryPercent" Text="" Foreground="#FFF39C12" FontSize="18"
FontWeight="Bold" HorizontalAlignment="Center" Margin="0,3,0,0"/>
<TextBlock Text="Check NIC" Foreground="#FFCC8833" FontSize="10"
HorizontalAlignment="Center" Margin="0,2,0,0"/>
</StackPanel>
</Border>
</Grid>
<!-- Latency Results Panel -->
<Grid Grid.Row="2" x:Name="LatencyResultsPanel" Margin="0,0,0,10" Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" x:Name="LatencyCard" Background="#FF16213E" CornerRadius="8" Padding="15" Margin="0,0,8,0"
BorderBrush="#FF0F3460" BorderThickness="2">
<StackPanel HorizontalAlignment="Center">
<TextBlock x:Name="LatencyCardTitle" Text="Latency" Foreground="#FF2ECC71" FontWeight="Bold" FontSize="14"
HorizontalAlignment="Center" Margin="0,0,0,5"/>
<TextBlock x:Name="LatencyAvgText" Text="-- ms" Foreground="White" FontSize="28"
FontWeight="Bold" HorizontalAlignment="Center"/>
<TextBlock x:Name="LatencyMinMaxText" Text="min -- / max --" Foreground="#FF888888" FontSize="12"
HorizontalAlignment="Center" Margin="0,2,0,0"/>
</StackPanel>
</Border>
<Border Grid.Column="1" x:Name="JitterCard" Background="#FF16213E" CornerRadius="8" Padding="15" Margin="8,0,8,0"
BorderBrush="#FF0F3460" BorderThickness="2">
<StackPanel HorizontalAlignment="Center">
<TextBlock x:Name="JitterCardTitle" Text="Jitter" Foreground="#FF2ECC71" FontWeight="Bold" FontSize="14"
HorizontalAlignment="Center" Margin="0,0,0,5"/>
<TextBlock x:Name="JitterText" Text="-- ms" Foreground="White" FontSize="28"
FontWeight="Bold" HorizontalAlignment="Center"/>
<TextBlock Text="Inter-packet variation" Foreground="#FF888888" FontSize="12"
HorizontalAlignment="Center" Margin="0,2,0,0"/>
</StackPanel>
</Border>
<Border Grid.Column="2" x:Name="LossCard" Background="#FF16213E" CornerRadius="8" Padding="15" Margin="8,0,0,0"
BorderBrush="#FF0F3460" BorderThickness="2">
<StackPanel HorizontalAlignment="Center">
<TextBlock x:Name="LossCardTitle" Text="Packet Loss" Foreground="#FF2ECC71" FontWeight="Bold" FontSize="14"
HorizontalAlignment="Center" Margin="0,0,0,5"/>
<TextBlock x:Name="LossText" Text="-- %" Foreground="White" FontSize="28"
FontWeight="Bold" HorizontalAlignment="Center"/>
<TextBlock x:Name="LossDetailText" Text="--/-- received" Foreground="#FF888888" FontSize="12"
HorizontalAlignment="Center" Margin="0,2,0,0"/>
</StackPanel>
</Border>
</Grid>
<!-- Progress Bar -->
<Grid Grid.Row="3" Margin="0,0,0,10">
<ProgressBar x:Name="TestProgress" Height="22" Minimum="0" Maximum="100" Value="0"
Background="#FF0F3460" Foreground="#FF00D4FF" BorderThickness="0"/>
<TextBlock x:Name="ProgressText" Text="Ready" Foreground="White" FontSize="11"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<!-- Output Folder Row -->
<Grid Grid.Row="4" Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Report Folder:" Style="{StaticResource DarkLabel}"/>
<TextBox Grid.Column="1" x:Name="OutputFolderBox" Style="{StaticResource DarkTextBox}" IsReadOnly="True"
Text="" Margin="0,0,8,0"/>
<Button Grid.Column="2" x:Name="BrowseFolderBtn" Content="Browse..." Style="{StaticResource AccentButton}"
Click="BrowseFolderBtn_Click" Padding="12,6"/>
</Grid>
<!-- Status Log -->
<Border Grid.Row="5" Background="#FF16213E" CornerRadius="8" BorderBrush="#FF0F3460" BorderThickness="1"
Padding="5" Margin="0,0,0,10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="Status Log" Foreground="#FF888888" FontSize="11" Margin="5,2,0,5"/>
<ListBox Grid.Row="1" x:Name="StatusLog" Background="Transparent" Foreground="#FFAAAAAA"
BorderThickness="0" FontFamily="Consolas" FontSize="12"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="5,2"/>
<Setter Property="Foreground" Value="#FFAAAAAA"/>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
</Grid>
</Border>
<!-- Generate Report Button -->
<Button Grid.Row="6" x:Name="GenerateReportBtn" Content="Generate Report"
Style="{StaticResource AccentButton}" Click="GenerateReportBtn_Click"
HorizontalAlignment="Stretch" Padding="20,10" FontSize="14"/>
</Grid>
</Window>