176 lines
11 KiB
XML
176 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"
|
|
x:Class="LANCommander.Launcher.Views.DownloadQueueView"
|
|
x:DataType="vm:DownloadQueueViewModel">
|
|
|
|
<Border Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}"
|
|
BorderBrush="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}"
|
|
BorderThickness="0,1,0,0"
|
|
IsVisible="{Binding HasItems}">
|
|
<DockPanel>
|
|
<!-- Header - always visible -->
|
|
<Border DockPanel.Dock="Top" Padding="12,8" Background="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}">
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right"
|
|
Command="{Binding ToggleExpandedCommand}"
|
|
Padding="6,2"
|
|
FontSize="10"
|
|
Background="Transparent"
|
|
IsVisible="{Binding HasItems}">
|
|
<Panel>
|
|
<TextBlock Text="▼" IsVisible="{Binding !IsExpanded}" />
|
|
<TextBlock Text="▲" IsVisible="{Binding IsExpanded}" />
|
|
</Panel>
|
|
</Button>
|
|
|
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
|
<Icon Type="Regular" Value="DownloadSimple" Width="16" Height="16" VerticalAlignment="Center" />
|
|
<TextBlock Text="Downloads" FontSize="13" FontWeight="SemiBold" VerticalAlignment="Center" />
|
|
|
|
<Border Background="{DynamicResource PrimaryBrush}"
|
|
CornerRadius="8"
|
|
Padding="6,2"
|
|
IsVisible="{Binding HasActiveDownload}">
|
|
<TextBlock Text="{Binding ActiveCount}" FontSize="11" Foreground="White" />
|
|
</Border>
|
|
</StackPanel>
|
|
</DockPanel>
|
|
</Border>
|
|
|
|
<!-- Collapsed state: mini progress -->
|
|
<Border DockPanel.Dock="Top"
|
|
Padding="12,4"
|
|
IsVisible="{Binding HasActiveDownload}">
|
|
<Grid RowDefinitions="Auto,Auto">
|
|
<DockPanel Grid.Row="0">
|
|
<TextBlock DockPanel.Dock="Right" Text="{Binding TransferSpeedText}" FontSize="11" Opacity="0.7" />
|
|
<TextBlock Text="{Binding CurrentItem.Title}" FontSize="12" TextTrimming="CharacterEllipsis" />
|
|
</DockPanel>
|
|
<ProgressBar Grid.Row="1"
|
|
Value="{Binding CurrentProgress}"
|
|
Minimum="0" Maximum="1"
|
|
Height="4"
|
|
Margin="0,4,0,0" />
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Expanded content -->
|
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
|
|
VerticalScrollBarVisibility="Auto"
|
|
MaxHeight="250"
|
|
IsVisible="{Binding IsExpanded}">
|
|
<ItemsControl ItemsSource="{Binding QueueItems}" Margin="8,4,8,8">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate DataType="vm:InstallQueueItemViewModel">
|
|
<Border Margin="0,0,0,4"
|
|
CornerRadius="6"
|
|
Background="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}"
|
|
ClipToBounds="True">
|
|
<StackPanel>
|
|
|
|
<!-- Item header (clickable) -->
|
|
<Button Background="Transparent"
|
|
BorderThickness="0"
|
|
Padding="0"
|
|
HorizontalAlignment="Stretch"
|
|
HorizontalContentAlignment="Stretch"
|
|
Command="{Binding $parent[ItemsControl].((vm:DownloadQueueViewModel)DataContext).ToggleItemExpandedCommand}"
|
|
CommandParameter="{Binding}">
|
|
<Grid ColumnDefinitions="Auto,*,Auto">
|
|
<!-- Cover art (compact) -->
|
|
<Border Grid.Column="0"
|
|
Width="40" Height="54"
|
|
CornerRadius="6,0,0,6"
|
|
ClipToBounds="True">
|
|
<Panel>
|
|
<Border Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}"
|
|
IsVisible="{Binding !HasCover}">
|
|
<Icon Type="Regular" Value="GameController"
|
|
Width="16" Height="16"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center" />
|
|
</Border>
|
|
<Image Source="{Binding CoverPath}"
|
|
Stretch="UniformToFill"
|
|
IsVisible="{Binding HasCover}" />
|
|
</Panel>
|
|
</Border>
|
|
|
|
<!-- Info -->
|
|
<StackPanel Grid.Column="1" Margin="8,6,8,6"
|
|
VerticalAlignment="Center" Spacing="2">
|
|
<TextBlock Text="{Binding Title}"
|
|
FontSize="11" FontWeight="SemiBold"
|
|
TextTrimming="CharacterEllipsis" />
|
|
|
|
<ProgressBar Value="{Binding Progress}"
|
|
Minimum="0" Maximum="1"
|
|
Height="3"
|
|
CornerRadius="1"
|
|
IsVisible="{Binding IsActive}" />
|
|
|
|
<StackPanel Orientation="Horizontal" Spacing="6"
|
|
IsVisible="{Binding IsActive}">
|
|
<TextBlock Text="{Binding PercentText}"
|
|
FontSize="10"
|
|
Foreground="{DynamicResource TextSecondaryBrush}" />
|
|
<TextBlock Text="{Binding SpeedText}"
|
|
FontSize="10"
|
|
Foreground="{DynamicResource TextDisabledBrush}" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<!-- Cancel -->
|
|
<Button Grid.Column="2"
|
|
Content="✕"
|
|
Command="{Binding $parent[ItemsControl].((vm:DownloadQueueViewModel)DataContext).CancelCommand}"
|
|
CommandParameter="{Binding}"
|
|
Padding="6,2"
|
|
FontSize="9"
|
|
Foreground="{DynamicResource ErrorBrush}"
|
|
Background="Transparent"
|
|
BorderThickness="0"
|
|
VerticalAlignment="Top"
|
|
Margin="0,6,4,0"
|
|
IsVisible="{Binding !IsCompleted}" />
|
|
</Grid>
|
|
</Button>
|
|
|
|
<!-- Task list (expanded) -->
|
|
<Border IsVisible="{Binding IsExpanded}"
|
|
Padding="10,4,10,8"
|
|
BorderThickness="0,1,0,0"
|
|
BorderBrush="{DynamicResource SystemControlBackgroundChromeMediumBrush}">
|
|
<ItemsControl ItemsSource="{Binding Tasks}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate DataType="vm:InstallTaskItemViewModel">
|
|
<Grid ColumnDefinitions="Auto,*" Margin="0,1">
|
|
<CheckBox Grid.Column="0"
|
|
IsChecked="{Binding IsChecked, Mode=OneWay}"
|
|
IsEnabled="False"
|
|
IsThreeState="False"
|
|
MinWidth="0"
|
|
Margin="0,0,6,0"
|
|
VerticalAlignment="Center" />
|
|
<TextBlock Grid.Column="1"
|
|
Text="{Binding Title}"
|
|
FontSize="10"
|
|
Foreground="{DynamicResource TextSecondaryBrush}"
|
|
VerticalAlignment="Center"
|
|
TextTrimming="CharacterEllipsis" />
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</Border>
|
|
|
|
</StackPanel>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</Border>
|
|
</UserControl>
|