Loads the user's library from the /Library/Games endpoint and displays it immediately. This route returns a full data set for the user's games. Images are rendered directly from the server. The import still runs in the background, preserving any offline functionality.
194 lines
11 KiB
XML
194 lines
11 KiB
XML
<UserControl xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:vm="using:LANCommander.Launcher.ViewModels"
|
|
xmlns:vmComponents="using:LANCommander.Launcher.ViewModels.Components"
|
|
xmlns:components="using:LANCommander.Launcher.Views.Components"
|
|
xmlns:controls="using:LANCommander.Launcher.Controls"
|
|
xmlns:converters="using:LANCommander.Launcher.Converters"
|
|
xmlns:local="using:LANCommander.Launcher.Views"
|
|
x:Class="LANCommander.Launcher.Views.LibraryRowView"
|
|
x:DataType="vm:LibraryViewModel">
|
|
|
|
<UserControl.Styles>
|
|
<Style Selector="ListBox.CompactGamesList">
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Setter Property="Padding" Value="0" />
|
|
</Style>
|
|
<Style Selector="ListBox.CompactGamesList ListBoxItem">
|
|
<Setter Property="Padding" Value="0" />
|
|
<Setter Property="Margin" Value="0" />
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="Cursor" Value="Hand" />
|
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
|
<Setter Property="controls:GameContextMenu.IsEnabled" Value="True" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<ContentPresenter Name="PART_ContentPresenter"
|
|
Content="{TemplateBinding Content}"
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
Padding="{TemplateBinding Padding}" />
|
|
</ControlTemplate>
|
|
</Setter>
|
|
</Style>
|
|
<Style Selector="ListBox.CompactGamesList Border.CompactListRow">
|
|
<Setter Property="Background" Value="Transparent" />
|
|
</Style>
|
|
<Style Selector="ListBox.CompactGamesList ListBoxItem:pointerover Border.CompactListRow">
|
|
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundChromeMediumBrush}" />
|
|
</Style>
|
|
<Style Selector="ListBox.CompactGamesList ListBoxItem:selected Border.CompactListRow">
|
|
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundChromeMediumBrush}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource SystemAccentColor}" />
|
|
<Setter Property="BorderThickness" Value="2,0,0,0" />
|
|
</Style>
|
|
</UserControl.Styles>
|
|
|
|
<Grid ColumnDefinitions="250,*">
|
|
|
|
<!-- ═══ LEFT PANEL: Compact Game List ═══ -->
|
|
<Border Grid.Column="0"
|
|
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
|
BorderThickness="0,0,1,0"
|
|
Margin="0,48,0,0">
|
|
<ListBox x:Name="GameListBox"
|
|
Classes="CompactGamesList"
|
|
ItemsSource="{Binding Games}"
|
|
SelectedItem="{Binding SelectedGame}"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
|
Tapped="GameList_Tapped"
|
|
KeyDown="GameList_KeyDown">
|
|
<ListBox.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<VirtualizingStackPanel />
|
|
</ItemsPanelTemplate>
|
|
</ListBox.ItemsPanel>
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate DataType="vmComponents:GameItemViewModel">
|
|
<Border Classes="CompactListRow" Padding="8,4" CornerRadius="0">
|
|
<DockPanel>
|
|
<Image controls:AsyncImage.Source="{Binding IconPath}"
|
|
controls:AsyncImage.DecodeWidth="48"
|
|
Width="24" Height="24"
|
|
Stretch="Uniform"
|
|
Margin="0,0,8,0"
|
|
VerticalAlignment="Center" />
|
|
<StackPanel VerticalAlignment="Center" MinWidth="0">
|
|
<TextBlock Text="{Binding Title}"
|
|
FontSize="13"
|
|
TextTrimming="CharacterEllipsis"
|
|
Opacity="{Binding IsInstalled, Converter={x:Static converters:BoolToDoubleConverter.Instance}}" />
|
|
<TextBlock Text="Update Available"
|
|
FontSize="10"
|
|
Foreground="{DynamicResource SystemAccentColor}"
|
|
IsVisible="{Binding IsUpdateAvailable}" />
|
|
</StackPanel>
|
|
</DockPanel>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</Border>
|
|
|
|
<!-- ═══ RIGHT PANEL: Carousels + Grid ═══ -->
|
|
<ScrollViewer x:Name="RightPanelScrollViewer"
|
|
Classes="TitlebarOffset"
|
|
Grid.Column="1"
|
|
HorizontalScrollBarVisibility="Disabled"
|
|
VerticalScrollBarVisibility="Auto"
|
|
SizeChanged="RightPanelScrollViewer_SizeChanged">
|
|
<StackPanel Margin="10,48,10,24" Spacing="32" Grid.IsSharedSizeScope="True">
|
|
|
|
<!-- ══ RECENTLY PLAYED ═══════════════════════════════════════════════ -->
|
|
<CarouselControl x:Name="RecentlyPlayedCarousel"
|
|
Title="Recently Played"
|
|
ItemsSource="{Binding RecentlyPlayedGames}"
|
|
ItemWidth="160"
|
|
VisibleItems="5"
|
|
Gap="16"
|
|
ItemOverflow="14">
|
|
<CarouselControl.IsVisible>
|
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
|
<Binding Path="HasRecentlyPlayed" />
|
|
<Binding Path="!IsCollectionFiltered" />
|
|
</MultiBinding>
|
|
</CarouselControl.IsVisible>
|
|
<CarouselControl.ItemTemplate>
|
|
<DataTemplate x:DataType="vmComponents:GameItemViewModel">
|
|
<components:CoverButton Width="160" Height="240"
|
|
controls:GameContextMenu.IsEnabled="True"
|
|
Command="{Binding $parent[local:LibraryRowView].((vm:LibraryViewModel)DataContext).ViewGameDetailsCommand}"
|
|
CommandParameter="{Binding}" />
|
|
</DataTemplate>
|
|
</CarouselControl.ItemTemplate>
|
|
</CarouselControl>
|
|
|
|
<!-- ══ COLLECTIONS ═══════════════════════════════════════════════════ -->
|
|
<CarouselControl x:Name="CollectionsCarousel"
|
|
Title="Collections"
|
|
WrapItems="True"
|
|
ItemsSource="{Binding LibraryCollections}"
|
|
ItemWidth="200"
|
|
VisibleItems="4">
|
|
<CarouselControl.IsVisible>
|
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
|
<Binding Path="HasCollections" />
|
|
<Binding Path="!IsCollectionFiltered" />
|
|
</MultiBinding>
|
|
</CarouselControl.IsVisible>
|
|
<CarouselControl.ItemTemplate>
|
|
<DataTemplate x:DataType="vmComponents:GenreCarouselButtomViewModel">
|
|
<components:GenreCarouselButton Width="200" Height="150"
|
|
Command="{Binding $parent[local:LibraryRowView].((vm:LibraryViewModel)DataContext).FilterByCollectionCommand}"
|
|
CommandParameter="{Binding Name}" />
|
|
</DataTemplate>
|
|
</CarouselControl.ItemTemplate>
|
|
</CarouselControl>
|
|
|
|
<!-- ══ ALL GAMES GRID (75% size) ═════════════════════════════════════ -->
|
|
<StackPanel Margin="32,0,32,0" Spacing="4">
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right"
|
|
Command="{Binding ClearCollectionFilterCommand}"
|
|
Content="✕"
|
|
Classes="Text Error"
|
|
Padding="8,4"
|
|
Focusable="False"
|
|
IsVisible="{Binding IsCollectionFiltered}" />
|
|
<TextBlock Text="All Games" FontSize="18" FontWeight="SemiBold"
|
|
IsVisible="{Binding !IsCollectionFiltered}" />
|
|
<TextBlock Text="{Binding FilteredCollectionName}" FontSize="18" FontWeight="SemiBold"
|
|
IsVisible="{Binding IsCollectionFiltered}" />
|
|
</DockPanel>
|
|
<ItemsRepeater x:Name="LibraryGridItemsRepeater"
|
|
ItemsSource="{Binding Games}"
|
|
ClipToBounds="False"
|
|
controls:DirectionalNavigation.IsEnabled="True">
|
|
<ItemsRepeater.Layout>
|
|
<UniformGridLayout MinItemWidth="105" MinItemHeight="158"
|
|
MinColumnSpacing="12" MinRowSpacing="12"
|
|
ItemsStretch="None"
|
|
ItemsJustification="Start" />
|
|
</ItemsRepeater.Layout>
|
|
<ItemsRepeater.ItemTemplate>
|
|
<DataTemplate DataType="vmComponents:GameItemViewModel">
|
|
<components:CoverButton
|
|
Width="{Binding $parent[local:LibraryRowView].SmallCoverWidth}"
|
|
Height="{Binding $parent[local:LibraryRowView].SmallCoverHeight}"
|
|
controls:GameContextMenu.IsEnabled="True"
|
|
Command="{Binding $parent[ItemsRepeater].((vm:LibraryViewModel)DataContext).ViewGameDetailsCommand}"
|
|
CommandParameter="{Binding}" />
|
|
</DataTemplate>
|
|
</ItemsRepeater.ItemTemplate>
|
|
</ItemsRepeater>
|
|
</StackPanel>
|
|
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
|
|
</Grid>
|
|
</UserControl>
|