GameListView.axaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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:controls="clr-namespace:Ryujinx.Ava.Ui.Controls"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
  8. xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
  9. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  10. xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
  11. d:DesignHeight="450"
  12. d:DesignWidth="800"
  13. mc:Ignorable="d">
  14. <UserControl.Resources>
  15. <controls: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 GameListContextMenuOpenUserDeviceDirectory}"
  29. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserDeviceDirectoryToolTip}" />
  30. <MenuItem
  31. Command="{Binding OpenBcatSaveDirectory}"
  32. Header="{locale:Locale GameListContextMenuOpenUserBcatDirectory}"
  33. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserBcatDirectoryToolTip}" />
  34. <Separator />
  35. <MenuItem
  36. Command="{Binding OpenTitleUpdateManager}"
  37. Header="{locale:Locale GameListContextMenuManageTitleUpdates}"
  38. ToolTip.Tip="{locale:Locale GameListContextMenuManageTitleUpdatesToolTip}" />
  39. <MenuItem
  40. Command="{Binding OpenDlcManager}"
  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">
  115. <Setter Property="Padding" Value="0" />
  116. <Setter Property="Margin" Value="0" />
  117. <Setter Property="CornerRadius" Value="5" />
  118. <Setter Property="BorderBrush" Value="{DynamicResource SystemAccentColorDark3}" />
  119. <Setter Property="BorderThickness" Value="2" />
  120. <Style.Animations>
  121. <Animation Duration="0:0:0.7">
  122. <KeyFrame Cue="0%">
  123. <Setter Property="MaxHeight" Value="0" />
  124. <Setter Property="Opacity" Value="0.0" />
  125. </KeyFrame>
  126. <KeyFrame Cue="50%">
  127. <Setter Property="MaxHeight" Value="1000" />
  128. <Setter Property="Opacity" Value="0.3" />
  129. </KeyFrame>
  130. <KeyFrame Cue="100%">
  131. <Setter Property="MaxHeight" Value="1000" />
  132. <Setter Property="Opacity" Value="1.0" />
  133. </KeyFrame>
  134. </Animation>
  135. </Style.Animations>
  136. </Style>
  137. </ListBox.Styles>
  138. <ListBox.ItemTemplate>
  139. <DataTemplate>
  140. <Grid>
  141. <Border
  142. Margin="0"
  143. Padding="10"
  144. HorizontalAlignment="Stretch"
  145. VerticalAlignment="Stretch"
  146. ClipToBounds="True"
  147. CornerRadius="5">
  148. <Grid>
  149. <Grid.ColumnDefinitions>
  150. <ColumnDefinition Width="Auto" />
  151. <ColumnDefinition Width="10" />
  152. <ColumnDefinition Width="*" />
  153. <ColumnDefinition Width="Auto" />
  154. </Grid.ColumnDefinitions>
  155. <Grid.RowDefinitions>
  156. <RowDefinition />
  157. </Grid.RowDefinitions>
  158. <Image
  159. Grid.RowSpan="3"
  160. Grid.Column="0"
  161. Margin="0"
  162. Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
  163. Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
  164. Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
  165. Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
  166. Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
  167. <StackPanel
  168. Grid.Column="2"
  169. HorizontalAlignment="Left"
  170. VerticalAlignment="Top"
  171. Orientation="Vertical"
  172. Spacing="5">
  173. <TextBlock
  174. HorizontalAlignment="Stretch"
  175. Text="{Binding TitleName}"
  176. TextAlignment="Left"
  177. TextWrapping="Wrap" />
  178. <TextBlock
  179. HorizontalAlignment="Stretch"
  180. Text="{Binding Developer}"
  181. TextAlignment="Left"
  182. TextWrapping="Wrap" />
  183. <TextBlock
  184. HorizontalAlignment="Stretch"
  185. Text="{Binding Version}"
  186. TextAlignment="Left"
  187. TextWrapping="Wrap" />
  188. </StackPanel>
  189. <StackPanel
  190. Grid.Column="3"
  191. HorizontalAlignment="Right"
  192. VerticalAlignment="Top"
  193. Orientation="Vertical"
  194. Spacing="5">
  195. <TextBlock
  196. HorizontalAlignment="Stretch"
  197. Text="{Binding TimePlayed}"
  198. TextAlignment="Right"
  199. TextWrapping="Wrap" />
  200. <TextBlock
  201. HorizontalAlignment="Stretch"
  202. Text="{Binding LastPlayed}"
  203. TextAlignment="Right"
  204. TextWrapping="Wrap" />
  205. <TextBlock
  206. HorizontalAlignment="Stretch"
  207. Text="{Binding FileSize}"
  208. TextAlignment="Right"
  209. TextWrapping="Wrap" />
  210. </StackPanel>
  211. <ui:SymbolIcon
  212. Grid.Row="0"
  213. Grid.Column="0"
  214. Margin="-5,-5,0,0"
  215. HorizontalAlignment="Left"
  216. VerticalAlignment="Top"
  217. FontSize="20"
  218. Foreground="Yellow"
  219. IsVisible="{Binding Favorite}"
  220. Symbol="StarFilled" />
  221. <ui:SymbolIcon
  222. Grid.Row="0"
  223. Grid.Column="0"
  224. Margin="-5,-5,0,0"
  225. HorizontalAlignment="Left"
  226. VerticalAlignment="Top"
  227. FontSize="20"
  228. Foreground="Black"
  229. IsVisible="{Binding Favorite}"
  230. Symbol="Star" />
  231. </Grid>
  232. </Border>
  233. </Grid>
  234. </DataTemplate>
  235. </ListBox.ItemTemplate>
  236. </ListBox>
  237. </Grid>
  238. </UserControl>