source: trunk/CrypPlugins/PKCS1/WpfControls/Components/SigGenKuehnControl.xaml

Last change on this file was 8667, checked in by Sven Rech, 20 months ago

PKCS#1 tutorial: Made text components selectable.

File size: 8.5 KB
Line 
1<UserControl x:Class="PKCS1.WpfControls.Components.SigGenKuehnControl" x:Name="This"
2    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4    xmlns:my="clr-namespace:PKCS1.WpfResources"
5    xmlns:lib="clr-namespace:PKCS1.Library"
6    xmlns:lang="clr-namespace:PKCS1.Resources.lang.Gui"
7    VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
8    <UserControl.Resources>
9        <my:ErrorsToMessageConverter x:Key="eToMConverter" />
10    </UserControl.Resources>
11    <Grid>
12        <Grid.RowDefinitions>
13            <RowDefinition Height="auto" />
14            <RowDefinition Height="auto" />
15            <RowDefinition Height="*" />
16        </Grid.RowDefinitions>
17        <!-- Generate Signature -->
18        <GroupBox Name="gbSigGen" Grid.Row="0">
19            <GroupBox.Header>
20                <x:Static Member="lang:SigGenKuehnCtrl.genSig"></x:Static>
21            </GroupBox.Header>
22            <Grid>
23                <Grid.ColumnDefinitions>
24                    <ColumnDefinition Width="auto" />
25                    <ColumnDefinition Width="auto" />
26                    <ColumnDefinition Width="*" />
27                </Grid.ColumnDefinitions>
28                <!-- left -->
29                <Grid Grid.Column="0">
30                    <Grid.RowDefinitions>
31                        <RowDefinition Height="auto" />
32                        <RowDefinition Height="auto" />
33                        <RowDefinition Height="*" />
34                    </Grid.RowDefinitions>
35                    <SelectableTextBlock Padding="5" Grid.Row="0" Name="lblRsaKeySize" Margin="5,0,5,5" HorizontalAlignment="Left" VerticalAlignment="Top">
36                        <x:Static Member="lang:SigGenKuehnCtrl.rsaKeySize"></x:Static></SelectableTextBlock>
37                    <SelectableTextBlock Padding="5" Grid.Row="1" Name="lblPublicKey" Margin="5,0,5,5" HorizontalAlignment="Left" VerticalAlignment="Top">
38                        <x:Static Member="lang:SigGenKuehnCtrl.pubKey"></x:Static></SelectableTextBlock>
39                    <SelectableTextBlock Padding="5" Grid.Row="2" Name="lblIterations" Margin="5,0,5,5" HorizontalAlignment="Left" VerticalAlignment="Top">
40                        <x:Static Member="lang:SigGenKuehnCtrl.maxIterations"></x:Static></SelectableTextBlock>
41                </Grid>
42                <!-- middle -->
43                <Grid Grid.Column="1">
44                    <Grid.RowDefinitions>
45                        <RowDefinition Height="auto" />
46                        <RowDefinition Height="auto" />
47                        <RowDefinition Height="auto" />
48                        <RowDefinition Height="*" />
49                    </Grid.RowDefinitions>
50                    <SelectableTextBlock Padding="5" Grid.Row="0" Name="lblRsaKeySizeRes" Margin="5,0,5,5" HorizontalAlignment="Left" VerticalAlignment="Top" MinWidth="50" MaxWidth="150"></SelectableTextBlock>
51                    <SelectableTextBlock Padding="5" Grid.Row="1" Name="lblPublicKeyRes" Margin="5,0,5,5" HorizontalAlignment="Left" VerticalAlignment="Top" MinWidth="50" MaxWidth="150"></SelectableTextBlock>
52                    <DockPanel Grid.Row="2">
53                    <TextBox Grid.Row="2" Name="tbIterations" Margin="5,0,5,5" HorizontalAlignment="Left" VerticalAlignment="Top" MinWidth="50">                       
54                        <Binding ElementName="This" Path="Signature.Iterations" UpdateSourceTrigger="PropertyChanged">
55                            <Binding.ValidationRules>
56                                <my:NumberValidationRule UpperBound="500000" LowerBound="0" />
57                            </Binding.ValidationRules>
58                        </Binding>
59                    </TextBox>
60                    <Image Name="btnHelpIterations" Cursor="Hand" Source="../../Resources/icons/help.png" Width="16" Height="16" HorizontalAlignment="Right" MouseLeftButtonDown="btn_Help_MouseLeftButtonDown" />
61                    </DockPanel>
62                    <SelectableTextBlock Grid.Row="3"  Foreground="Red" FontWeight="Bold" FontSize="10"
63                                Text="{Binding ElementName=tbIterations,
64                                Path=(Validation.Errors),
65                                Converter={StaticResource eToMConverter}}" />
66                </Grid>
67                <!-- right -->
68                <Grid Grid.Column="2">
69                    <Grid.RowDefinitions>
70                        <RowDefinition Height="auto" />
71                        <RowDefinition Height="*" />
72                    </Grid.RowDefinitions>
73                    <GroupBox Grid.Row="0" Name="gbStruct" Height="57" Width="200" HorizontalAlignment="Right" VerticalAlignment="Top">
74                        <GroupBox.Header>
75                            <x:Static Member="lang:SigGenKuehnCtrl.structure"></x:Static>
76                        </GroupBox.Header>
77                        <Grid>
78                            <Grid.ColumnDefinitions>
79                                <ColumnDefinition Width="auto" />
80                                <ColumnDefinition Width="auto" />
81                                <ColumnDefinition Width="auto" />
82                                <ColumnDefinition Width="auto" />
83                                <ColumnDefinition Width="auto" />
84                                <ColumnDefinition Width="auto" />
85                                <ColumnDefinition Width="auto" />
86                            </Grid.ColumnDefinitions>
87                            <SelectableTextBlock Padding="5" Grid.Column="0">'00'</SelectableTextBlock>
88                            <SelectableTextBlock Padding="5" Grid.Column="1">'01'</SelectableTextBlock>
89                            <SelectableTextBlock Padding="5" Grid.Column="2" Foreground="Green">PS</SelectableTextBlock>
90                            <SelectableTextBlock Padding="5" Grid.Column="3">'00'</SelectableTextBlock>
91                            <SelectableTextBlock Padding="5" Grid.Column="4" Foreground="Blue">HI</SelectableTextBlock>
92                            <SelectableTextBlock Padding="5" Grid.Column="5" Foreground="Red">HD</SelectableTextBlock>
93                            <SelectableTextBlock Padding="5" Grid.Column="6">GG</SelectableTextBlock>
94                        </Grid>
95                    </GroupBox>
96                    <Button Grid.Row="1" Name="bExecute" Margin="5,5,5,5" Click="bExecute_Click" Height="25" HorizontalAlignment="Right" VerticalAlignment="Bottom" MinWidth="100">
97                        <x:Static Member="lang:SigGenKuehnCtrl.genFakeSig"></x:Static></Button>
98                </Grid>
99            </Grid>
100        </GroupBox>
101
102        <!-- Error -->
103        <SelectableTextBlock Grid.Row="1" Foreground="Red" FontWeight="Bold" FontSize="10" Name="tbError"></SelectableTextBlock>
104       
105        <!-- Result -->
106        <GroupBox Header="Erzeugte Signatur" Name="gbSigRes" Grid.Row="2" Margin="0,15,0,0">
107            <Grid>
108                <Grid.RowDefinitions >
109                    <RowDefinition Height="auto" />
110                    <RowDefinition Height="*" />
111                    <RowDefinition Height="auto" />
112                    <RowDefinition Height="*" />
113                </Grid.RowDefinitions>
114                <SelectableTextBlock Padding="5" Grid.Row="0" Margin="0,0,0,0" Name="lblClearText">
115                    <x:Static Member="lang:SigGenKuehnCtrl.decrypted"></x:Static></SelectableTextBlock>
116                <SelectableTextBlock Padding="5" Grid.Row="0" Margin="150,0,0,0" Name="lblSignatureLength"></SelectableTextBlock>
117                <RichTextBox Grid.Row="1" Name="rtbResult" MinHeight="80" IsReadOnly="True" Margin="5,5,5,5" MaxWidth="450" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" TextChanged="rtbResult_TextChanged"></RichTextBox>
118                <SelectableTextBlock Padding="5" Grid.Row="2" Margin="0,0,0,0" Name="lblCipherText">
119                    <x:Static Member="lang:SigGenKuehnCtrl.encrypted"></x:Static></SelectableTextBlock>
120                <SelectableTextBlock Padding="5" Grid.Row="2" Margin="150,0,0,0" Name="lblEncryptedSignatureLength"></SelectableTextBlock>
121                <TextBox Grid.Row="3" Name="tbResultEncrypted" TextWrapping="Wrap" MinHeight="80" IsReadOnly="True" Margin="5,5,5,5" MaxWidth="450" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" TextChanged="tbResultEncrypted_TextChanged"></TextBox>
122            </Grid>
123        </GroupBox>
124    </Grid>
125</UserControl>
Note: See TracBrowser for help on using the repository browser.