You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
downkyi/DownKyi/Views/DownloadManager/ViewDownloading.xaml

351 lines
19 KiB

<UserControl
x:Class="DownKyi.Views.DownloadManager.ViewDownloading"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="clr-namespace:DownKyi.Converter"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True">
<UserControl.Resources>
<converter:CountConverter x:Key="CountConverter" Count="0" />
<Style x:Key="DownloadingStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}, Path=ActualWidth}" Height="70">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="320" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<Image
Grid.Column="0"
Width="48"
Height="48"
Source="{Binding ZoneImage}" />
<!-- 标题等视频信息 -->
<Grid
Grid.Column="1"
Margin="0,0,10,0"
HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Foreground="{DynamicResource BrushTextDark}"
TextTrimming="CharacterEllipsis">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}-{1}-{2}">
<Binding Path="Order" />
<Binding Path="MainTitle" />
<Binding Path="Name" />
</MultiBinding>
</TextBlock.Text>
<TextBlock.ToolTip>
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}-{1}">
<Binding Path="MainTitle" />
<Binding Path="Name" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</TextBlock.ToolTip>
</TextBlock>
<TextBlock
Grid.Row="1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource BrushTextGrey2}">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} · {1} · {2} · {3}">
<Binding Path="Duration" />
<Binding Path="Resolution.Name" />
<Binding Path="VideoCodecName" />
<Binding Path="AudioCodec.Name" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Grid>
<!-- 进度条 -->
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0" VerticalAlignment="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock
HorizontalAlignment="Left"
FontSize="12"
Foreground="{DynamicResource BrushTextDark}"
Text="{Binding DownloadContent}" />
<TextBlock
HorizontalAlignment="Left"
FontSize="12"
Foreground="{DynamicResource BrushTextDark}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Text" Value="{Binding StringFormat={} {0}, Path=DownloadStatusTitle}" />
<Style.Triggers>
<DataTrigger Binding="{Binding DownloadContent}" Value="">
<Setter Property="Text" Value="{Binding DownloadStatusTitle}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
<TextBlock
Grid.Column="1"
HorizontalAlignment="Right"
FontSize="12"
Foreground="{DynamicResource BrushTextGrey2}">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} {1}">
<Binding Path="DownloadingFileSize" />
<Binding Path="SpeedDisplay" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Grid>
<ProgressBar
Grid.Row="1"
Height="20"
VerticalAlignment="Top"
BorderBrush="{x:Null}"
BorderThickness="0"
Value="{Binding Progress}">
<ProgressBar.Style>
<Style TargetType="{x:Type ProgressBar}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<Border
Name="PART_Track"
Background="{DynamicResource BrushForegroundGrey2}"
BorderThickness="0" />
<Border
Name="PART_Indicator"
HorizontalAlignment="Left"
Background="{DynamicResource BrushPrimary}"
BorderThickness="0" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ProgressBar.Style>
</ProgressBar>
</Grid>
<!-- 控制面板,暂停继续删除 -->
<Grid Grid.Column="3">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button
Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Command="{Binding StartOrPauseCommand}"
Style="{StaticResource ImageBtnStyle}"
ToolTip="{Binding OperationTip}">
<ContentControl Width="20" Height="20">
<Path
Width="{Binding StartOrPause.Width}"
Height="{Binding StartOrPause.Height}"
Data="{Binding StartOrPause.Data}"
Fill="{Binding StartOrPause.Fill}"
Stretch="Uniform" />
</ContentControl>
</Button>
<Button
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Command="{Binding DeleteCommand}"
Style="{StaticResource ImageBtnStyle}"
ToolTip="{DynamicResource DeleteDownload}">
<ContentControl Width="20" Height="20">
<Path
Width="{Binding Delete.Width}"
Height="{Binding Delete.Height}"
Data="{Binding Delete.Data}"
Fill="{Binding Delete.Fill}"
Stretch="Uniform" />
</ContentControl>
</Button>
</Grid>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="1" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid.Style>
<Style TargetType="{x:Type Grid}">
<Style.Triggers>
<DataTrigger Binding="{Binding DownloadingList}" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding DownloadingList.Count}" Value="0">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding DownloadingList.Count, Converter={StaticResource CountConverter}}" Value="true">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<ListBox
Grid.Row="0"
BorderThickness="0"
ItemContainerStyle="{StaticResource DownloadingStyle}"
ItemsSource="{Binding DownloadingList}">
<ListBox.Style>
<Style TargetType="ListBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border
x:Name="Bd"
Padding="0"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer CanContentScroll="False" Focusable="False">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Style>
</ListBox>
<TextBlock Grid.Row="1" Background="{DynamicResource BrushBorderTranslucent}" />
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="85" />
<ColumnDefinition Width="85" />
<ColumnDefinition Width="85" />
</Grid.ColumnDefinitions>
<StackPanel
Grid.Column="0"
Margin="10,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource TotalDownloading1}" />
<TextBlock
Margin="3,0"
VerticalAlignment="Center"
FontSize="14"
Foreground="{DynamicResource BrushPrimary}"
Text="{Binding DownloadingList.Count}" />
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource TotalDownloading2}" />
</StackPanel>
<Button
Grid.Column="1"
Width="75"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Command="{Binding PauseAllDownloadingCommand}"
Content="{DynamicResource PauseAllDownloading}"
FontSize="12"
Style="{StaticResource BtnBorderStyle}" />
<Button
Grid.Column="2"
Width="75"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Command="{Binding ContinueAllDownloadingCommand}"
Content="{DynamicResource ContinueAllDownloading}"
FontSize="12"
Style="{StaticResource BtnBorderStyle}" />
<Button
Grid.Column="3"
Width="75"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Command="{Binding DeleteAllDownloadingCommand}"
Content="{DynamicResource DeleteAllDownloading}"
FontSize="12"
Style="{StaticResource BtnBorderStyle}" />
</Grid>
</Grid>
<!-- TODO 没有数据时显示图片或文字 -->
<Image
Width="256"
Height="256"
Source="/DownKyi;component/Resources/nodata02.png">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Binding="{Binding DownloadingList}" Value="{x:Null}">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding DownloadingList.Count}" Value="0">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding DownloadingList.Count, Converter={StaticResource CountConverter}}" Value="true">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</Grid>
</UserControl>