Implement URL inspection

This commit is contained in:
Manuel Thalmann 2024-03-22 00:25:00 +01:00
parent af51421b63
commit f130b631fc
2 changed files with 18 additions and 3 deletions

View file

@ -26,8 +26,11 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Content="GetUrl" />
<TextBox Grid.Column="2" />
<Button Content="GetUrl"
IsDefault="true"
Click="GetUrl" />
<TextBox Grid.Column="2"
x:Name="urlBox" />
</Grid>
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>

View file

@ -1,4 +1,5 @@
using System.Text;
using System.Diagnostics;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
@ -8,6 +9,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DT2;
namespace UrlTester;
@ -20,4 +22,14 @@ public partial class MainWindow : Window
{
InitializeComponent();
}
public void GetUrl(object sender, RoutedEventArgs e)
{
var stopWatch = new Stopwatch();
stopWatch.Start();
int size = new DT2.UrlTester().GetUrlSync(urlBox.Text);
stopWatch.Stop();
bytesBox.Text = $"{size} bytes";
timeBox.Text = $"{stopWatch.ElapsedMilliseconds} ms";
}
}