Compare commits
No commits in common. "1ac34c7625696d6affecb207cd474d7f786a1a54" and "d22de337329b2ab04ef176989a3f48859b1d868b" have entirely different histories.
1ac34c7625
...
d22de33732
21 changed files with 298 additions and 663 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -383,6 +383,7 @@ FodyWeavers.xsd
|
||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
# Local History for Visual Studio Code
|
# Local History for Visual Studio Code
|
||||||
.history/
|
.history/
|
||||||
|
|
26
Tasks/AdvancedConcepts/.vscode/launch.json
vendored
26
Tasks/AdvancedConcepts/.vscode/launch.json
vendored
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
|
||||||
// Use hover for the description of the existing attributes
|
|
||||||
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
|
|
||||||
"name": ".NET Core Launch (console)",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "launch",
|
|
||||||
"preLaunchTask": "build",
|
|
||||||
// If you have changed target frameworks, make sure to update the program path.
|
|
||||||
"program": "${workspaceFolder}/bin/Debug/net8.0/AdvancedConcepts.dll",
|
|
||||||
"args": [],
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
|
||||||
"console": "internalConsole",
|
|
||||||
"stopAtEntry": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": ".NET Core Attach",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "attach"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
41
Tasks/AdvancedConcepts/.vscode/tasks.json
vendored
41
Tasks/AdvancedConcepts/.vscode/tasks.json
vendored
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
"version": "2.0.0",
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"label": "build",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"build",
|
|
||||||
"${workspaceFolder}/AdvancedConcepts.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "publish",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"publish",
|
|
||||||
"${workspaceFolder}/AdvancedConcepts.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "watch",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"watch",
|
|
||||||
"run",
|
|
||||||
"--project",
|
|
||||||
"${workspaceFolder}/AdvancedConcepts.csproj"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -88,16 +88,16 @@ namespace DT2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetUrlSync(string url) {
|
public int GetUrlSync(string url) {
|
||||||
PageStart?.Invoke(url);
|
PageStart(url);
|
||||||
int size = GetPageSize(url);
|
int size = GetPageSize(url);
|
||||||
PageLoaded?.Invoke(url, size);
|
PageLoaded(url, size);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> GetUrlAsync(string url) {
|
public async Task<int> GetUrlAsync(string url) {
|
||||||
PageStart?.Invoke(url);
|
PageStart(url);
|
||||||
int size = await Task.Run(() => GetPageSize(url));
|
int size = await Task.Run(() => GetPageSize(url));
|
||||||
PageLoaded?.Invoke(url, size);
|
PageLoaded(url, size);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ namespace DT2 {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
size = await task.WaitAsync(TimeSpan.FromMilliseconds(millis));
|
size = await task.WaitAsync(TimeSpan.FromMilliseconds(millis));
|
||||||
PageLoaded?.Invoke(url, size);
|
PageLoaded(url, size);
|
||||||
}
|
}
|
||||||
catch (TimeoutException)
|
catch (TimeoutException)
|
||||||
{
|
{
|
||||||
|
@ -149,7 +149,6 @@ namespace DT2 {
|
||||||
LoadSummary("Total", totalSize, (int)sw.Elapsed.TotalMilliseconds);
|
LoadSummary("Total", totalSize, (int)sw.Elapsed.TotalMilliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DT2
|
|
||||||
public static void Main(string[] args) {
|
public static void Main(string[] args) {
|
||||||
Console.WriteLine("Starting ...");
|
Console.WriteLine("Starting ...");
|
||||||
UrlTester urlTester = new UrlTester();
|
UrlTester urlTester = new UrlTester();
|
||||||
|
@ -162,6 +161,5 @@ namespace DT2 {
|
||||||
Console.Write("Press any key to continue ...\n");
|
Console.Write("Press any key to continue ...\n");
|
||||||
Console.ReadKey(true);
|
Console.ReadKey(true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
11
Tasks/DT2/DT2.csproj
Normal file
11
Tasks/DT2/DT2.csproj
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>disable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
26
Tasks/UrlTester/.vscode/launch.json
vendored
26
Tasks/UrlTester/.vscode/launch.json
vendored
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
|
||||||
// Use hover for the description of the existing attributes
|
|
||||||
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
|
|
||||||
"name": ".NET Core Launch (console)",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "launch",
|
|
||||||
"preLaunchTask": "build",
|
|
||||||
// If you have changed target frameworks, make sure to update the program path.
|
|
||||||
"program": "${workspaceFolder}/bin/Debug/net8.0-windows/UrlTester.dll",
|
|
||||||
"args": [],
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
|
||||||
"console": "internalConsole",
|
|
||||||
"stopAtEntry": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": ".NET Core Attach",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "attach"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
41
Tasks/UrlTester/.vscode/tasks.json
vendored
41
Tasks/UrlTester/.vscode/tasks.json
vendored
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
"version": "2.0.0",
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"label": "build",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"build",
|
|
||||||
"${workspaceFolder}/UrlTester.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "publish",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"publish",
|
|
||||||
"${workspaceFolder}/UrlTester.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "watch",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"watch",
|
|
||||||
"run",
|
|
||||||
"--project",
|
|
||||||
"${workspaceFolder}/UrlTester.csproj"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
<Application x:Class="UrlTester.App"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:local="clr-namespace:UrlTester"
|
|
||||||
StartupUri="MainWindow.xaml">
|
|
||||||
<Application.Resources>
|
|
||||||
|
|
||||||
</Application.Resources>
|
|
||||||
</Application>
|
|
|
@ -1,12 +0,0 @@
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace UrlTester;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for App.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class App : Application
|
|
||||||
{
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
[assembly:ThemeInfo(
|
|
||||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
|
||||||
//(used if a resource is not found in the page,
|
|
||||||
// or application resource dictionaries)
|
|
||||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
|
||||||
//(used if a resource is not found in the page,
|
|
||||||
// app, or any theme specific resource dictionaries)
|
|
||||||
)]
|
|
|
@ -1,69 +0,0 @@
|
||||||
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 : INotifyPropertyChanged {
|
|
||||||
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
|
|
||||||
{
|
|
||||||
size = value;
|
|
||||||
NotifyPropertyChanged(nameof(Size));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Time {
|
|
||||||
get { return time; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
time = value;
|
|
||||||
NotifyPropertyChanged(nameof(Time));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Url {
|
|
||||||
get { return url; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
url = value;
|
|
||||||
NotifyPropertyChanged(nameof(Url));
|
|
||||||
var _ = urlTester.GetUrlAsync(Url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void NotifyPropertyChanged(string memberName)
|
|
||||||
{
|
|
||||||
if (PropertyChanged != null)
|
|
||||||
{
|
|
||||||
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(memberName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Binary file not shown.
|
@ -1,80 +0,0 @@
|
||||||
<Window x:Class="UrlTester.MainWindow"
|
|
||||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:local="clr-namespace:DT3"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="MainWindow"
|
|
||||||
Height="450"
|
|
||||||
Width="800">
|
|
||||||
<Window.Resources>
|
|
||||||
<Style x:Key="CommonStyle" TargetType="FrameworkElement">
|
|
||||||
<Setter Property="Margin" Value="10" />
|
|
||||||
</Style>
|
|
||||||
<Style TargetType="Button" BasedOn="{StaticResource CommonStyle}">
|
|
||||||
<Setter Property="Padding"
|
|
||||||
Value="15,0,15,0" />
|
|
||||||
</Style>
|
|
||||||
<Style TargetType="TextBox" BasedOn="{StaticResource CommonStyle}" />
|
|
||||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonStyle}" />
|
|
||||||
<Style TargetType="ProgressBar" BasedOn="{StaticResource CommonStyle}">
|
|
||||||
<Setter Property="Height"
|
|
||||||
Value="20" />
|
|
||||||
</Style>
|
|
||||||
</Window.Resources>
|
|
||||||
<Border>
|
|
||||||
<Grid>
|
|
||||||
<StackPanel Orientation="Vertical">
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Button Content="GetUrl"
|
|
||||||
IsDefault="true" />
|
|
||||||
<TextBox Grid.Column="2"
|
|
||||||
Text="{Binding Url, Mode=OneWayToSource}" />
|
|
||||||
</Grid>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<StackPanel.Resources>
|
|
||||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonStyle}">
|
|
||||||
<Setter Property="Background"
|
|
||||||
Value="LightGray" />
|
|
||||||
<Setter Property="Width"
|
|
||||||
Value="150" />
|
|
||||||
<Setter Property="Padding"
|
|
||||||
Value="5"/>
|
|
||||||
</Style>
|
|
||||||
</StackPanel.Resources>
|
|
||||||
<TextBlock Text="{Binding Size, StringFormat={}{0} bytes}" />
|
|
||||||
<TextBlock Text="{Binding Time, StringFormat={}{0} ms}" />
|
|
||||||
</StackPanel>
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition />
|
|
||||||
<RowDefinition />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<ProgressBar x:Name="timeBar"
|
|
||||||
Minimum="0"
|
|
||||||
Maximum="1000"
|
|
||||||
Value="{Binding Time}"
|
|
||||||
Grid.ColumnSpan="3" />
|
|
||||||
<TextBlock Grid.Row="1"
|
|
||||||
Grid.Column="1"
|
|
||||||
TextAlignment="Center"
|
|
||||||
Text="500 ms" />
|
|
||||||
<TextBlock Grid.Row="1"
|
|
||||||
Grid.Column="2"
|
|
||||||
TextAlignment="Right"
|
|
||||||
Text="1000 ms" />
|
|
||||||
</Grid>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
</Window>
|
|
|
@ -1,27 +0,0 @@
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Text;
|
|
||||||
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.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using DT2;
|
|
||||||
using DT3;
|
|
||||||
|
|
||||||
namespace UrlTester;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for MainWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class MainWindow : Window
|
|
||||||
{
|
|
||||||
public MainWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
DataContext = new UrlTesterModel();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>disable</Nullable>
|
|
||||||
<UseWPF>true</UseWPF>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<DefineConstants>$(DefineConstants);DT3</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="System.ObjectModel" Version="4.3.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"folders": [
|
|
||||||
{
|
|
||||||
"name": "Solution Items",
|
|
||||||
"path": "."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "./Tasks/AdvancedConcepts"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "./Tasks/UrlTester"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in a new issue