-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
440 lines (422 loc) · 24 KB
/
MainWindow.xaml
File metadata and controls
440 lines (422 loc) · 24 KB
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
<Window x:Class="Tab.MainWindow"
x:Name="mainWindow"
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:Tab"
mc:Ignorable="d"
MouseLeftButtonDown="MoveWindow"
Title="Cryptograph v1.0B"
WindowStyle="None" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
MinWidth="700" Width="800" MaxWidth="1200"
MinHeight="400" Height="450" MaxHeight="550"
Background="{DynamicResource BackgroundBrush}"
Closing="MainWindow_Closing"
BorderBrush="{DynamicResource WindowHeaderBackground}"
BorderThickness="1">
<Window.Resources>
<!-- Window colors -->
<SolidColorBrush x:Key="WindowHeaderBackground" Color="#3f3f46" />
<SolidColorBrush x:Key="BackgroundBrush" Color="#2d2d30" />
<!-- Combobox colors -->
<SolidColorBrush x:Key="BorderBrushComboBox" Color="#434346" />
<SolidColorBrush x:Key="BackgroundBrushComboBox" Color="#333337" />
<SolidColorBrush x:Key="ArrowBrushComboBox" Color="#999999" />
<SolidColorBrush x:Key="BorderBrushToggle" Color="#3f3f46" />
<SolidColorBrush x:Key="ActiveArrow" Color="#007acc" />
<SolidColorBrush x:Key="ActiveArrowBackground" Color="#1f1f20" />
<SolidColorBrush x:Key="PopupBackground" Color="#1b1b1c" />
<!-- Text controls colors -->
<SolidColorBrush x:Key="TextBoxBorder" Color="#555555" />
<SolidColorBrush x:Key="ActiveTextBoxBorder" Color="#007acc" />
<SolidColorBrush x:Key="TextBoxBackground" Color="#252526" />
<SolidColorBrush x:Key="FontWhite" Color="#f1f1f1" />
<SolidColorBrush x:Key="FontRed" Color="#f50600" />
<SolidColorBrush x:Key="FontGreen" Color="#00b537" />
<!-- Buttons colors -->
<SolidColorBrush x:Key="ButtonBackground" Color="#3f3f46" />
<SolidColorBrush x:Key="ButtonBorder" Color="#555555" />
<SolidColorBrush x:Key="HoveredButtonBackground" Color="#3f3f46" />
<SolidColorBrush x:Key="HoveredButtonBorder" Color="#0097fb" />
<SolidColorBrush x:Key="PressedButtonBackground" Color="#007acc" />
<SolidColorBrush x:Key="PressedButtonBorder" Color="#007acc" />
<SolidColorBrush x:Key="NavigationButtonBackground" Color="#3f3f46" />
<SolidColorBrush x:Key="HoveredNavigationButtonBackground" Color="#2d2d30" />
<SolidColorBrush x:Key="HoveredCloseButtonBackground" Color="#ff0000" />
<SolidColorBrush x:Key="DisabledButtonBackground" Color="#2d2d30" />
<SolidColorBrush x:Key="DisabledButtonForeground" Color="#3f3f46" />
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<Border x:Name="Border" Grid.ColumnSpan="2"
CornerRadius="0" BorderThickness="1"
Background="{StaticResource BackgroundBrushComboBox}"
BorderBrush="{StaticResource BorderBrushComboBox}" />
<Border x:Name="BorderToggle" Grid.Column="0" Margin="1"
CornerRadius="0" BorderThickness="0, 0, 1, 0"
Background="{StaticResource BackgroundBrushComboBox}"
BorderBrush="{StaticResource BorderBrushComboBox}" />
<Path x:Name="Arrow" Grid.Column="1"
Fill="{StaticResource ArrowBrushComboBox}" Data="M -2 0 L 2 4 L 6 0 Z"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="ToggleButton.IsMouseOver" Value="true">
<Setter TargetName="BorderToggle"
Property="Background"
Value="{StaticResource BorderBrushToggle}" />
<Setter TargetName="Arrow"
Property="Fill"
Value="{StaticResource ActiveArrow}"/>
<Setter TargetName="Border"
Property="Background"
Value="{StaticResource ActiveArrowBackground}"/>
<Setter TargetName="BorderToggle"
Property="BorderBrush"
Value="{StaticResource ActiveArrow}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox">
<Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" />
</ControlTemplate>
<Style x:Key="{x:Type ComboBox}" TargetType="ComboBox">
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="26"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Padding" Value="4"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="Foreground" Value="{StaticResource FontWhite}"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="IsSynchronizedWithCurrentItem" Value="False"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel IsVirtualizing="True"/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton Name="ToggleButton" Grid.Column="2" Focusable="false" ClickMode="Press"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Template="{StaticResource ComboBoxToggleButton}" />
<ContentPresenter Name="ContentSite" IsHitTestVisible="False" Margin="6, 3, 23, 3"
VerticalAlignment="Center" HorizontalAlignment="Left"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" />
<TextBox x:Name="PART_EditableTextBox" Style="{x:Null}" Margin="6, 3, 23, 3" Focusable="True"
HorizontalAlignment="Left" VerticalAlignment="Center"
Background="Transparent" Visibility="Hidden"
Template="{StaticResource ComboBoxTextBox}"
IsReadOnly="{TemplateBinding IsReadOnly}"/>
<Popup Name="Popup" Placement="Bottom" Focusable="False" Margin="3, -8, -3, 8"
AllowsTransparency="True" PopupAnimation="Fade"
IsOpen="{TemplateBinding IsDropDownOpen}">
<Grid Name="DropDown" SnapsToDevicePixels="True"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="DropDownBorder" BorderThickness="1" CornerRadius="0" Margin="0, -1, 0, 3"
Background="{StaticResource PopupBackground}"
BorderBrush="{StaticResource BorderBrushComboBox}"/>
<!-- ScrollBox Design -->
<ScrollViewer Margin="0, 3" SnapsToDevicePixels="True">
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Grid>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasItems" Value="false">
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ComboBoxItem -->
<Style x:Key="{x:Type ComboBoxItem}" TargetType="ComboBoxItem">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border Name="Border" SnapsToDevicePixels="true"
Padding="5, 3, 5, 3" BorderThickness="1">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="true">
<Setter TargetName="Border"
Property="Background"
Value="{StaticResource BorderBrushToggle}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- TextBox Style -->
<Style TargetType="{x:Type TextBox}">
<Setter Property="CaretBrush" Value="White" />
<Setter Property="BorderBrush" Value="{StaticResource TextBoxBorder}"/>
<Setter Property="Background" Value="{StaticResource TextBoxBackground}"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Margin" Value="10"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontFamily" Value="Roboto, Arial"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border CornerRadius="0" Padding="15" BorderThickness="1"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}">
<ScrollViewer x:Name="PART_ContentHost"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderBrush" Value="{StaticResource ActiveTextBoxBorder}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{StaticResource BackgroundBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Button Style -->
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="{StaticResource ButtonBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource ButtonBorder}" />
<Setter Property="Foreground" Value="{StaticResource FontWhite}" />
<Setter Property="FontSize" Value="24" />
<Setter Property="FontFamily" Value="Arial"/>
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderThickness="1"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"
Content="{TemplateBinding Content}" Margin="0"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource HoveredButtonBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource HoveredButtonBorder}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource PressedButtonBackground}"/>
<Setter Property="BorderBrush" Value="{StaticResource PressedButtonBorder}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{StaticResource DisabledButtonBackground}" />
<Setter Property="Foreground" Value="{StaticResource DisabledButtonForeground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Close button style -->
<Style TargetType="{x:Type Button}" x:Key="HeaderButtonsClose">
<Setter Property="Background" Value="{StaticResource NavigationButtonBackground}" />
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderThickness="0"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"
Content="{TemplateBinding Content}" Margin="0"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource HoveredCloseButtonBackground}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Minimize/maximize buttons style -->
<Style TargetType="{x:Type Button}" x:Key="HeaderButtons">
<Setter Property="Background" Value="{StaticResource NavigationButtonBackground}" />
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderThickness="0"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}">
<ContentPresenter Content="{TemplateBinding Content}"
HorizontalAlignment="Center" VerticalAlignment="Center"
Margin="0" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background"
Value="{StaticResource HoveredNavigationButtonBackground}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ToolTip">
<Style.Resources>
<Style TargetType="ContentPresenter">
<Style.Resources>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</Style.Resources>
</Style>
</Style.Resources>
<Setter Property="MaxWidth" Value="500" />
</Style>
</Window.Resources>
<!-- Window controls -->
<Grid x:Name="mainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition Height="55"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="270"/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.ColumnSpan="2" Background="{StaticResource WindowHeaderBackground}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="35"/>
<ColumnDefinition/>
<ColumnDefinition Width="45"/>
<ColumnDefinition Width="45"/>
<ColumnDefinition Width="45"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="Icons/favicon.png" Margin="7"/>
<TextBlock Grid.Column="1" Text="Cryptograph v1.0B" Padding="5, 0, 0, 0"
VerticalAlignment="Center" HorizontalAlignment="Left"
FontSize="15" FontFamily="Segoe UI" Foreground="{StaticResource FontWhite}"/>
<Button x:Name="hideBtn" Grid.Column="2"
Style="{StaticResource HeaderButtons}"
Click="HideBtn_Click">
<Image Source="Icons/hide.png" Margin="7"/>
</Button>
<Button x:Name="maximizeBtn" Grid.Column="3"
Style="{StaticResource HeaderButtons}"
Click="MaximizeBtn_Click">
<Image Source="Icons/maximize.png" Margin="6"/>
</Button>
<Button x:Name="closeBtn" Grid.Column="4"
Style="{StaticResource HeaderButtonsClose}"
Click="CloseBtn_Click">
<Image Source="Icons/close.png" Margin="7"/>
</Button>
</Grid>
<Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="55"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="title" Text="НАЗВАНИЕ МЕТОДА"
Grid.Row="0" Grid.Column="0"
Margin="10" FontFamily="Segoe UI" FontSize="32"
VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="{StaticResource FontWhite}" />
<Image x:Name="toolTipIcon" ToolTipService.ShowDuration="60000" ToolTipService.HasDropShadow="True" Source="Icons/info.png" Margin="0, 12, 10, 8" Grid.Row="0" Grid.Column="2"/>
</Grid>
<TextBox x:Name="inputBox" Margin="10, 10, 0, 5"
Grid.Row="2" Grid.Column="0"
TextAlignment="Center"
TextChanged="InputBox_TextChanged"
ToolTip="Введите зашифровываемое слово"/>
<TextBox x:Name="outputBox" Margin="10, 5, 0, 10"
Grid.Row="3" Grid.Column="0"
TextAlignment="Center"
IsReadOnly="True"
Focusable="False">
<TextBox.ToolTip>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="70"/>
</Grid.ColumnDefinitions>
<Image Source="Icons/done.png" Grid.Column="0"/>
<TextBlock Text="Готово :)"
Grid.Column="1"
VerticalAlignment="Center"/>
</Grid>
</TextBox.ToolTip>
</TextBox>
<Grid x:Name="rightGrid" Grid.Row="2" Grid.RowSpan="2" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="46"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="90"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button IsTabStop="False" x:Name="Mode" Margin="10" ToolTip="Смена режима работы"
Grid.Row="0" Grid.Column="0"
FontSize="18" FontFamily="Consolas"
Click="Mode_Click" >
<Image Source="Icons/lock.png" Opacity="0.9" Margin="10"/>
</Button>
<Button IsTabStop="False" x:Name="Swap" Margin="10" ToolTip="Поменять поля местами"
Grid.Row="0" Grid.Column="1"
FontSize="18" FontFamily="Consolas"
Click="Swap_Click" >
<Image Source="Icons/swap.png" Opacity="0.9" Margin="10"/>
</Button>
<Button IsTabStop="False" x:Name="changeLanguageBtn" Margin="10" ToolTip="Сменить язык"
Grid.Row="0" Grid.Column="2"
FontSize="18" FontFamily="Consolas"
Click="ChangeLanguage_Click">
<TextBlock x:Name="languageTextBlock" Text="EN" Foreground="Black" FontWeight="Bold" FontSize="40"/>
</Button>
</Grid>
<ComboBox x:Name="comboBox" Margin="10"
Grid.Row="0" Grid.Column="1"
SelectionChanged="ComboBox_SelectionChanged"/>
<TextBlock x:Name="modeTextBlock" Text="ШИФРОВАНИЕ"
Grid.Row="1" Grid.Column="0"
VerticalAlignment="Center" HorizontalAlignment="Center" TextAlignment="Center"
FontSize="30" FontFamily="Segoe UI" Foreground="{StaticResource FontRed}"/>
<TextBox x:Name="keyBox" ToolTip="Ключ"
Margin="10, 0, 10, 10"
TextAlignment="Center"
Grid.Row="3" Grid.Column="1"
TextChanged="KeyBox_TextChanged"/>
</Grid>
</Grid>
</Window>