GameListView.axaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. Focusable="True">
  15. <UserControl.Resources>
  16. <controls: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 GameListContextMenuOpenUserDeviceDirectory}"
  30. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserDeviceDirectoryToolTip}" />
  31. <MenuItem
  32. Command="{Binding OpenBcatSaveDirectory}"
  33. Header="{locale:Locale GameListContextMenuOpenUserBcatDirectory}"
  34. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserBcatDirectoryToolTip}" />
  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. Name="GameListBox"
  97. Grid.Row="0"
  98. Padding="8"
  99. HorizontalAlignment="Stretch"
  100. VerticalAlignment="Stretch"
  101. ContextFlyout="{StaticResource GameContextMenu}"
  102. DoubleTapped="GameList_DoubleTapped"
  103. Items="{Binding AppsObservableList}"
  104. SelectionChanged="GameList_SelectionChanged">
  105. <ListBox.ItemsPanel>
  106. <ItemsPanelTemplate>
  107. <StackPanel
  108. HorizontalAlignment="Stretch"
  109. VerticalAlignment="Stretch"
  110. Orientation="Vertical"
  111. Spacing="2" />
  112. </ItemsPanelTemplate>
  113. </ListBox.ItemsPanel>
  114. <ListBox.Styles>
  115. <Style Selector="ListBoxItem">
  116. <Setter Property="Padding" Value="0" />
  117. <Setter Property="Margin" Value="0" />
  118. <Setter Property="CornerRadius" Value="5" />
  119. <Setter Property="Background" Value="{DynamicResource AppListBackgroundColor}" />
  120. <Setter Property="BorderThickness" Value="2"/>
  121. <Style.Animations>
  122. <Animation Duration="0:0:0.7">
  123. <KeyFrame Cue="0%">
  124. <Setter Property="MaxHeight" Value="0" />
  125. <Setter Property="Opacity" Value="0.0" />
  126. </KeyFrame>
  127. <KeyFrame Cue="50%">
  128. <Setter Property="MaxHeight" Value="1000" />
  129. <Setter Property="Opacity" Value="0.3" />
  130. </KeyFrame>
  131. <KeyFrame Cue="100%">
  132. <Setter Property="MaxHeight" Value="1000" />
  133. <Setter Property="Opacity" Value="1.0" />
  134. </KeyFrame>
  135. </Animation>
  136. </Style.Animations>
  137. </Style>
  138. <Style Selector="ListBoxItem:selected /template/ ContentPresenter">
  139. <Setter Property="Background" Value="{DynamicResource AppListBackgroundColor}" />
  140. </Style>
  141. <Style Selector="ListBoxItem:selected /template/ Border#SelectionIndicator">
  142. <Setter Property="MinHeight" Value="100" />
  143. </Style>
  144. <Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
  145. <Setter Property="Background" Value="{DynamicResource AppListHoverBackgroundColor}" />
  146. </Style>
  147. </ListBox.Styles>
  148. <ListBox.ItemTemplate>
  149. <DataTemplate>
  150. <Grid>
  151. <Border
  152. Margin="0"
  153. Padding="10"
  154. HorizontalAlignment="Stretch"
  155. VerticalAlignment="Stretch"
  156. ClipToBounds="True"
  157. CornerRadius="5">
  158. <Grid>
  159. <Grid.ColumnDefinitions>
  160. <ColumnDefinition Width="Auto" />
  161. <ColumnDefinition Width="10" />
  162. <ColumnDefinition Width="*" />
  163. <ColumnDefinition Width="Auto" />
  164. </Grid.ColumnDefinitions>
  165. <Image
  166. Grid.RowSpan="3"
  167. Grid.Column="0"
  168. Margin="0"
  169. Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
  170. Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
  171. Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
  172. Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
  173. Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
  174. <StackPanel
  175. Grid.Column="2"
  176. HorizontalAlignment="Left"
  177. VerticalAlignment="Top"
  178. Orientation="Vertical"
  179. Spacing="5" >
  180. <TextBlock
  181. HorizontalAlignment="Stretch"
  182. Text="{Binding TitleName}"
  183. TextAlignment="Left"
  184. TextWrapping="Wrap" />
  185. <TextBlock
  186. HorizontalAlignment="Stretch"
  187. Text="{Binding Developer}"
  188. TextAlignment="Left"
  189. TextWrapping="Wrap" />
  190. <TextBlock
  191. HorizontalAlignment="Stretch"
  192. Text="{Binding Version}"
  193. TextAlignment="Left"
  194. TextWrapping="Wrap" />
  195. </StackPanel>
  196. <StackPanel
  197. Grid.Column="3"
  198. HorizontalAlignment="Right"
  199. VerticalAlignment="Top"
  200. Orientation="Vertical"
  201. Spacing="5">
  202. <TextBlock
  203. HorizontalAlignment="Stretch"
  204. Text="{Binding TimePlayed}"
  205. TextAlignment="Right"
  206. TextWrapping="Wrap" />
  207. <TextBlock
  208. HorizontalAlignment="Stretch"
  209. Text="{Binding LastPlayed}"
  210. TextAlignment="Right"
  211. TextWrapping="Wrap" />
  212. <TextBlock
  213. HorizontalAlignment="Stretch"
  214. Text="{Binding FileSize}"
  215. TextAlignment="Right"
  216. TextWrapping="Wrap" />
  217. </StackPanel>
  218. <ui:SymbolIcon
  219. Grid.Row="0"
  220. Grid.Column="0"
  221. Margin="-5,-5,0,0"
  222. HorizontalAlignment="Left"
  223. VerticalAlignment="Top"
  224. FontSize="16"
  225. Foreground="{DynamicResource SystemAccentColor}"
  226. IsVisible="{Binding Favorite}"
  227. Symbol="StarFilled" />
  228. </Grid>
  229. </Border>
  230. </Grid>
  231. </DataTemplate>
  232. </ListBox.ItemTemplate>
  233. </ListBox>
  234. </Grid>
  235. </UserControl>