|
<Window x:Class="TLS.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TLS"
Title="Thread Local Storage Demo"
Name="Window"
WindowStartupLocation="CenterScreen"
Height="300" Width="450">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="Margin" Value="5" />
</Style>
<local:RunningConverter x:Key="RunningConverter" />
<local:IntConverter x:Key="IntConverter" />
</Grid.Resources>
<Border Grid.Column="0" Grid.Row="0" Margin="10" BorderThickness="1" BorderBrush="Black" CornerRadius="10">
<ListBox Name="_ListBox" BorderThickness="0" Margin="10" MinWidth="100" ItemsSource="{x:Static local:TestInfo.Tests}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="TextBlock">
<Setter Property="Margin" Value="3" />
</Style>
</StackPanel.Resources>
<TextBlock Text="{Binding Attribute.Index}" />
<TextBlock Text="{Binding Attribute.Name}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<Border Grid.Column="1" Grid.Row="0" Margin="10" BorderThickness="1" BorderBrush="Black" CornerRadius="10">
<Grid Margin="10" DataContext="{Binding ElementName=_ListBox, Path=SelectedItem}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Text="Test:" />
<TextBlock Grid.Column="0" Grid.Row="1" Text="Run:" VerticalAlignment="Center" />
<TextBlock Grid.Column="0" Grid.Row="2" Text="Ops / sec / core :" />
<TextBlock Grid.Column="0" Grid.Row="3" Text="Ops / sec total :" />
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Attribute.Name}" />
<TextBlock Grid.Column="1" Grid.Row="2" Text="{Binding OperationsPerSecondPerCore, Converter={StaticResource IntConverter}}" />
<TextBlock Grid.Column="1" Grid.Row="3" Text="{Binding OperationsPerSecond, Converter={StaticResource IntConverter}}" />
<Button Grid.Column="1" Grid.Row="1" Name="btnStop" Width="80" Margin="0,10"
Content="{Binding ElementName=Window, Path=Running, Converter={StaticResource RunningConverter}}"
HorizontalAlignment="Left" VerticalAlignment="Center" Padding="10,3"/>
</Grid>
</Border>
<ProgressBar Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="10" Name="_ProgressBar" Height="42" VerticalAlignment="Center" />
</Grid>
</Window>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I discovered C# and .NET 1.0 Beta 1 in late 2000 and loved them immediately.
I have been writing software professionally in C# ever since
In real life, I have spent 3 years travelling abroad,
I have held a UK Private Pilots Licence for 20 years,
and I am a PADI Divemaster.
I now live near idyllic Bournemouth in England.
I can work 'virtually' anywhere!