Run URL check using a task
This commit is contained in:
parent
94cb10b3df
commit
08f6288f91
|
@ -25,11 +25,22 @@ public partial class MainWindow : Window
|
|||
|
||||
public void GetUrl(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var tester = new DT2.UrlTester();
|
||||
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";
|
||||
|
||||
tester.PageStart += (_) =>
|
||||
{
|
||||
stopWatch.Start();
|
||||
};
|
||||
|
||||
tester.PageLoaded += (_, size) =>
|
||||
{
|
||||
stopWatch.Stop();
|
||||
bytesBox.Text = $"{size} bytes";
|
||||
timeBox.Text = $"{stopWatch.ElapsedMilliseconds} ms";
|
||||
timeBar.Value = stopWatch.ElapsedMilliseconds;
|
||||
};
|
||||
|
||||
_ = tester.GetUrlAsync(urlBox.Text);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue