GameListView.axaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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 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 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">
  115. <Setter Property="Padding" Value="0" />
  116. <Setter Property="Margin" Value="0" />
  117. <Setter Property="CornerRadius" Value="5" />
  118. <Setter Property="Background" Value="{DynamicResource AppListBackgroundColor}" />
  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. <Style Selector="ListBoxItem:selected /template/ ContentPresenter">
  138. <Setter Property="Background" Value="{DynamicResource AppListBackgroundColor}" />
  139. </Style>
  140. <Style Selector="ListBoxItem:selected /template/ Border#SelectionIndicator">
  141. <Setter Property="MinHeight" Value="100" />
  142. </Style>
  143. <Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
  144. <Setter Property="Background" Value="{DynamicResource AppListHoverBackgroundColor}" />
  145. </Style>
  146. </ListBox.Styles>
  147. <ListBox.ItemTemplate>
  148. <DataTemplate>
  149. <Grid>
  150. <Border
  151. Margin="0"
  152. Padding="10"
  153. HorizontalAlignment="Stretch"
  154. VerticalAlignment="Stretch"
  155. ClipToBounds="True"
  156. CornerRadius="5">
  157. <Grid>
  158. <Grid.ColumnDefinitions>
  159. <ColumnDefinition Width="Auto" />
  160. <ColumnDefinition Width="10" />
  161. <ColumnDefinition Width="*" />
  162. <ColumnDefinition Width="Auto" />
  163. </Grid.ColumnDefinitions>
  164. <Image
  165. Grid.RowSpan="3"
  166. Grid.Column="0"
  167. Margin="0"
  168. Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
  169. Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
  170. Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
  171. Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
  172. Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
  173. <StackPanel
  174. Grid.Column="2"
  175. HorizontalAlignment="Left"
  176. VerticalAlignment="Top"
  177. Orientation="Vertical"
  178. Spacing="5" >
  179. <TextBlock
  180. HorizontalAlignment="Stretch"
  181. Text="{Binding TitleName}"
  182. TextAlignment="Left"
  183. TextWrapping="Wrap" />
  184. <TextBlock
  185. HorizontalAlignment="Stretch"
  186. Text="{Binding Developer}"
  187. TextAlignment="Left"
  188. TextWrapping="Wrap" />
  189. <TextBlock
  190. HorizontalAlignment="Stretch"
  191. Text="{Binding Version}"
  192. TextAlignment="Left"
  193. TextWrapping="Wrap" />
  194. </StackPanel>
  195. <StackPanel
  196. Grid.Column="3"
  197. HorizontalAlignment="Right"
  198. VerticalAlignment="Top"
  199. Orientation="Vertical"
  200. Spacing="5">
  201. <TextBlock
  202. HorizontalAlignment="Stretch"
  203. Text="{Binding TimePlayed}"
  204. TextAlignment="Right"
  205. TextWrapping="Wrap" />
  206. <TextBlock
  207. HorizontalAlignment="Stretch"
  208. Text="{Binding LastPlayed}"
  209. TextAlignment="Right"
  210. TextWrapping="Wrap" />
  211. <TextBlock
  212. HorizontalAlignment="Stretch"
  213. Text="{Binding FileSize}"
  214. TextAlignment="Right"
  215. TextWrapping="Wrap" />
  216. </StackPanel>
  217. <ui:SymbolIcon
  218. Grid.Row="0"
  219. Grid.Column="0"
  220. Margin="-5,-5,0,0"
  221. HorizontalAlignment="Left"
  222. VerticalAlignment="Top"
  223. FontSize="16"
  224. Foreground="{DynamicResource SystemAccentColor}"
  225. IsVisible="{Binding Favorite}"
  226. Symbol="StarFilled" />
  227. </Grid>
  228. </Border>
  229. </Grid>
  230. </DataTemplate>
  231. </ListBox.ItemTemplate>
  232. </ListBox>
  233. </Grid>
  234. </UserControl>