This repository has been archived by the owner on Feb 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SaveDialog.xaml
254 lines (254 loc) · 8.18 KB
/
SaveDialog.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<Window x:Class="Com.Xenthrax.WindowsDataVisualizer.SaveDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:XAML="clr-namespace:Com.Xenthrax.WindowsDataVisualizer.XAML"
Title="Save Dialog"
Height="340"
Width="410"
Loaded="Window_Loaded"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
WindowStartupLocation="CenterOwner"
WindowStyle="ToolWindow"
ResizeMode="CanMinimize">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.Resources>
<ControlTemplate x:Key="ErrorTemplate">
<ControlTemplate.Resources>
<Storyboard AutoReverse="False" x:Key="FadeInStoryboard">
<DoubleAnimation From="0"
To="1"
BeginTime="0:0:0"
Duration="0:0:0.50"
Storyboard.TargetProperty="Opacity"/>
</Storyboard>
</ControlTemplate.Resources>
<DockPanel LastChildFill="True">
<Border DockPanel.Dock="Bottom"
BorderBrush="DarkRed"
BorderThickness="1"
CornerRadius="2"
Opacity="0"
Margin="1,2,1,0">
<Border.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource FadeInStoryboard}"/>
</EventTrigger>
</Border.Triggers>
<TextBlock Background="Red"
Foreground="White"
TextWrapping="Wrap"
Text="{Binding ElementName=ErrorElement, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"/>
</Border>
<Border BorderBrush="Red"
BorderThickness="1"
CornerRadius="{Binding ElementName=ErrorElement, Path=AdornedElement.Tag}"
Grid.Column="1"
Grid.Row="1">
<AdornedElementPlaceholder Name="ErrorElement"/>
</Border>
</DockPanel>
</ControlTemplate>
</Grid.Resources>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Padding="5,4,10,4">Output File:</Label>
<TextBox Grid.Column="1"
MouseDoubleClick="OutputFileBox_MouseDoubleClick"
KeyDown="OutputFileBox_KeyDown"
Name="OutputFileBox"
TabIndex="0"
Text="{Binding OutputFile, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Padding="5,4,10,4">Format:</Label>
<ComboBox Grid.Column="1"
Name="Formats"
TabIndex="1"
SelectedItem="{Binding FileFormat}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} ({1})">
<Binding Path="Name"/>
<Binding Path="Fullname"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Padding="5,4,10,4">Encryption Type:</Label>
<ComboBox Grid.Column="1"
Name="EncryptionTypes"
TabIndex="1"
SelectedItem="{Binding EncryptionType}"/>
</Grid>
<Grid Grid.Row="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Padding="5,4,10,4">Certificate:</Label>
<ComboBox Grid.Column="1"
Name="Certificates"
TabIndex="1"
Validation.ErrorTemplate="{StaticResource ErrorTemplate}">
<ComboBox.SelectedValue>
<Binding Path="Certificate">
<Binding.ValidationRules>
<XAML:CertificateValidationRule x:Name="CertificateValidation" Verify="False" NeedsPrivateKey="False"/>
</Binding.ValidationRules>
</Binding>
</ComboBox.SelectedValue>
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Subject}"/>
<TextBlock Text="{Binding Issuer, StringFormat={}Issuer: {0}}"/>
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}Valid From: {0:d/MM/yyyy} to {1:d/MM/yyyy}">
<Binding Path="NotBefore"/>
<Binding Path="NotAfter"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.Style>
<Style TargetType="{x:Type ComboBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding EncryptionType}" Value="NoEncryption">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
<Trigger Property="Validation.HasError" Value="True">
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
</ComboBox.Style>
</ComboBox>
<Button Grid.Column="3"
Padding="7,0,7,0"
Click="CertificateView_Click">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding EncryptionType}" Value="NoEncryption">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=Certificates, Path=SelectedValue}" Value="{x:Null}">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
View
</Button>
</Grid>
<Grid Grid.Row="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Padding="5,4,10,4">Key Size:</Label>
<TextBox Grid.Column="1"
Name="KeySizeBox"
Text="{Binding KeySize}">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding EncryptionType}" Value="NoEncryption">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</Grid>
<Grid Grid.Row="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Padding="5,4,10,4">Block Size:</Label>
<TextBox Grid.Column="1"
Name="BlockSizeBox"
Text="{Binding BlockSize}">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding EncryptionType}" Value="NoEncryption">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</Grid>
<Grid Grid.Row="12">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="10"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
Name="OK"
Click="OK_Click"
TabIndex="3">
<!--<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEncrypted}" Value="True"/>
<Condition Binding="{Binding ElementName=Certificates, Path=(Validation.HasError)}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter Property="Button.IsEnabled" Value="False"/>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Button.Style>-->
OK
</Button>
<Button Grid.Column="2"
Name="Cancel"
Click="Cancel_Click"
TabIndex="4">
Cancel
</Button>
</Grid>
</Grid>
</Window>