GameListView.axaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <UserControl
  2. x:Class="Ryujinx.Ava.UI.Controls.GameListView"
  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:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
  9. xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
  10. d:DesignHeight="450"
  11. d:DesignWidth="800"
  12. mc:Ignorable="d"
  13. Focusable="True">
  14. <UserControl.Resources>
  15. <helpers:BitmapArrayValueConverter x:Key="ByteImage" />
  16. <MenuFlyout x:Key="GameContextMenu" Opened="MenuBase_OnMenuOpened">
  17. <MenuItem
  18. Command="{Binding ToggleFavorite}"
  19. Header="{locale:Locale GameListContextMenuToggleFavorite}"
  20. ToolTip.Tip="{locale:Locale GameListContextMenuToggleFavoriteToolTip}" />
  21. <Separator />
  22. <MenuItem
  23. Command="{Binding OpenUserSaveDirectory}"
  24. Header="{locale:Locale GameListContextMenuOpenUserSaveDirectory}"
  25. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserSaveDirectoryToolTip}" />
  26. <MenuItem
  27. Command="{Binding OpenDeviceSaveDirectory}"
  28. Header="{locale:Locale GameListContextMenuOpenDeviceSaveDirectory}"
  29. ToolTip.Tip="{locale:Locale GameListContextMenuOpenDeviceSaveDirectoryToolTip}" />
  30. <MenuItem
  31. Command="{Binding OpenBcatSaveDirectory}"
  32. Header="{locale:Locale GameListContextMenuOpenBcatSaveDirectory}"
  33. ToolTip.Tip="{locale:Locale GameListContextMenuOpenBcatSaveDirectoryToolTip}" />
  34. <Separator />
  35. <MenuItem
  36. Command="{Binding OpenTitleUpdateManager}"
  37. Header="{locale:Locale GameListContextMenuManageTitleUpdates}"
  38. ToolTip.Tip="{locale:Locale GameListContextMenuManageTitleUpdatesToolTip}" />
  39. <MenuItem
  40. Command="{Binding OpenDownloadableContentManager}"
  41. Header="{locale:Locale GameListContextMenuManageDlc}"
  42. ToolTip.Tip="{locale:Locale GameListContextMenuManageDlcToolTip}" />
  43. <MenuItem
  44. Command="{Binding OpenCheatManager}"
  45. Header="{locale:Locale GameListContextMenuManageCheat}"
  46. ToolTip.Tip="{locale:Locale GameListContextMenuManageCheatToolTip}" />
  47. <MenuItem
  48. Command="{Binding OpenModsDirectory}"
  49. Header="{locale:Locale GameListContextMenuOpenModsDirectory}"
  50. ToolTip.Tip="{locale:Locale GameListContextMenuOpenModsDirectoryToolTip}" />
  51. <MenuItem
  52. Command="{Binding OpenSdModsDirectory}"
  53. Header="{locale:Locale GameListContextMenuOpenSdModsDirectory}"
  54. ToolTip.Tip="{locale:Locale GameListContextMenuOpenSdModsDirectoryToolTip}" />
  55. <Separator />
  56. <MenuItem Header="{locale:Locale GameListContextMenuCacheManagement}">
  57. <MenuItem
  58. Command="{Binding PurgePtcCache}"
  59. Header="{locale:Locale GameListContextMenuCacheManagementPurgePptc}"
  60. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgePptcToolTip}" />
  61. <MenuItem
  62. Command="{Binding PurgeShaderCache}"
  63. Header="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCache}"
  64. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCacheToolTip}" />
  65. <MenuItem
  66. Command="{Binding OpenPtcDirectory}"
  67. Header="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectory}"
  68. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectoryToolTip}" />
  69. <MenuItem
  70. Command="{Binding OpenShaderCacheDirectory}"
  71. Header="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectory}"
  72. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectoryToolTip}" />
  73. </MenuItem>
  74. <MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
  75. <MenuItem
  76. Command="{Binding ExtractExeFs}"
  77. Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
  78. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
  79. <MenuItem
  80. Command="{Binding ExtractRomFs}"
  81. Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
  82. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
  83. <MenuItem
  84. Command="{Binding ExtractLogo}"
  85. Header="{locale:Locale GameListContextMenuExtractDataLogo}"
  86. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
  87. </MenuItem>
  88. </MenuFlyout>
  89. </UserControl.Resources>
  90. <Grid>
  91. <Grid.RowDefinitions>
  92. <RowDefinition Height="*" />
  93. </Grid.RowDefinitions>
  94. <ListBox
  95. Name="GameListBox"
  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. <StackPanel
  107. HorizontalAlignment="Stretch"
  108. VerticalAlignment="Stretch"
  109. Orientation="Vertical"
  110. Spacing="2" />
  111. </ItemsPanelTemplate>
  112. </ListBox.ItemsPanel>
  113. <ListBox.Styles>
  114. <Style Selector="ListBoxItem:selected /template/ Border#SelectionIndicator">
  115. <Setter Property="MinHeight" Value="{Binding $parent[UserControl].DataContext.ListItemSelectorSize}" />
  116. </Style>
  117. </ListBox.Styles>
  118. <ListBox.ItemTemplate>
  119. <DataTemplate>
  120. <Grid>
  121. <Border
  122. Margin="0"
  123. Padding="10"
  124. HorizontalAlignment="Stretch"
  125. VerticalAlignment="Stretch"
  126. ClipToBounds="True"
  127. CornerRadius="5">
  128. <Grid>
  129. <Grid.ColumnDefinitions>
  130. <ColumnDefinition Width="Auto" />
  131. <ColumnDefinition Width="10" />
  132. <ColumnDefinition Width="*" />
  133. <ColumnDefinition Width="Auto" />
  134. </Grid.ColumnDefinitions>
  135. <Image
  136. Grid.RowSpan="3"
  137. Grid.Column="0"
  138. Margin="0"
  139. Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
  140. Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
  141. Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
  142. Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
  143. Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
  144. <StackPanel
  145. Grid.Column="2"
  146. HorizontalAlignment="Left"
  147. VerticalAlignment="Top"
  148. Orientation="Vertical"
  149. Spacing="5" >
  150. <TextBlock
  151. HorizontalAlignment="Stretch"
  152. Text="{Binding TitleName}"
  153. TextAlignment="Left"
  154. TextWrapping="Wrap" />
  155. <TextBlock
  156. HorizontalAlignment="Stretch"
  157. Text="{Binding Developer}"
  158. TextAlignment="Left"
  159. TextWrapping="Wrap" />
  160. <TextBlock
  161. HorizontalAlignment="Stretch"
  162. Text="{Binding Version}"
  163. TextAlignment="Left"
  164. TextWrapping="Wrap" />
  165. </StackPanel>
  166. <StackPanel
  167. Grid.Column="3"
  168. HorizontalAlignment="Right"
  169. VerticalAlignment="Top"
  170. Orientation="Vertical"
  171. Spacing="5">
  172. <TextBlock
  173. HorizontalAlignment="Stretch"
  174. Text="{Binding TimePlayed}"
  175. TextAlignment="Right"
  176. TextWrapping="Wrap" />
  177. <TextBlock
  178. HorizontalAlignment="Stretch"
  179. Text="{Binding LastPlayed}"
  180. TextAlignment="Right"
  181. TextWrapping="Wrap" />
  182. <TextBlock
  183. HorizontalAlignment="Stretch"
  184. Text="{Binding FileSize}"
  185. TextAlignment="Right"
  186. TextWrapping="Wrap" />
  187. </StackPanel>
  188. <ui:SymbolIcon
  189. Grid.Row="0"
  190. Grid.Column="0"
  191. Margin="-5,-5,0,0"
  192. HorizontalAlignment="Left"
  193. VerticalAlignment="Top"
  194. FontSize="16"
  195. Foreground="{DynamicResource SystemAccentColor}"
  196. IsVisible="{Binding Favorite}"
  197. Symbol="StarFilled" />
  198. </Grid>
  199. </Border>
  200. </Grid>
  201. </DataTemplate>
  202. </ListBox.ItemTemplate>
  203. </ListBox>
  204. </Grid>
  205. </UserControl>