GameListView.axaml 13 KB

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