Add files for task 3
This commit is contained in:
parent
972d364963
commit
ea670fdc3c
4 changed files with 48 additions and 0 deletions
BIN
Tasks/UrlTester/DT3/DT3.pdf
Normal file
BIN
Tasks/UrlTester/DT3/DT3.pdf
Normal file
Binary file not shown.
48
Tasks/UrlTester/DT3/DT3cs.cs
Normal file
48
Tasks/UrlTester/DT3/DT3cs.cs
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using DT2;
|
||||||
|
|
||||||
|
namespace DT3 {
|
||||||
|
|
||||||
|
public class UrlTesterModel /* TO BE DONE */ {
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
int size;
|
||||||
|
int time;
|
||||||
|
string url;
|
||||||
|
DT2.UrlTester urlTester;
|
||||||
|
|
||||||
|
public UrlTesterModel() {
|
||||||
|
urlTester = new DT2.UrlTester();
|
||||||
|
IDictionary<string, Stopwatch> sw = new Dictionary<string, Stopwatch>();
|
||||||
|
urlTester.PageStart += url => { sw.Add(url, Stopwatch.StartNew()); };
|
||||||
|
urlTester.PageLoaded += (url, size) => {
|
||||||
|
sw[url].Stop();
|
||||||
|
int time = (int)sw[url].Elapsed.TotalMilliseconds;
|
||||||
|
Size = size;
|
||||||
|
Time = time;
|
||||||
|
sw.Remove(url);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Size {
|
||||||
|
get { return size; }
|
||||||
|
set /* TO BE DONE */
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Time {
|
||||||
|
get { return time; }
|
||||||
|
set /* TO BE DONE */
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Url {
|
||||||
|
get { return url; }
|
||||||
|
set /* TO BE DONE */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue