GameGridView.axaml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <UserControl
  2. x:Class="Ryujinx.Ava.UI.Controls.GameGridView"
  3. xmlns="https://github.com/avaloniaui"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
  7. xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
  10. xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
  11. d:DesignHeight="450"
  12. d:DesignWidth="800"
  13. mc:Ignorable="d"
  14. Focusable="True">
  15. <UserControl.Resources>
  16. <helpers:BitmapArrayValueConverter x:Key="ByteImage" />
  17. <MenuFlyout x:Key="GameContextMenu" Opened="MenuBase_OnMenuOpened">
  18. <MenuItem
  19. Command="{Binding ToggleFavorite}"
  20. Header="{locale:Locale GameListContextMenuToggleFavorite}"
  21. ToolTip.Tip="{locale:Locale GameListContextMenuToggleFavoriteToolTip}" />
  22. <Separator />
  23. <MenuItem
  24. Command="{Binding OpenUserSaveDirectory}"
  25. Header="{locale:Locale GameListContextMenuOpenUserSaveDirectory}"
  26. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserSaveDirectoryToolTip}" />
  27. <MenuItem
  28. Command="{Binding OpenDeviceSaveDirectory}"
  29. Header="{locale:Locale GameListContextMenuOpenDeviceSaveDirectory}"
  30. ToolTip.Tip="{locale:Locale GameListContextMenuOpenDeviceSaveDirectoryToolTip}" />
  31. <MenuItem
  32. Command="{Binding OpenBcatSaveDirectory}"
  33. Header="{locale:Locale GameListContextMenuOpenBcatSaveDirectory}"
  34. ToolTip.Tip="{locale:Locale GameListContextMenuOpenBcatSaveDirectoryToolTip}" />
  35. <Separator />
  36. <MenuItem
  37. Command="{Binding OpenTitleUpdateManager}"
  38. Header="{locale:Locale GameListContextMenuManageTitleUpdates}"
  39. ToolTip.Tip="{locale:Locale GameListContextMenuManageTitleUpdatesToolTip}" />
  40. <MenuItem
  41. Command="{Binding OpenDownloadableContentManager}"
  42. Header="{locale:Locale GameListContextMenuManageDlc}"
  43. ToolTip.Tip="{locale:Locale GameListContextMenuManageDlcToolTip}" />
  44. <MenuItem
  45. Command="{Binding OpenCheatManager}"
  46. Header="{locale:Locale GameListContextMenuManageCheat}"
  47. ToolTip.Tip="{locale:Locale GameListContextMenuManageCheatToolTip}" />
  48. <MenuItem
  49. Command="{Binding OpenModsDirectory}"
  50. Header="{locale:Locale GameListContextMenuOpenModsDirectory}"
  51. ToolTip.Tip="{locale:Locale GameListContextMenuOpenModsDirectoryToolTip}" />
  52. <MenuItem
  53. Command="{Binding OpenSdModsDirectory}"
  54. Header="{locale:Locale GameListContextMenuOpenSdModsDirectory}"
  55. ToolTip.Tip="{locale:Locale GameListContextMenuOpenSdModsDirectoryToolTip}" />
  56. <Separator />
  57. <MenuItem Header="{locale:Locale GameListContextMenuCacheManagement}">
  58. <MenuItem
  59. Command="{Binding PurgePtcCache}"
  60. Header="{locale:Locale GameListContextMenuCacheManagementPurgePptc}"
  61. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgePptcToolTip}" />
  62. <MenuItem
  63. Command="{Binding PurgeShaderCache}"
  64. Header="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCache}"
  65. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCacheToolTip}" />
  66. <MenuItem
  67. Command="{Binding OpenPtcDirectory}"
  68. Header="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectory}"
  69. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectoryToolTip}" />
  70. <MenuItem
  71. Command="{Binding OpenShaderCacheDirectory}"
  72. Header="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectory}"
  73. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectoryToolTip}" />
  74. </MenuItem>
  75. <MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
  76. <MenuItem
  77. Command="{Binding ExtractExeFs}"
  78. Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
  79. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
  80. <MenuItem
  81. Command="{Binding ExtractRomFs}"
  82. Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
  83. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
  84. <MenuItem
  85. Command="{Binding ExtractLogo}"
  86. Header="{locale:Locale GameListContextMenuExtractDataLogo}"
  87. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
  88. </MenuItem>
  89. </MenuFlyout>
  90. </UserControl.Resources>
  91. <Grid>
  92. <Grid.RowDefinitions>
  93. <RowDefinition Height="*" />
  94. </Grid.RowDefinitions>
  95. <ListBox
  96. Grid.Row="0"
  97. Padding="8"
  98. HorizontalAlignment="Stretch"
  99. VerticalAlignment="Stretch"
  100. ContextFlyout="{StaticResource GameContextMenu}"
  101. DoubleTapped="GameList_DoubleTapped"
  102. Items="{Binding AppsObservableList}"
  103. SelectionChanged="GameList_SelectionChanged">
  104. <ListBox.ItemsPanel>
  105. <ItemsPanelTemplate>
  106. <flex:FlexPanel
  107. HorizontalAlignment="Stretch"
  108. VerticalAlignment="Stretch"
  109. AlignContent="FlexStart"
  110. JustifyContent="Center" />
  111. </ItemsPanelTemplate>
  112. </ListBox.ItemsPanel>
  113. <ListBox.Styles>
  114. <Style Selector="ListBoxItem">
  115. <Setter Property="Margin" Value="5" />
  116. <Setter Property="CornerRadius" Value="4" />
  117. </Style>
  118. <Style Selector="ListBoxItem:selected /template/ Border#SelectionIndicator">
  119. <Setter Property="MinHeight" Value="{Binding $parent[UserControl].DataContext.GridItemSelectorSize}" />
  120. </Style>
  121. </ListBox.Styles>
  122. <ListBox.ItemTemplate>
  123. <DataTemplate>
  124. <Grid>
  125. <Border
  126. Margin="10"
  127. HorizontalAlignment="Stretch"
  128. VerticalAlignment="Stretch"
  129. Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
  130. Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
  131. Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
  132. Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
  133. ClipToBounds="True"
  134. CornerRadius="4">
  135. <Grid>
  136. <Grid.RowDefinitions>
  137. <RowDefinition Height="Auto" />
  138. <RowDefinition Height="Auto" />
  139. </Grid.RowDefinitions>
  140. <Image
  141. Grid.Row="0"
  142. HorizontalAlignment="Stretch"
  143. VerticalAlignment="Top"
  144. Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
  145. <Panel
  146. Grid.Row="1"
  147. Height="50"
  148. Margin="0 10 0 0"
  149. HorizontalAlignment="Stretch"
  150. VerticalAlignment="Stretch"
  151. IsVisible="{Binding $parent[UserControl].DataContext.ShowNames}">
  152. <TextBlock
  153. HorizontalAlignment="Stretch"
  154. VerticalAlignment="Center"
  155. Text="{Binding TitleName}"
  156. TextAlignment="Center"
  157. TextWrapping="Wrap" />
  158. </Panel>
  159. </Grid>
  160. </Border>
  161. <ui:SymbolIcon
  162. Margin="5,5,0,0"
  163. HorizontalAlignment="Left"
  164. VerticalAlignment="Top"
  165. FontSize="16"
  166. Foreground="{DynamicResource SystemAccentColor}"
  167. IsVisible="{Binding Favorite}"
  168. Symbol="StarFilled" />
  169. </Grid>
  170. </DataTemplate>
  171. </ListBox.ItemTemplate>
  172. </ListBox>
  173. </Grid>
  174. </UserControl>