-
Notifications
You must be signed in to change notification settings - Fork 6
/
MainWindow.xaml
297 lines (294 loc) · 17 KB
/
MainWindow.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
294
295
296
297
<Window x:Class="GameLauncher.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dat="clr-namespace:System.Windows.Data;assembly=PresentationFramework"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:viewmodels="clr-namespace:GameLauncher.ViewModels"
xmlns:views="clr-namespace:GameLauncher.Views"
Title="Breeze"
MinWidth="400"
MinHeight="600"
Background="{DynamicResource MaterialDesignPaper}"
Closing="Window_Closed"
FontFamily="{StaticResource MaterialDesignFont}"
Icon="breeze.ico"
SizeChanged="MWSizeChanged"
TextElement.FontSize="13"
TextElement.FontWeight="Regular"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen">
<!-- Required to make different views work -->
<Window.Resources>
<BooleanToVisibilityConverter x:Key="b2v" />
<DataTemplate x:Name="bannerViewTemplate"
DataType="{x:Type viewmodels:BannerViewModel}">
<views:BannerView DataContext="{Binding}" />
</DataTemplate>
<DataTemplate x:Name="listViewTemplate"
DataType="{x:Type viewmodels:ListViewModel}">
<views:ListView DataContext="{Binding}" />
</DataTemplate>
<DataTemplate x:Name="posterViewTemplate"
DataType="{x:Type viewmodels:PosterViewModel}">
<views:PosterView DataContext="{Binding}" />
</DataTemplate>
<DataTemplate x:Name="settingsViewTemplate"
DataType="{x:Type viewmodels:SettingsViewModel}">
<views:SettingsView DataContext="{Binding}" />
</DataTemplate>
<CollectionViewSource x:Key="GenreListCVS"
CollectionViewType="{x:Type dat:ListCollectionView}"
Source="{Binding GenreListOC}">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="Name" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
</Window.Resources>
<Grid>
<!-- DrawerHost is the main "host" to have the hamburger -->
<materialDesign:DrawerHost Grid.RowSpan="5"
Grid.ColumnSpan="5"
IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}">
<!-- Top Action Bar -->
<Grid>
<materialDesign:ColorZone Height="65"
MaxHeight="100"
Padding="6"
materialDesign:ShadowAssist.ShadowDepth="Depth2"
DockPanel.Dock="Top"
Mode="PrimaryMid">
<!-- Everything contained in top bar -->
<DockPanel>
<!-- Hamburger button -->
<ToggleButton x:Name="MenuToggleButton"
Margin="20,0,0,0"
IsChecked="False"
Style="{StaticResource MaterialDesignHamburgerToggleButton}" />
<!-- Title -->
<TextBlock Margin="20,0,0,0"
VerticalAlignment="Center"
FontSize="24"
RenderOptions.EdgeMode="Aliased"
Text="Breeze" />
<!-- Top Right Overflow -->
<materialDesign:PopupBox Padding="0,0,0,0"
HorizontalAlignment="Right"
DockPanel.Dock="Right"
PlacementMode="BottomAndAlignRightEdges"
StaysOpen="False">
<!-- Items inside overflow -->
<StackPanel>
<!-- Poster Button -->
<Button Click="PosterButton_OnClick">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Margin="0,0,10,0"
VerticalAlignment="Center"
Kind="ViewList" />
<TextBlock Text="Poster View" />
</StackPanel>
</Button>
<!-- Banner Button -->
<Button Click="BannerButton_OnClick">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Margin="0,0,10,0"
VerticalAlignment="Center"
Kind="ViewStream" />
<TextBlock Text="Banner View" />
</StackPanel>
</Button>
<!-- List Button -->
<Button Click="ListButton_OnClick">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Margin="0,0,10,0"
VerticalAlignment="Center"
Kind="ViewHeadline" />
<TextBlock Text="List View" />
</StackPanel>
</Button>
<!-- Refresh Button -->
<Button x:Name="rgbtn"
Click="RefreshGames_OnClick">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Margin="0,0,10,0"
VerticalAlignment="Center"
Kind="Refresh" />
<TextBlock Text="Refresh" />
</StackPanel>
</Button>
<!-- Settings Button -->
<Button Click="SettingsButton_OnClick">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Margin="0,0,10,0"
VerticalAlignment="Center"
Kind="Settings" />
<TextBlock Text="Settings" />
</StackPanel>
</Button>
</StackPanel>
</materialDesign:PopupBox>
</DockPanel>
</materialDesign:ColorZone>
<ContentControl Grid.Row="0"
Grid.Column="0"
Margin="0,64,0,0"
Content="{Binding}" />
</Grid>
<!-- Content for hamburger -->
<materialDesign:DrawerHost.LeftDrawerContent>
<DockPanel MinWidth="212">
<!-- Button to open hamburger -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="15*" />
<RowDefinition Height="85*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ToggleButton Grid.Row="0"
Grid.Column="1"
Margin="10"
HorizontalAlignment="Right"
DockPanel.Dock="Top"
IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}"
Style="{StaticResource MaterialDesignHamburgerToggleButton}" />
<StackPanel Grid.Row="0"
Grid.Column="0"
Margin="15,0,0,0"
VerticalAlignment="Center"
Orientation="Horizontal">
<!-- Icons for Launchers -->
<Button x:Name="SteamLaunchBtn"
Width="30"
Height="30"
Padding="0,0,0,0"
Click="OpenLauncher"
Style="{StaticResource MaterialDesignFlatButton}"
Tag="Steam"
ToolTip="Steam">
<materialDesign:PackIcon Width="20"
Height="20"
Margin="5,5,5,5"
VerticalAlignment="Center"
Kind="Steam" />
</Button>
<Button x:Name="OriginLaunchBtn"
Width="30"
Height="30"
Padding="0,0,0,0"
Click="OpenLauncher"
Style="{StaticResource MaterialDesignFlatButton}"
Tag="Origin"
ToolTip="Origin">
<materialDesign:PackIcon Width="20"
Height="20"
Margin="5,5,5,5"
VerticalAlignment="Center"
FontSize="20"
Kind="Origin" />
</Button>
<Button x:Name="UplayLaunchBtn"
Width="35"
Height="35"
Padding="0,0,0,0"
Click="OpenLauncher"
Style="{StaticResource MaterialDesignFlatButton}"
Tag="Uplay"
ToolTip="Uplay">
<materialDesign:PackIcon Width="20"
Height="20"
Margin="5,5,5,5"
VerticalAlignment="Center"
FontSize="20"
Kind="Uplay" />
</Button>
<Button x:Name="BattleNetLaunchBtn"
Width="35"
Height="35"
Padding="0,0,0,0"
Click="OpenLauncher"
Style="{StaticResource MaterialDesignFlatButton}"
Tag="Battle"
ToolTip="Battle.Net">
<materialDesign:PackIcon Width="20"
Height="20"
Margin="5,5,5,5"
VerticalAlignment="Center"
FontSize="20"
Kind="Battlenet" />
</Button>
<Button x:Name="EpicLaunchBtn"
Width="35"
Height="35"
Padding="0,0,0,0"
Click="OpenLauncher"
Style="{StaticResource MaterialDesignFlatButton}"
Tag="Epic"
ToolTip="Epic Games">
<materialDesign:PackIcon Width="20"
Height="20"
Margin="5,5,5,5"
VerticalAlignment="Center"
FontSize="20"
Kind="Shield" />
</Button>
</StackPanel>
<ScrollViewer Grid.Row="2"
Grid.ColumnSpan="2"
VerticalScrollBarVisibility="Auto">
<StackPanel Orientation="Vertical">
<Button x:Name="AllGenreBtn"
Click="ApplyGenreFilter_OnClick"
Content="All Genres"
Style="{StaticResource MaterialDesignFlatButton}"
Tag="" />
<ItemsControl x:Name="GenreSidebar"
ItemsSource="{Binding Source={StaticResource GenreListCVS}, IsAsync=True}"
ScrollViewer.CanContentScroll="True">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<Button Name="GenreButton"
Click="ApplyGenreFilter_OnClick"
Content="{Binding Name}"
Style="{StaticResource MaterialDesignFlatButton}"
Tag="{Binding Name}"
Loaded="GenresLoaded" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ScrollViewer>
</Grid>
</DockPanel>
</materialDesign:DrawerHost.LeftDrawerContent>
</materialDesign:DrawerHost>
<!-- FAB for adding new games -->
<Button Name="AddGameButton"
Grid.Row="5"
Grid.Column="5"
Width="60"
Height="60"
Margin="0,0,30,40"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Click="OpenAddGameWindow_OnClick"
Style="{StaticResource MaterialDesignFloatingActionAccentButton}"
ToolTip="Add a game">
<materialDesign:PackIcon Width="30"
Height="30"
VerticalAlignment="Center"
Kind="Plus" />
</Button>
<Border>
<Frame x:Name="DialogFrame"
NavigationUIVisibility="Hidden"
Visibility="Hidden" />
</Border>
</Grid>
</Window>