<UserControl x:Class="VideoConcat.Views.ExtractWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:VideoConcat.Views"
        xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
        xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
        mc:Ignorable="d"
        Height="800" Width="1000">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Red.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />

            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Border CornerRadius="5" BorderBrush="White" BorderThickness="2,2,2,2">
        <Grid>

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
            <Border>
                <WrapPanel Orientation="Horizontal" VerticalAlignment="Center">
                    <Label VerticalAlignment="Center" Width="100" FontSize="16" Margin="5,2" BorderBrush="#7F7F7F" BorderThickness="2" Style="{StaticResource MaterialDesignLabel}" VerticalContentAlignment="Stretch">视频文件夹：</Label>
                    <TextBox Grid.Column="1" Width="500" Name="FoldPath"  Text="{Binding ExtractWindowModel.FolderPath,Mode=TwoWay}" IsReadOnly="True" Margin="5,2" BorderBrush="#7F7F7F" BorderThickness="2"  FontSize="16" VerticalContentAlignment="Center" materialDesign:HintAssist.Hint="选择包含需要处理的视频文件夹"/>
                    <Button  Grid.Column="2"  Width="80" Content="选择" FontSize="16"   Command="{Binding ExtractWindowModel.BtnOpenFolderCommand}" Background="#40568D" BorderBrush="#7F7F7F" BorderThickness="2" ToolTip="选择含有视频的主文件夹" Style="{StaticResource MaterialDesignRaisedButton}"  Margin="5,2" IsEnabled="{Binding ExtractWindowModel.IsCanOperate}"/>
                    <Label VerticalAlignment="Center" Width="80" FontSize="16" Margin="5,2" BorderBrush="#7F7F7F" BorderThickness="2" Style="{StaticResource MaterialDesignLabel}" VerticalContentAlignment="Stretch">生成个数：</Label>
                    <TextBox Width="100" Text="{Binding ExtractWindowModel.ExtractCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="5,2" BorderBrush="#7F7F7F" BorderThickness="2" FontSize="16" VerticalContentAlignment="Center" ToolTip="输入要生成的抽帧视频个数" materialDesign:HintAssist.Hint="个数" IsEnabled="{Binding ExtractWindowModel.IsCanOperate}"/>
                    <Label VerticalAlignment="Center" Width="80" FontSize="16" Margin="5,2" BorderBrush="#7F7F7F" BorderThickness="2" Style="{StaticResource MaterialDesignLabel}" VerticalContentAlignment="Stretch">处理方式：</Label>
                    <RadioButton Content="方案1" IsChecked="{Binding ExtractWindowModel.IsDeleteFrameMode,Mode=TwoWay}" Margin="5,2" FontSize="14" VerticalAlignment="Center" IsEnabled="{Binding ExtractWindowModel.IsCanOperate}" GroupName="ExtractMode" ToolTip="随机删除一个非关键帧"/>
                    <RadioButton Content="方案2" IsChecked="{Binding ExtractWindowModel.IsAddTransparentImageMode,Mode=TwoWay}" Margin="5,2" FontSize="14" VerticalAlignment="Center" IsEnabled="{Binding ExtractWindowModel.IsCanOperate}" GroupName="ExtractMode" ToolTip="在随机位置添加一个肉眼无法感知的小像素透明图"/>
                    <Button  Grid.Column="3"  Width="120" Content="{Binding ExtractWindowModel.ExtractButtonText}" FontSize="16"   Command="{Binding ExtractWindowModel.BtnStartVideoConcatCommand}" Background="#3B94FE" BorderBrush="#7F7F7F" BorderThickness="2" ToolTip="开始处理视频" Style="{StaticResource MaterialDesignRaisedButton}"  Margin="5,2,0,2" IsEnabled="{Binding ExtractWindowModel.CanExtractFrame}"/>
                    <Button  Grid.Column="4"  Width="120" Content="修改meta" FontSize="16"   Command="{Binding ExtractWindowModel.BtnStartVideoModifyCommand}" Background="#3B94FE" BorderBrush="#7F7F7F" BorderThickness="2" ToolTip="开始修改视频元数据" Style="{StaticResource MaterialDesignRaisedButton}"  Margin="5,2,0,2" IsEnabled="{Binding ExtractWindowModel.CanModify}"/>
                </WrapPanel>
            </Border>

            <Border Grid.Row="1">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Text="{Binding ExtractWindowModel.HelpInfo,Mode=TwoWay}" Margin="5" TextWrapping="Wrap"/>
                    <DataGrid Grid.Row="1" 
                              ItemsSource="{Binding ExtractWindowModel.TaskItems}" 
                              AutoGenerateColumns="False"
                              IsReadOnly="True"
                              HeadersVisibility="Column"
                              GridLinesVisibility="All"
                              AlternatingRowBackground="LightGray"
                              Margin="5"
                              HorizontalScrollBarVisibility="Auto"
                              VerticalScrollBarVisibility="Auto"
                              ColumnWidth="*">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="序号" Binding="{Binding Index}" Width="50"/>
                            <DataGridTextColumn Header="文件名" Binding="{Binding FileName}" Width="4*" MinWidth="350">
                                <DataGridTextColumn.ElementStyle>
                                    <Style TargetType="TextBlock">
                                        <Setter Property="TextWrapping" Value="Wrap"/>
                                        <Setter Property="TextTrimming" Value="None"/>
                                        <Setter Property="ToolTip" Value="{Binding FullFileName}"/>
                                        <Setter Property="HorizontalAlignment" Value="Left"/>
                                        <Setter Property="VerticalAlignment" Value="Center"/>
                                        <Setter Property="Margin" Value="2,0"/>
                                    </Style>
                                </DataGridTextColumn.ElementStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn Header="状态" Binding="{Binding Status}" Width="70"/>
                            <DataGridTextColumn Header="原始大小" Binding="{Binding OriginalSize}" Width="90"/>
                            <DataGridTextColumn Header="输出大小" Binding="{Binding OutputSize}" Width="90"/>
                            <DataGridTextColumn Header="大小变化" Binding="{Binding SizeChange}" Width="90"/>
                            <DataGridTextColumn Header="耗时" Binding="{Binding Duration}" Width="70"/>
                            <DataGridTextColumn Header="进度" Binding="{Binding Progress}" Width="70"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </Border>
        </Grid>
    </Border>
</UserControl>
