GameListView.axaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  4. xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
  7. xmlns:controls="clr-namespace:Ryujinx.Ava.Ui.Controls"
  8. xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
  9. mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
  10. x:Class="Ryujinx.Ava.Ui.Controls.GameListView">
  11. <UserControl.Resources>
  12. <controls:BitmapArrayValueConverter x:Key="ByteImage" />
  13. <MenuFlyout x:Key="GameContextMenu" Opened="MenuBase_OnMenuOpened">
  14. <MenuItem
  15. Command="{Binding ToggleFavorite}"
  16. Header="{locale:Locale GameListContextMenuToggleFavorite}"
  17. ToolTip.Tip="{locale:Locale GameListContextMenuToggleFavoriteToolTip}" />
  18. <Separator />
  19. <MenuItem
  20. Command="{Binding OpenUserSaveDirectory}"
  21. Header="{locale:Locale GameListContextMenuOpenUserSaveDirectory}"
  22. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserSaveDirectoryToolTip}" />
  23. <MenuItem
  24. Command="{Binding OpenDeviceSaveDirectory}"
  25. Header="{locale:Locale GameListContextMenuOpenUserDeviceDirectory}"
  26. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserDeviceDirectoryToolTip}" />
  27. <MenuItem
  28. Command="{Binding OpenBcatSaveDirectory}"
  29. Header="{locale:Locale GameListContextMenuOpenUserBcatDirectory}"
  30. ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserBcatDirectoryToolTip}" />
  31. <Separator />
  32. <MenuItem
  33. Command="{Binding OpenTitleUpdateManager}"
  34. Header="{locale:Locale GameListContextMenuManageTitleUpdates}"
  35. ToolTip.Tip="{locale:Locale GameListContextMenuManageTitleUpdatesToolTip}" />
  36. <MenuItem
  37. Command="{Binding OpenDlcManager}"
  38. Header="{locale:Locale GameListContextMenuManageDlc}"
  39. ToolTip.Tip="{locale:Locale GameListContextMenuManageDlcToolTip}" />
  40. <MenuItem
  41. Command="{Binding OpenCheatManager}"
  42. Header="{locale:Locale GameListContextMenuManageCheat}"
  43. ToolTip.Tip="{locale:Locale GameListContextMenuManageCheatToolTip}" />
  44. <MenuItem
  45. Command="{Binding OpenModsDirectory}"
  46. Header="{locale:Locale GameListContextMenuOpenModsDirectory}"
  47. ToolTip.Tip="{locale:Locale GameListContextMenuOpenModsDirectoryToolTip}" />
  48. <MenuItem
  49. Command="{Binding OpenSdModsDirectory}"
  50. Header="{locale:Locale GameListContextMenuOpenSdModsDirectory}"
  51. ToolTip.Tip="{locale:Locale GameListContextMenuOpenSdModsDirectoryToolTip}" />
  52. <Separator />
  53. <MenuItem Header="{locale:Locale GameListContextMenuCacheManagement}">
  54. <MenuItem
  55. Command="{Binding PurgePtcCache}"
  56. Header="{locale:Locale GameListContextMenuCacheManagementPurgePptc}"
  57. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgePptcToolTip}" />
  58. <MenuItem
  59. Command="{Binding PurgeShaderCache}"
  60. Header="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCache}"
  61. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCacheToolTip}" />
  62. <MenuItem
  63. Command="{Binding OpenPtcDirectory}"
  64. Header="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectory}"
  65. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectoryToolTip}" />
  66. <MenuItem
  67. Command="{Binding OpenShaderCacheDirectory}"
  68. Header="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectory}"
  69. ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectoryToolTip}" />
  70. </MenuItem>
  71. <MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
  72. <MenuItem
  73. Command="{Binding ExtractExeFs}"
  74. Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
  75. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
  76. <MenuItem
  77. Command="{Binding ExtractRomFs}"
  78. Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
  79. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
  80. <MenuItem
  81. Command="{Binding ExtractLogo}"
  82. Header="{locale:Locale GameListContextMenuExtractDataLogo}"
  83. ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
  84. </MenuItem>
  85. </MenuFlyout>
  86. </UserControl.Resources>
  87. <Grid>
  88. <Grid.RowDefinitions>
  89. <RowDefinition Height="*" />
  90. </Grid.RowDefinitions>
  91. <ListBox Grid.Row="0"
  92. Padding="8"
  93. HorizontalAlignment="Stretch"
  94. DoubleTapped="GameList_DoubleTapped"
  95. SelectionChanged="GameList_SelectionChanged"
  96. ContextFlyout="{StaticResource GameContextMenu}"
  97. VerticalAlignment="Stretch"
  98. Name="GameListBox"
  99. Items="{Binding AppsObservableList}">
  100. <ListBox.ItemsPanel>
  101. <ItemsPanelTemplate>
  102. <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Orientation="Vertical" Spacing="2" />
  103. </ItemsPanelTemplate>
  104. </ListBox.ItemsPanel>
  105. <ListBox.Styles>
  106. <Style Selector="ListBoxItem">
  107. <Setter Property="Padding" Value="0" />
  108. <Setter Property="Margin" Value="0" />
  109. <Setter Property="CornerRadius" Value="5" />
  110. <Setter Property="BorderBrush" Value="{DynamicResource SystemAccentColorDark3}" />
  111. <Setter Property="BorderThickness" Value="2" />
  112. <Style.Animations>
  113. <Animation Duration="0:0:0.7">
  114. <KeyFrame Cue="0%">
  115. <Setter Property="MaxHeight" Value="0"/>
  116. <Setter Property="Opacity" Value="0.0"/>
  117. </KeyFrame>
  118. <KeyFrame Cue="50%">
  119. <Setter Property="MaxHeight" Value="1000"/>
  120. <Setter Property="Opacity" Value="0.3"/>
  121. </KeyFrame>
  122. <KeyFrame Cue="100%">
  123. <Setter Property="MaxHeight" Value="1000"/>
  124. <Setter Property="Opacity" Value="1.0"/>
  125. </KeyFrame>
  126. </Animation>
  127. </Style.Animations>
  128. </Style>
  129. </ListBox.Styles>
  130. <ListBox.ItemTemplate>
  131. <DataTemplate>
  132. <Grid>
  133. <Border HorizontalAlignment="Stretch"
  134. Padding="10" CornerRadius="5"
  135. VerticalAlignment="Stretch" Margin="0" ClipToBounds="True">
  136. <Grid >
  137. <Grid.ColumnDefinitions>
  138. <ColumnDefinition Width="Auto"/>
  139. <ColumnDefinition Width="10"/>
  140. <ColumnDefinition Width="*"/>
  141. <ColumnDefinition Width="Auto"/>
  142. </Grid.ColumnDefinitions>
  143. <Grid.RowDefinitions>
  144. <RowDefinition/>
  145. </Grid.RowDefinitions>
  146. <Image
  147. Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
  148. Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
  149. Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
  150. Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
  151. Grid.RowSpan="3" Grid.Column="0" Margin="0"
  152. Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
  153. <StackPanel Orientation="Vertical" Spacing="5" VerticalAlignment="Top" HorizontalAlignment="Left"
  154. Grid.Column="2">
  155. <TextBlock Text="{Binding TitleName}" TextAlignment="Left" TextWrapping="Wrap"
  156. HorizontalAlignment="Stretch" />
  157. <TextBlock Text="{Binding Developer}" TextAlignment="Left" TextWrapping="Wrap"
  158. HorizontalAlignment="Stretch" />
  159. <TextBlock Text="{Binding Version}" TextAlignment="Left" TextWrapping="Wrap"
  160. HorizontalAlignment="Stretch" />
  161. </StackPanel>
  162. <StackPanel Orientation="Vertical" Spacing="5" VerticalAlignment="Top" HorizontalAlignment="Right"
  163. Grid.Column="3">
  164. <TextBlock Text="{Binding TimePlayed}" TextAlignment="Right" TextWrapping="Wrap"
  165. HorizontalAlignment="Stretch" />
  166. <TextBlock Text="{Binding LastPlayed}" TextAlignment="Right" TextWrapping="Wrap"
  167. HorizontalAlignment="Stretch" />
  168. <TextBlock Text="{Binding FileSize}" TextAlignment="Right" TextWrapping="Wrap"
  169. HorizontalAlignment="Stretch" />
  170. </StackPanel>
  171. <ui:SymbolIcon Grid.Row="0" Grid.Column="0" FontSize="20"
  172. Foreground="Yellow"
  173. Symbol="StarFilled"
  174. IsVisible="{Binding Favorite}" Margin="-5, -5, 0, 0" VerticalAlignment="Top"
  175. HorizontalAlignment="Left" />
  176. <ui:SymbolIcon Grid.Row="0" Grid.Column="0" FontSize="20"
  177. Foreground="Black"
  178. Symbol="Star"
  179. IsVisible="{Binding Favorite}" Margin="-5, -5, 0, 0" VerticalAlignment="Top"
  180. HorizontalAlignment="Left" />
  181. </Grid>
  182. </Border>
  183. </Grid>
  184. </DataTemplate>
  185. </ListBox.ItemTemplate>
  186. </ListBox>
  187. </Grid>
  188. </UserControl>