GameGridView.axaml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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">
  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. IsEnabled="{Binding EnabledUserSaveDirectory}"
  26. Header="{locale:Locale GameListContextMenuOpenUserSaveDirectory}"
  27. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserSaveDirectoryToolTip}" />
  28. <MenuItem
  29. Command="{Binding OpenDeviceSaveDirectory}"
  30. IsEnabled="{Binding EnabledDeviceSaveDirectory}"
  31. Header="{locale:Locale GameListContextMenuOpenDeviceSaveDirectory}"
  32. ToolTip.Tip="{locale:Locale GameListContextMenuOpenDeviceSaveDirectoryToolTip}" />
  33. <MenuItem
  34. Command="{Binding OpenBcatSaveDirectory}"
  35. IsEnabled="{Binding EnabledBcatSaveDirectory}"
  36. Header="{locale:Locale GameListContextMenuOpenBcatSaveDirectory}"
  37. ToolTip.Tip="{locale:Locale GameListContextMenuOpenBcatSaveDirectoryToolTip}" />
  38. <Separator />
  39. <MenuItem
  40. Command="{Binding OpenTitleUpdateManager}"
  41. Header="{locale:Locale GameListContextMenuManageTitleUpdates}"
  42. ToolTip.Tip="{locale:Locale GameListContextMenuManageTitleUpdatesToolTip}" />
  43. <MenuItem
  44. Command="{Binding OpenDownloadableContentManager}"
  45. Header="{locale:Locale GameListContextMenuManageDlc}"
  46. ToolTip.Tip="{locale:Locale GameListContextMenuManageDlcToolTip}" />
  47. <MenuItem
  48. Command="{Binding OpenCheatManager}"
  49. Header="{locale:Locale GameListContextMenuManageCheat}"
  50. ToolTip.Tip="{locale:Locale GameListContextMenuManageCheatToolTip}" />
  51. <MenuItem
  52. Command="{Binding OpenModsDirectory}"
  53. Header="{locale:Locale GameListContextMenuOpenModsDirectory}"
  54. ToolTip.Tip="{locale:Locale GameListContextMenuOpenModsDirectoryToolTip}" />
  55. <MenuItem
  56. Command="{Binding OpenSdModsDirectory}"
  57. Header="{locale:Locale GameListContextMenuOpenSdModsDirectory}"
  58. ToolTip.Tip="{locale:Locale GameListContextMenuOpenSdModsDirectoryToolTip}" />
  59. <Separator />
  60. <MenuItem Header="{locale:Locale GameListContextMenuCacheManagement}">
  61. <MenuItem
  62. Command="{Binding PurgePtcCache}"
  63. Header="{locale:Locale GameListContextMenuCacheManagementPurgePptc}"
  64. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgePptcToolTip}" />
  65. <MenuItem
  66. Command="{Binding PurgeShaderCache}"
  67. Header="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCache}"
  68. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCacheToolTip}" />
  69. <MenuItem
  70. Command="{Binding OpenPtcDirectory}"
  71. Header="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectory}"
  72. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectoryToolTip}" />
  73. <MenuItem
  74. Command="{Binding OpenShaderCacheDirectory}"
  75. Header="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectory}"
  76. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectoryToolTip}" />
  77. </MenuItem>
  78. <MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
  79. <MenuItem
  80. Command="{Binding ExtractExeFs}"
  81. Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
  82. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
  83. <MenuItem
  84. Command="{Binding ExtractRomFs}"
  85. Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
  86. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
  87. <MenuItem
  88. Command="{Binding ExtractLogo}"
  89. Header="{locale:Locale GameListContextMenuExtractDataLogo}"
  90. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
  91. </MenuItem>
  92. </MenuFlyout>
  93. </UserControl.Resources>
  94. <Grid>
  95. <Grid.RowDefinitions>
  96. <RowDefinition Height="*" />
  97. </Grid.RowDefinitions>
  98. <ListBox
  99. Grid.Row="0"
  100. Padding="8"
  101. HorizontalAlignment="Stretch"
  102. VerticalAlignment="Stretch"
  103. ContextFlyout="{StaticResource GameContextMenu}"
  104. DoubleTapped="GameList_DoubleTapped"
  105. Items="{Binding AppsObservableList}"
  106. SelectionChanged="GameList_SelectionChanged">
  107. <ListBox.ItemsPanel>
  108. <ItemsPanelTemplate>
  109. <flex:FlexPanel
  110. HorizontalAlignment="Stretch"
  111. VerticalAlignment="Stretch"
  112. AlignContent="FlexStart"
  113. JustifyContent="Center" />
  114. </ItemsPanelTemplate>
  115. </ListBox.ItemsPanel>
  116. <ListBox.Styles>
  117. <Style Selector="ListBoxItem">
  118. <Setter Property="Margin" Value="5" />
  119. <Setter Property="CornerRadius" Value="4" />
  120. </Style>
  121. <Style Selector="ListBoxItem:selected /template/ Border#SelectionIndicator">
  122. <Setter Property="MinHeight" Value="{Binding $parent[UserControl].DataContext.GridItemSelectorSize}" />
  123. </Style>
  124. </ListBox.Styles>
  125. <ListBox.ItemTemplate>
  126. <DataTemplate>
  127. <Grid>
  128. <Border
  129. Margin="10"
  130. HorizontalAlignment="Stretch"
  131. VerticalAlignment="Stretch"
  132. Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
  133. Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
  134. Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
  135. Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
  136. ClipToBounds="True"
  137. CornerRadius="4">
  138. <Grid>
  139. <Grid.RowDefinitions>
  140. <RowDefinition Height="Auto" />
  141. <RowDefinition Height="Auto" />
  142. </Grid.RowDefinitions>
  143. <Image
  144. Grid.Row="0"
  145. HorizontalAlignment="Stretch"
  146. VerticalAlignment="Top"
  147. Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
  148. <Panel
  149. Grid.Row="1"
  150. Height="50"
  151. Margin="0 10 0 0"
  152. HorizontalAlignment="Stretch"
  153. VerticalAlignment="Stretch"
  154. IsVisible="{Binding $parent[UserControl].DataContext.ShowNames}">
  155. <TextBlock
  156. HorizontalAlignment="Stretch"
  157. VerticalAlignment="Center"
  158. Text="{Binding TitleName}"
  159. TextAlignment="Center"
  160. TextWrapping="Wrap" />
  161. </Panel>
  162. </Grid>
  163. </Border>
  164. <ui:SymbolIcon
  165. Margin="5,5,0,0"
  166. HorizontalAlignment="Left"
  167. VerticalAlignment="Top"
  168. FontSize="16"
  169. Foreground="{DynamicResource SystemAccentColor}"
  170. IsVisible="{Binding Favorite}"
  171. Symbol="StarFilled" />
  172. </Grid>
  173. </DataTemplate>
  174. </ListBox.ItemTemplate>
  175. </ListBox>
  176. </Grid>
  177. </UserControl>