-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
99 lines (94 loc) · 7.79 KB
/
MainWindow.xaml
File metadata and controls
99 lines (94 loc) · 7.79 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
<Window x:Class="SaperWPF.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:SaperWPF"
x:Name="window"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
mc:Ignorable="d"
Title="Сапер" Height="655" Width="600" ResizeMode="NoResize">
<Window.Resources>
<CollectionViewSource Source="{Binding ElementName=window, Path=HighscoreList}" x:Key="HighScoreListViewSource">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription Direction="Ascending" PropertyName="TimeElapsed" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
</Window.Resources>
<StackPanel>
<StackPanel VerticalAlignment="Top" Background="LightGray" Height="620" Width="auto">
<Border Margin="6" BorderBrush="DarkGray" BorderThickness="2,2,0,0" ClipToBounds="True">
<Border BorderBrush="white" BorderThickness="0,0,2,2">
<TextBlock TextWrapping="Wrap" Text="Сапер" HorizontalAlignment="Center" FontFamily="Arial Black" Foreground= "#FF373737"/>
</Border>
</Border>
<Grid Height="30" Width="585" Margin="-5">
<Label Height="30" Width="130" Margin="0,0,440,0" Grid.Column="0" Grid.Row="0" Content="Уровень Сложности" Foreground="#FF373737" FontFamily="Arial Rounded MT Bold"/>
<ComboBox Grid.Row="0" Width="150" ItemsSource="{Binding DifficultyLevels}" SelectedItem="{Binding SelectedDifficultylevel}" Margin="-80,2,71,7" FontFamily="Arial Rounded MT Bold" Foreground="#FF373737" Cursor="Hand"/>
<Button x:Name="restartButton" Width="100" Margin="465,2,0,7" Content="RESTART" FontFamily="Arial Rounded MT Bold" FontSize="14" Foreground="#FF373737" Command="{Binding RestartComand}" Cursor="Hand"/>
<TextBlock Grid.Row="0" Width="150" Text="{Binding TimeDisplayValue}" Margin="200,2,0,7" FontFamily="Arial Rounded MT Bold" Foreground="#FF373737"/>
</Grid>
<Border Margin="6 2 6 6" BorderBrush="DarkGray" BorderThickness="3,3,0,0" ClipToBounds="True" Height="560">
<Border BorderBrush="White" BorderThickness="0,0,3,3">
<ItemsControl Grid.Row="1" Grid.ColumnSpan="2" ItemsSource="{Binding GameBoard}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="{Binding BoardSize}" Columns="{Binding BoardSize}"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Command="{Binding CellClickCommand}"
CommandParameter="{Binding}"
MouseRightButtonUp="MouseRightBottonUpHandler" Content="{Binding DisplayValue}" Tag="{Binding}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Border>
</Border>
<Border BorderBrush="Silver" BorderThickness="2" Width="300" Height="300" x:Name="bdrEndOfGame" Panel.ZIndex="1" Visibility="Collapsed">
<StackPanel Orientation="Vertical" Background="AliceBlue" Margin="-10,-454,10,454">
<TextBlock HorizontalAlignment="Center" FontSize="40" FontWeight="Bold" Margin="0,20,0,0"><Run Text="О нет!"/></TextBlock>
<TextBlock HorizontalAlignment="Center" FontSize="26" FontWeight="Bold"><Run Text="...вы погибли!"/></TextBlock>
<TextBlock Margin="20" TextAlignment="Center" FontSize="16"><Run Text="Ваш счет:"/></TextBlock>
<TextBlock x:Name="tbFinalScore" TextAlignment="Center" FontSize="48" FontWeight="Bold" Foreground="Maroon"><Run Text="0"/></TextBlock>
</StackPanel>
</Border>
<Border BorderBrush="Silver" BorderThickness="2" Width="300" Height="300" Canvas.Left="50" Canvas.Top="50" Name="bdrWelcomeMessage" Panel.ZIndex="1">
<StackPanel Orientation="Vertical" Background="AliceBlue" Margin="0,-474,0,399">
<TextBlock FontWeight="Bold" FontSize="50" HorizontalAlignment="Center" Margin="0,20,0,0">SaperWPF</TextBlock>
<TextBlock TextWrapping="Wrap" Margin="20" FontSize="15">Правая кнопка мыши ставит флаг, для того чтобы обозначить бомбу, левая кнопка мыши открывает ячейку</TextBlock>
<TextBlock FontWeight="Bold" HorizontalAlignment="Center" FontSize="16" Foreground="Maroon">Нажми ПРОБЕЛ для начала игры!</TextBlock>
<Button Margin="20" Name="btnShowHighscoreList" Click="BtnShowHighscoreList_Click" HorizontalAlignment="Center" Padding="10,3">Показать Таблицу рекордов...</Button>
</StackPanel>
</Border>
<Border BorderBrush="Silver" BorderThickness="2" Width="300" Height="300" Canvas.Left="50" Canvas.Top="50" Name="bdrHighscoreList" Panel.ZIndex="1" Visibility="Collapsed">
<StackPanel Orientation="Vertical" Background="AliceBlue" Margin="-10,-454,10,454">
<Border BorderThickness="0,0,0,2" BorderBrush="Silver" Margin="0,10">
<TextBlock HorizontalAlignment="Center" FontSize="30" FontWeight="Bold">Таблица рекордов</TextBlock>
</Border>
<ItemsControl ItemsSource="{Binding Source={StaticResource HighScoreListViewSource}}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<DockPanel Margin="7">
<TextBlock Text="{Binding PlayerName}" DockPanel.Dock="Left" FontSize="22"></TextBlock>
<TextBlock Text="{Binding TimeElapsed}" DockPanel.Dock="Right" FontSize="22" HorizontalAlignment="Right"></TextBlock>
</DockPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Border>
<Border BorderBrush="Silver" BorderThickness="2" Width="300" Height="300" Canvas.Left="50" Canvas.Top="50" Name="bdrNewHighscore" Panel.ZIndex="1" Visibility="Collapsed">
<StackPanel Orientation="Vertical" Background="AliceBlue" Margin="-14,-466,14,466">
<TextBlock HorizontalAlignment="Center" FontSize="34" FontWeight="Bold" Margin="18">Новый рекорд!</TextBlock>
<TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" FontSize="14">
Поздравляем — вы попали в список рекордов SaperWPF! Пожалуйста, введите свое имя ниже...
</TextBlock>
<TextBox Name="txtPlayerName" FontSize="28" FontWeight="Bold" MaxLength="8" Margin="20" HorizontalContentAlignment="Center"></TextBox>
<Button Name="btnAddToHighscoreList" FontSize="16" HorizontalAlignment="Center" Click="BtnAddToHighscoreList_Click" Padding="10,5">Добавить в таблицу рекодов</Button>
</StackPanel>
</Border>
</StackPanel>
</StackPanel>
</Window>