157 lines
9.1 KiB
XML
157 lines
9.1 KiB
XML
<UserControl xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:vm="using:LANCommander.Launcher.Avalonia.ViewModels"
|
|
x:Class="LANCommander.Launcher.Avalonia.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" />
|
|
|
|
<!-- Badge showing count -->
|
|
<Border Background="{DynamicResource SystemAccentColor}"
|
|
CornerRadius="8"
|
|
Padding="6,2"
|
|
IsVisible="{Binding HasActiveDownload}">
|
|
<TextBlock Text="{Binding ActiveCount}" FontSize="11" Foreground="White" />
|
|
</Border>
|
|
</StackPanel>
|
|
</DockPanel>
|
|
</Border>
|
|
|
|
<!-- Collapsed state: show mini progress bar if downloading -->
|
|
<Border DockPanel.Dock="Top"
|
|
Padding="12,4"
|
|
IsVisible="{Binding HasActiveDownload}">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
<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="200"
|
|
IsVisible="{Binding IsExpanded}">
|
|
<StackPanel Spacing="4" Margin="8">
|
|
|
|
<!-- Current Download -->
|
|
<Border Padding="8" CornerRadius="6"
|
|
Background="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}"
|
|
IsVisible="{Binding CurrentItem, Converter={x:Static ObjectConverters.IsNotNull}}">
|
|
<Grid RowDefinitions="Auto,Auto,Auto">
|
|
<!-- Title and Cancel -->
|
|
<DockPanel Grid.Row="0">
|
|
<Button DockPanel.Dock="Right"
|
|
Content="✕"
|
|
Command="{Binding CancelCommand}"
|
|
CommandParameter="{Binding CurrentItem}"
|
|
Padding="4,2"
|
|
FontSize="10"
|
|
Foreground="IndianRed"
|
|
Background="Transparent" />
|
|
<TextBlock Text="{Binding CurrentItem.Title}"
|
|
FontSize="12"
|
|
FontWeight="SemiBold"
|
|
TextTrimming="CharacterEllipsis" />
|
|
</DockPanel>
|
|
|
|
<!-- Status -->
|
|
<StackPanel Grid.Row="1" Orientation="Horizontal" Spacing="6" Margin="0,2,0,0">
|
|
<TextBlock Text="{Binding CurrentStatus}" FontSize="11" Opacity="0.7" />
|
|
<TextBlock Text="•" FontSize="11" Opacity="0.5" />
|
|
<TextBlock Text="{Binding CurrentProgressText}" FontSize="11" Opacity="0.7" />
|
|
</StackPanel>
|
|
|
|
<!-- Progress Bar -->
|
|
<ProgressBar Grid.Row="2"
|
|
Value="{Binding CurrentProgress}"
|
|
Minimum="0" Maximum="1"
|
|
Height="4"
|
|
Margin="0,4,0,0" />
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Queued Items -->
|
|
<ItemsControl ItemsSource="{Binding QueueItems}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate DataType="vm:InstallQueueItemViewModel">
|
|
<Border Padding="8,4" Margin="0,0,0,2" CornerRadius="4"
|
|
Background="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}"
|
|
IsVisible="{Binding IsQueued}">
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right"
|
|
Content="✕"
|
|
Command="{Binding $parent[ItemsControl].((vm:DownloadQueueViewModel)DataContext).RemoveCommand}"
|
|
CommandParameter="{Binding}"
|
|
Padding="4,2"
|
|
FontSize="10"
|
|
Foreground="IndianRed"
|
|
Background="Transparent" />
|
|
|
|
<TextBlock Text="{Binding Title}"
|
|
FontSize="11"
|
|
VerticalAlignment="Center"
|
|
TextTrimming="CharacterEllipsis" />
|
|
</DockPanel>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
|
|
<!-- Completed Items -->
|
|
<ItemsControl ItemsSource="{Binding QueueItems}" IsVisible="{Binding HasCompletedItems}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate DataType="vm:InstallQueueItemViewModel">
|
|
<Border Padding="8,4" Margin="0,0,0,2" CornerRadius="4"
|
|
Background="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}"
|
|
IsVisible="{Binding IsCompleted}">
|
|
<DockPanel>
|
|
<TextBlock DockPanel.Dock="Right" Text="✓" Foreground="Green"
|
|
FontSize="12" VerticalAlignment="Center" />
|
|
<TextBlock Text="{Binding Title}"
|
|
FontSize="11"
|
|
VerticalAlignment="Center"
|
|
TextTrimming="CharacterEllipsis" />
|
|
</DockPanel>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</Border>
|
|
</UserControl>
|