-
Notifications
You must be signed in to change notification settings - Fork 4
/
SettingsWindow.xaml
293 lines (279 loc) · 19.2 KB
/
SettingsWindow.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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<local:BorderlessWindow x:Class="ZipImageViewer.SettingsWindow" x:Name="SettingsWin"
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:ZipImageViewer" mc:Ignorable="d"
Width="850" Height="600" Icon="Resources/ZipImageViewer.ico"
Background="{StaticResource BackgroundBrush}" Foreground="{StaticResource ForegroundBrush}" WindowStartupLocation="CenterOwner"
Title="{StaticResource ttl_Settings}" UseLayoutRounding="True" Loaded="SettingsWin_Loaded" Closing="SettingsWin_Closing" PreviewKeyDown="SettingsWin_PreviewKeyDown">
<local:BorderlessWindow.RightTitle>
<TextBlock Foreground="Gray" FontWeight="Bold" Effect="{StaticResource DS_Below}">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} {1}" Mode="OneTime">
<Binding Source="{x:Static local:App.BuildConfig}" Mode="OneTime"/>
<Binding Source="{x:Static local:App.Version}" Mode="OneTime"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</local:BorderlessWindow.RightTitle>
<ScrollViewer>
<ScrollViewer.Resources>
<Style TargetType="ScrollBar" BasedOn="{StaticResource AppleStyleScrollBar}"/>
<local:EncryptionConverter x:Key="EncryptionConverter"/>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<local:NullableBoolConverter x:Key="NullableBoolConverter"/>
</ScrollViewer.Resources>
<local:PaddedGrid Padding="4" VerticalChildrenAlignment="Stretch" HorizontalChildrenAlignment="Stretch">
<local:PaddedGrid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="1.6*"/>
</local:PaddedGrid.ColumnDefinitions>
<local:PaddedGrid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="Auto"/>
</local:PaddedGrid.RowDefinitions>
<local:PaddedGrid.Resources>
<Style TargetType="Border" BasedOn="{StaticResource BorderBlockStyle}"/>
<Style TargetType="DataGrid" BasedOn="{StaticResource BorderlessStyle}">
<Setter Property="HorizontalGridLinesBrush" Value="#FFAAAAAA"/>
<Setter Property="VerticalGridLinesBrush" Value="#FFAAAAAA"/>
<Setter Property="Height" Value="220"/>
</Style>
<Style TargetType="TextBox" BasedOn="{StaticResource BorderlessStyle}"/>
<Style TargetType="PasswordBox" BasedOn="{StaticResource BorderlessStyle}"/>
<Style TargetType="ContentControl" BasedOn="{StaticResource RoundContentControlBaseStyle}"/>
<Style TargetType="Button" BasedOn="{StaticResource ButtonStyle}"/>
<Style TargetType="CheckBox" BasedOn="{StaticResource SlideSwitchStyle}"/>
</local:PaddedGrid.Resources>
<Border Grid.Row="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<DockPanel LastChildFill="False" Grid.Column="0">
<TextBlock DockPanel.Dock="Top" Style="{StaticResource HeaderTextStyle}" Text="{StaticResource ttl_ThumbnailSize}"/>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Top">
<ContentControl>
<TextBox MinWidth="32" VerticalAlignment="Top"
Text="{Binding Source={x:Static local:App.Setting}, Path=ThumbnailSize.Item1}"/>
</ContentControl>
<TextBlock Text=" x " VerticalAlignment="Center"/>
<ContentControl>
<TextBox MinWidth="32" VerticalAlignment="Top"
Text="{Binding Source={x:Static local:App.Setting}, Path=ThumbnailSize.Item2}"/>
</ContentControl>
</StackPanel>
<Button DockPanel.Dock="Right" Content="{StaticResource ttl_ReloadView}" VerticalAlignment="Center" Click="Btn_Reload_Click"/>
</DockPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="8 0">
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
</StackPanel>
<StackPanel Grid.Column="2">
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="{StaticResource ttl_ThumbnailFormat}"/>
<ContentControl>
<ComboBox ItemsSource="{Binding Source={local:Enumeration {x:Type local:Setting+ThumbnailFormats}}}"
SelectedValue="{Binding Source={x:Static local:App.Setting}, Path=ThumbnailFormat}"
DisplayMemberPath="Description" SelectedValuePath="Value"/>
</ContentControl>
</StackPanel>
</Grid>
</Border>
<TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource TipTextStyle}">
<StaticResource ResourceKey="spn_ThumbSizeTip"/>
</TextBlock>
<Border Grid.Row="1">
<DockPanel LastChildFill="False">
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="{StaticResource ttl_ThumbSwapDelayMultiplier}" Margin="0" VerticalAlignment="Center"/>
<ContentControl DockPanel.Dock="Right">
<TextBox Text="{Binding Source={x:Static local:App.Setting}, Path=ThumbSwapDelayMultiplier}"
Width="40"/>
</ContentControl>
</DockPanel>
</Border>
<TextBlock Grid.Row="1" Grid.Column="1" Style="{StaticResource TipTextStyle}" Text="{StaticResource msg_ThumbSwapDelayMultiplierTip}"/>
<Border Grid.Row="2">
<StackPanel>
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="{StaticResource ttl_CustomImageExt}"/>
<ContentControl>
<TextBox x:Name="TB_CustomImageExt" Text="{Binding Source={x:Static local:App.Setting}, Path=CustomImageExt}"/>
</ContentControl>
</StackPanel>
</Border>
<TextBlock Grid.Row="2" Grid.Column="1" Style="{StaticResource TipTextStyle}">
<StaticResource ResourceKey="spn_CustomImageExt"/>
</TextBlock>
<Border Grid.Row="3">
<StackPanel>
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="{StaticResource ttl_DatabaseDir}"/>
<DockPanel>
<Button DockPanel.Dock="Right" Margin="8 0 0 0" Content="{StaticResource ttl_Change}" VerticalAlignment="Center" Click="Btn_Move_Click"/>
<ContentControl>
<TextBox x:Name="TB_DatabaseDir" Text="{Binding Source={x:Static local:App.Setting}, Path=DatabaseDir, Mode=OneWay}"/>
</ContentControl>
</DockPanel>
</StackPanel>
</Border>
<TextBlock Grid.Row="3" Grid.Column="1" Style="{StaticResource TipTextStyle}" Text="{StaticResource msg_DatabaseDirTip}"/>
<Border Grid.Row="4">
<DockPanel>
<Button DockPanel.Dock="Right" Margin="8 0 0 0" VerticalAlignment="Top" Content="{StaticResource ttl_Clean}" Click="Btn_Clean_Click"/>
<StackPanel>
<TextBlock Style="{StaticResource HeaderTextStyle}"
Text="{Binding CurrentThumbDbSize, ElementName=SettingsWin, Mode=OneWay, StringFormat={StaticResource ttl_ThumbDbSize}}"/>
<DockPanel>
<Slider x:Name="SL_ThumbDbSize" Minimum="0.1" Maximum="10" DockPanel.Dock="Top"
Value="{Binding Source={x:Static local:App.Setting}, Path=ThumbDbSize}"/>
<TextBlock TextAlignment="Center" DockPanel.Dock="Bottom">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{Binding ElementName=SL_ThumbDbSize, Path=Value, Mode=OneWay, StringFormat='\{0:#,0.0} GB'}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=SL_ThumbDbSize, Path=Value, Mode=OneWay}" Value="10">
<Setter Property="Text" Value="{StaticResource ttl_Unlimited}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DockPanel>
</StackPanel>
</DockPanel>
</Border>
<TextBlock Grid.Row="4" Grid.Column="1" Style="{StaticResource TipTextStyle}" Text="{StaticResource msg_ThumbDbSizeTip}"/>
<Border Grid.Row="5">
<DockPanel LastChildFill="False">
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="{StaticResource ttl_LiteMode}" Margin="0" VerticalAlignment="Center"/>
<CheckBox Width="48" Height="24" VerticalAlignment="Center" DockPanel.Dock="Right"
IsChecked="{Binding Source={x:Static local:App.Setting}, Path=LiteMode}"/>
</DockPanel>
</Border>
<TextBlock Grid.Row="5" Grid.Column="1" Style="{StaticResource TipTextStyle}" Text="{StaticResource msg_LiteModeTip}"/>
<Border Grid.Row="6">
<DockPanel LastChildFill="False">
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="{StaticResource ttl_ViewerBackground}" Margin="0" VerticalAlignment="Center"/>
<ContentControl DockPanel.Dock="Right">
<ComboBox ItemsSource="{Binding Source={local:Enumeration {x:Type local:Setting+Background}}}"
SelectedValue="{Binding Source={x:Static local:App.Setting}, Path=ViewerBackground}"
DisplayMemberPath="Description" SelectedValuePath="Value"/>
</ContentControl>
</DockPanel>
</Border>
<Border Grid.Row="7">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="{StaticResource ttl_ViewerTransition}"/>
<ContentControl>
<ComboBox ItemsSource="{Binding Source={local:Enumeration {x:Type local:Setting+Transition}}}"
SelectedValue="{Binding Source={x:Static local:App.Setting}, Path=ViewerTransition}"
DisplayMemberPath="Description" SelectedValuePath="Value"/>
</ContentControl>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="8 0">
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
</StackPanel>
<StackPanel Grid.Column="2">
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="{StaticResource ttl_ViewerTransitionSpeed}"/>
<ContentControl>
<ComboBox ItemsSource="{Binding Source={local:Enumeration {x:Type local:Setting+TransitionSpeed}}}"
SelectedValue="{Binding Source={x:Static local:App.Setting}, Path=ViewerTransitionSpeed}"
DisplayMemberPath="Description" SelectedValuePath="Value"/>
</ContentControl>
</StackPanel>
</Grid>
</Border>
<TextBlock Grid.Row="7" Grid.Column="1" Style="{StaticResource TipTextStyle}" Text="{StaticResource msg_ViewerTransitionTip}"/>
<Border Grid.Row="8">
<DockPanel LastChildFill="False">
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="{StaticResource ttl_ExpMenuSlideshow}" Margin="0" VerticalAlignment="Center"/>
<CheckBox Width="48" Height="24" VerticalAlignment="Center" DockPanel.Dock="Right"
IsChecked="{Binding Source={x:Static local:App.Setting}, Path=ExpMenuSlideshow}"/>
</DockPanel>
</Border>
<TextBlock Grid.Row="8" Grid.Column="1" Style="{StaticResource TipTextStyle}" Text="{StaticResource msg_ExpMenuSlideshow}"/>
<Border Grid.Row="9">
<DockPanel LastChildFill="False">
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="{StaticResource ttl_MasterPassword}" Margin="0" VerticalAlignment="Center"/>
<Button DockPanel.Dock="Left" Margin="8 0 0 0" Content="{StaticResource ttl_Password}" ContentStringFormat="{StaticResource ttl_Update_0}" VerticalAlignment="Center" Click="Btn_ChgMstPwd_Click"
Visibility="{Binding Source={x:Static local:App.Setting}, Path=EncryptPasswords, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<CheckBox Width="48" Height="24" VerticalAlignment="Center" DockPanel.Dock="Right"
IsChecked="{Binding Source={x:Static local:App.Setting}, Path=EncryptPasswords, Converter={StaticResource NullableBoolConverter}}"/>
</DockPanel>
</Border>
<TextBlock Grid.Row="9" Grid.Column="1" Style="{StaticResource TipTextStyle}">
<StaticResource ResourceKey="spn_MasterPasswordTip"/>
</TextBlock>
<Border Grid.Row="10">
<DockPanel>
<TextBlock Style="{StaticResource HeaderTextStyle}" DockPanel.Dock="Top" Text="{StaticResource ttl_SavedPasswords}"/>
<TabControl>
<TabItem Header="{StaticResource ttl_FallbackPasswords}">
<ContentControl HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<DataGrid AutoGenerateColumns="False" EnableRowVirtualization="True" EnableColumnVirtualization="True"
ItemsSource="{Binding Source={x:Static local:App.Setting}, Path=FallbackPasswords}">
<DataGrid.Columns>
<DataGridTextColumn Header="{StaticResource ttl_Password}" Binding="{Binding Password, Converter={StaticResource EncryptionConverter}}"/>
</DataGrid.Columns>
</DataGrid>
</ContentControl>
</TabItem>
<TabItem Header="{StaticResource ttl_MappedPasswords}">
<ContentControl HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<DataGrid AutoGenerateColumns="False" EnableRowVirtualization="True" EnableColumnVirtualization="True"
ItemsSource="{Binding Source={x:Static local:App.Setting}, Path=MappedPasswords}">
<DataGrid.Columns>
<DataGridTextColumn Header="{StaticResource ttl_Path}" Binding="{Binding Path}"/>
<DataGridTextColumn Header="{StaticResource ttl_Password}" Binding="{Binding Password, Converter={StaticResource EncryptionConverter}}"/>
</DataGrid.Columns>
</DataGrid>
</ContentControl>
</TabItem>
</TabControl>
</DockPanel>
</Border>
<TextBlock Grid.Row="10" Grid.Column="1" Style="{StaticResource TipTextStyle}">
<StaticResource ResourceKey="spn_SavedPasswordsTip"/>
</TextBlock>
<Border Grid.Row="11" Margin="8 4 8 8">
<DockPanel>
<TextBlock Style="{StaticResource HeaderTextStyle}" DockPanel.Dock="Top" Text="{StaticResource ttl_CustomCommands}"/>
<ContentControl HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<DataGrid AutoGenerateColumns="False" RowEditEnding="DataGrid_RowEditEnding"
EnableRowVirtualization="True" EnableColumnVirtualization="True"
ItemsSource="{Binding Source={x:Static local:App.Setting}, Path=CustomCommands}">
<DataGrid.Columns>
<DataGridTextColumn Header="{StaticResource ttl_Name}" Binding="{Binding Str1, TargetNullValue={StaticResource txt_TargetNullValue}}"/>
<DataGridTextColumn Header="{StaticResource ttl_ProgramPath}" Binding="{Binding Str2, TargetNullValue={StaticResource txt_TargetNullValue}}"/>
<DataGridTextColumn Header="{StaticResource ttl_Arguments}" Binding="{Binding Str3}"/>
</DataGrid.Columns>
</DataGrid>
</ContentControl>
</DockPanel>
</Border>
<TextBlock Grid.Row="11" Grid.Column="1" Style="{StaticResource TipTextStyle}">
<StaticResource ResourceKey="spn_CustomCommandsTip"/>
</TextBlock>
<TextBlock Grid.Row="12" Grid.ColumnSpan="2">
<StaticResource ResourceKey="spn_About"/>
</TextBlock>
</local:PaddedGrid>
</ScrollViewer>
</local:BorderlessWindow>