source: trunk/CrypPlugins/KeySearcher/Presentation/Controls/StatisticsPresentation.xaml @ 2285

Last change on this file since 2285 was 2285, checked in by matkovic, 11 years ago

-added sort for the statistics
-arranged position for the chunk display
-added ProgressBar color alternations
-fixed size
-added Chunk sum
-minor Design choices

By Viktor Matkovic, Dennis Nolte

File size: 4.8 KB
Line 
1<UserControl x:Class="KeySearcherPresentation.Controls.StatisticsPresentation"
2             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6             xmlns:g="clr-namespace:KeySearcher.P2P.Helper"
7             xmlns:Controls="clr-namespace:KeySearcherPresentation.Controls" xmlns:System="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d"
8             d:DesignHeight="300" d:DesignWidth="300">
9    <UserControl.Resources>
10        <Controls:InformationToProgressConverter x:Key="InformationToProgressConverter"/>
11        <Controls:InformationToProgressConverter2 x:Key="InformationToProgressConverter2"/>
12        <Controls:ChunkSumConverter x:Key="ChunkSumConverter"></Controls:ChunkSumConverter>
13        <g:WidthConverter x:Key="WidthConverter"></g:WidthConverter>
14        <AlternationConverter x:Key="TeamsBackgroundConverter">
15            <SolidColorBrush>LimeGreen</SolidColorBrush>
16            <SolidColorBrush>Red</SolidColorBrush>
17            <SolidColorBrush>Blue</SolidColorBrush>
18        </AlternationConverter>
19    </UserControl.Resources>
20   
21    <Grid>
22        <TreeView HorizontalAlignment="Stretch" Name="statisticsTree" VerticalAlignment="Stretch" ItemsSource="{Binding}" AlternationCount="3">
23            <TreeView.ItemTemplate>
24                <HierarchicalDataTemplate ItemsSource="{Binding Path=Value}">
25                    <HierarchicalDataTemplate.ItemTemplate>
26                        <HierarchicalDataTemplate ItemsSource="{Binding}">
27                            <StackPanel Orientation="Horizontal" Margin="1">
28                                <!--<Grid.ColumnDefinitions>
29                                    <ColumnDefinition Width="200" />
30                                    <ColumnDefinition Width="5" />
31                                    <ColumnDefinition/>                                   
32                                </Grid.ColumnDefinitions>-->
33                                <Grid>
34                                    <ProgressBar Foreground="{Binding RelativeSource={RelativeSource FindAncestor,  AncestorLevel=2, AncestorType={x:Type TreeViewItem}},Path=(ItemsControl.AlternationIndex),Converter={StaticResource ResourceKey=TeamsBackgroundConverter}}" Value="{Binding Path=Value.Count, Mode=OneTime, Converter={StaticResource ResourceKey=InformationToProgressConverter2}}" Width="{Binding ElementName=statisticsTree, Path=ActualWidth, Converter={StaticResource ResourceKey=WidthConverter}}" Maximum="1" />
35                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
36                                        <TextBlock Text="Chunks: "/>
37                                        <TextBlock Text="{Binding Path=Value.Count, StringFormat=\{0\,-5\}}"/>
38                                    </StackPanel>
39                                </Grid>
40                                <TextBlock Text="{Binding Path=Value.Hostname}" Grid.Column="3"/>
41                            </StackPanel>
42                        </HierarchicalDataTemplate>
43                    </HierarchicalDataTemplate.ItemTemplate>
44
45
46                    <StackPanel Orientation="Horizontal" Margin="1">
47                        <!--<Grid.ColumnDefinitions>
48                                    <ColumnDefinition Width="200" />
49                                    <ColumnDefinition Width="5" />
50                                    <ColumnDefinition/>                                   
51                                </Grid.ColumnDefinitions>-->
52                        <Grid>
53                            <ProgressBar x:Name="Bar" Foreground="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TreeViewItem}},Path=(ItemsControl.AlternationIndex),Converter={StaticResource ResourceKey=TeamsBackgroundConverter}}" Value="{Binding Path=Value, Mode=OneTime, Converter={StaticResource ResourceKey=InformationToProgressConverter}}" Width="{Binding ElementName=statisticsTree, Path=ActualWidth, Converter={StaticResource ResourceKey=WidthConverter}}" Maximum="1" />
54                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
55                                <TextBlock Text="Chunks: "/>
56                                <TextBlock Text="{Binding Path=Key, Converter={StaticResource ResourceKey=ChunkSumConverter}, StringFormat=\{0\,-5\}}"/>
57                            </StackPanel>
58                        </Grid>
59                        <TextBlock Text="{Binding Path=Key}"/>
60                    </StackPanel>
61                </HierarchicalDataTemplate>
62            </TreeView.ItemTemplate>
63        </TreeView>
64    </Grid>
65</UserControl>
Note: See TracBrowser for help on using the repository browser.