-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
186 lines (173 loc) · 13 KB
/
Copy pathMainWindow.xaml
File metadata and controls
186 lines (173 loc) · 13 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
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Licensed under the MIT License. -->
<Window
x:Class="ModernLife.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:canvas="using:Microsoft.Graphics.Canvas.UI.Xaml"
xmlns:local="using:ModernLife"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Activated="OnWindowActivate" Closed="OnWindowClosed" SizeChanged="OnWindowResized" >
<Window.SystemBackdrop>
<MicaBackdrop Kind="BaseAlt"/>
</Window.SystemBackdrop>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="*"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>
<Grid x:Name="AppTitleBar" Height="32">
<Image Source="Assets/StoreLogo.png" HorizontalAlignment="Left" Width="16" Height="16" Margin="8,0"/>
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="AppTitleTextBlock" Text="Modern Life" TextWrapping="NoWrap" Style="{StaticResource CaptionTextBlockStyle}" VerticalAlignment="Center" Margin="28,2,0,0"/>
<TextBlock x:Name="AppTitlePreview" FontSize="10" Text="PREVIEW" TextWrapping="NoWrap" Style="{StaticResource CaptionTextBlockStyle}" VerticalAlignment="Center" Margin="12,2,0,0"/>
</StackPanel>
</Grid>
<SplitView Grid.Row="1" x:Name="splitView" IsPaneOpen="True" MinWidth="200" OpenPaneLength="200" DisplayMode="Inline" Margin="0,6,6,6" PanePlacement="Right"
PaneBackground="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" CornerRadius="4">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="4" >
<canvas:CanvasControl x:Name="canvasBoard" Margin="6,0,6,0"
PointerMoved="OnPointerMoved" PointerReleased="OnPointerReleased"
PointerPressed="OnPointerPressed" PointerExited="OnPointerExited"
Draw="CanvasBoard_Draw" CreateResources="CanvasBoard_CreateResources"
ClearColor="{StaticResource SystemChromeMediumColor}" SizeChanged="CanvasBoard_SizeChanged" />
</Grid>
<SplitView.Pane>
<StackPanel Orientation="Vertical" >
<TextBlock Text="MODERN LIFE" x:Name="PaneHeader" HorizontalAlignment="Center" Margin="0,12,0,12" Style="{StaticResource BaseTextBlockStyle}"/>
<AppBarButton HorizontalAlignment="Center" Icon="Pause" x:Name="GoButton" Label="Pause" Click="GoButton_Click" />
<AppBarButton HorizontalAlignment="Center" Icon="Shuffle" x:Name="RandomizeButton" Label="Reshuffle" Click="RandomizeButton_Click" />
<AppBarButton HorizontalAlignment="Center" Icon="ViewAll" x:Name="LoadShape" Label="Load Shape" Click="LoadShape_Click" />
<TextBlock Text="RULESET" Margin="0,24,0,6" VerticalAlignment="Bottom" HorizontalAlignment="Center" Style="{StaticResource BaseTextBlockStyle}"/>
<DropDownButton HorizontalAlignment="Center" x:Name="dropdownRules" Content="Conway's" >
<DropDownButton.Flyout>
<MenuFlyout Placement="Bottom">
<MenuFlyoutItem Click="ruleClick" Text="Fast Conway">
<MenuFlyoutItem.Tag>
<x:Int32>1</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="ruleClick" Text="Conway">
<MenuFlyoutItem.Tag>
<x:Int32>2</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="ruleClick" Text="Day and Night">
<MenuFlyoutItem.Tag>
<x:Int32>3</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="ruleClick" Text="Life without Death">
<MenuFlyoutItem.Tag>
<x:Int32>4</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="ruleClick" Text="Brian's Brain">
<MenuFlyoutItem.Tag>
<x:Int32>5</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="ruleClick" Text="Seeds">
<MenuFlyoutItem.Tag>
<x:Int32>6</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="ruleClick" Text="High Life">
<MenuFlyoutItem.Tag>
<x:Int32>7</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
</MenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
<TextBlock Text="UPDATE SPEED" Margin="0,24,0,6" VerticalAlignment="Bottom" HorizontalAlignment="Center" Style="{StaticResource BaseTextBlockStyle}"/>
<DropDownButton HorizontalAlignment="Center" x:Name="dropdownSpeed" Content="Fast" >
<DropDownButton.Flyout>
<MenuFlyout Placement="Bottom">
<MenuFlyoutItem Click="speedClick" Text="Sloth">
<MenuFlyoutItem.Tag>
<x:Int32>2</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="speedClick" Text="Slower">
<MenuFlyoutItem.Tag>
<x:Int32>5</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="speedClick" Text="Slow">
<MenuFlyoutItem.Tag>
<x:Int32>10</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="speedClick" Text="Medium" >
<MenuFlyoutItem.Tag>
<x:Int32>20</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="speedClick" Text="Fast" >
<MenuFlyoutItem.Tag>
<x:Int32>30</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="speedClick" Text="Faster" >
<MenuFlyoutItem.Tag>
<x:Int32>60</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
<MenuFlyoutItem Click="speedClick" Text="Bonkers" >
<MenuFlyoutItem.Tag>
<x:Int32>120</x:Int32>
</MenuFlyoutItem.Tag>
</MenuFlyoutItem>
</MenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
<TextBlock Text="BOARD SIZE" Margin="0,24,0,0" VerticalAlignment="Bottom" HorizontalAlignment="Center" Style="{StaticResource BaseTextBlockStyle}"/>
<Slider x:Name="sliderBoardWidth" Margin="12,0,12,0" Minimum = "25" Maximum = "700" TickFrequency = "50" SmallChange="10" TickPlacement = "Outside"
Value="{x:Bind BoardWidth, Mode=TwoWay}"/>
<TextBlock x:Name="textBoardWidth" Text="{x:Bind GetBoardWidthText(sliderBoardWidth.Value), Mode=OneWay}" HorizontalAlignment="Center" Style="{StaticResource CaptionTextBlockStyle}"/>
<TextBlock Text="BOARD INITIALIZATION" Margin="0,24,0,0" VerticalAlignment="Bottom" HorizontalAlignment="Center" Style="{StaticResource BaseTextBlockStyle}"/>
<Slider x:Name="sliderRandomPercent" Margin="12,0,12,0" Minimum = "0" Maximum = "100" TickFrequency = "5" SmallChange="5" TickPlacement = "Outside"
Value="{x:Bind RandomPercent, Mode=TwoWay}"/>
<TextBlock x:Name="textRandomPercent" Text="{x:Bind GetRandomPercentText(sliderRandomPercent.Value), Mode=OneWay}" HorizontalAlignment="Center" Style="{StaticResource CaptionTextBlockStyle}"/>
<TextBlock Text="MAXIMUM AGE" Margin="0,24,0,0" VerticalAlignment="Bottom" HorizontalAlignment="Center" Style="{StaticResource CaptionTextBlockStyle}"/>
<Slider x:Name="sliderMaxAge" Margin="12,0,12,0" Minimum = "100" Maximum = "10000" TickFrequency = "100" SmallChange="50" TickPlacement = "Outside"
Value="{x:Bind MaxAge, Mode=TwoWay}" />
<TextBlock Text="SHOW LEGEND" Margin="0,24,0,0" VerticalAlignment="Bottom" HorizontalAlignment="Center" Style="{StaticResource BaseTextBlockStyle}"/>
<ToggleSwitch HorizontalAlignment="Center" Margin="12,0,12,0" x:Name="toggleCanvas" IsOn="{x:Bind ShowLegend, Mode=TwoWay}"></ToggleSwitch>
<TextBlock Text="LEARN MORE" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,24,0,0" Style="{StaticResource BaseTextBlockStyle}"/>
<TextBlock TextWrapping="WrapWholeWords" HorizontalAlignment="Center" Style="{StaticResource CaptionTextBlockStyle}">
<Span xml:space="preserve"><Run>YouTube </Run><Hyperlink NavigateUri="https://youtu.be/Kk2MH9O4pXY">John Conway</Hyperlink></Span>
</TextBlock>
</StackPanel>
</SplitView.Pane>
</SplitView>
<Grid Grid.Row="2" Margin="6,0,6,6" Background="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" CornerRadius="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="200"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph=""/>
<TextBlock Margin="6,0,6,0" x:Name="StatusPane_Message" Text="{x:Bind StatusMain, Mode=OneWay}" VerticalAlignment="Center" HorizontalAlignment="Left" TextWrapping="NoWrap" Style="{StaticResource CaptionTextBlockStyle}"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph=""/>
<TextBlock Margin="6,0,6,0" x:Name="StatusPane_Generation" Text="{x:Bind GenerationCount, Mode=OneWay}" VerticalAlignment="Center" HorizontalAlignment="Left" TextWrapping="NoWrap" Style="{StaticResource CaptionTextBlockStyle}"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="2">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="" />
<TextBlock Margin="6,0,6,0" x:Name="StatusPane_Alive" Text="{x:Bind LiveCount, Mode=OneWay}" VerticalAlignment="Center" HorizontalAlignment="Left" TextWrapping="NoWrap" Style="{StaticResource CaptionTextBlockStyle}"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="3">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="" />
<TextBlock Margin="6,0,6,0" x:Name="StatusPane_FPS" Text="{x:Bind FPSAverage, Mode=OneWay}" VerticalAlignment="Center" HorizontalAlignment="Left" TextWrapping="NoWrap" Style="{StaticResource CaptionTextBlockStyle}"></TextBlock>
</StackPanel>
</Grid>
</Grid>
</Window>