<UserControl  x:Name="视频拼接" x:Class="VideoConcat.Views.VideoWindow"
        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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
        xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
        xmlns:local="clr-namespace:VideoConcat.Views"
        xmlns:conversions="clr-namespace:VideoConcat.Conversions"
        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>
    <Grid>
        <StackPanel >
            <WrapPanel   Height="120">
                <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="740" Name="FoldPath"  Text="{Binding VideoModel.FolderPath,Mode=TwoWay}" IsReadOnly="True" Margin="5,2" BorderBrush="#7F7F7F" BorderThickness="2"  FontSize="16" VerticalContentAlignment="Center" materialDesign:HintAssist.Hint="选择视频主文件夹"/>
                <Button  Grid.Column="2"  Width="100" Content="选    择" FontSize="16"   Command="{Binding VideoModel.BtnOpenFolderCommand}" Background="#40568D" BorderBrush="#7F7F7F" BorderThickness="2" ToolTip="选择含有视频的主文件夹" Style="{StaticResource MaterialDesignRaisedButton}"  Margin="5,2" IsEnabled="{Binding VideoModel.IsCanOperate}"/>
                <Label Grid.Row="1" Width="100" VerticalAlignment="Center" FontSize="16" Margin="5,2" BorderBrush="#7F7F7F" BorderThickness="2" Style="{StaticResource MaterialDesignLabel}" VerticalContentAlignment="Stretch">选择广审：</Label>
                <TextBox Grid.Row="1" Width="740" Grid.Column="1"   Text="{Binding VideoModel.AuditImagePath,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" IsReadOnly="True" Margin="5,2" BorderBrush="#7F7F7F" BorderThickness="2"  FontSize="16" VerticalContentAlignment="Center" ToolTip="请选择" materialDesign:HintAssist.Hint="请选择"/>
                <Button  Grid.Row="1" Width="100" Grid.Column="2"  Content="选择文件" FontSize="16"   Command="{Binding VideoModel.BtnChooseAuditImageCommand}" Background="#E54858" BorderBrush="#7F7F7F" BorderThickness="2" ToolTip="选择广审" Style="{StaticResource MaterialDesignRaisedButton}"  Margin="5,2" IsEnabled="{Binding VideoModel.IsCanOperate}"/>
                <Label Grid.Row="1" Width="100" VerticalAlignment="Center" FontSize="16" Margin="5,2" BorderBrush="#7F7F7F" BorderThickness="2" Style="{StaticResource MaterialDesignLabel}" VerticalContentAlignment="Stretch">视频个数：</Label>
                <TextBox Grid.Row="1" Width="740" Grid.Column="1"  Text="{Binding VideoModel.Num,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"  Margin="5,2" BorderBrush="#7F7F7F" BorderThickness="2"  FontSize="16" VerticalContentAlignment="Center" ToolTip="请输入合成视频个数" materialDesign:HintAssist.Hint="请输入拼接视频数目" IsEnabled="{Binding VideoModel.IsCanOperate}" />
                <Button  Grid.Row="1" Width="100" Grid.Column="2"  Content="开始拼接" FontSize="16"   Command="{Binding VideoModel.BtnStartVideoConcatCommand}" Background="#E54858" BorderBrush="#7F7F7F" BorderThickness="2" ToolTip="开始拼接视频" Style="{StaticResource MaterialDesignRaisedButton}"  Margin="5,2" IsEnabled="{Binding VideoModel.CanStart}" Cursor="Hand"/>
            </WrapPanel>
            <StackPanel Orientation="Horizontal" Height="40">
                <Label FontWeight="ExtraBold" FontSize="16" Grid.Row="1">拼接方式：</Label>
                <RadioButton Name="JoinType1"  Content="随机" GroupName="JoinType" IsChecked="{Binding VideoModel.IsJoinType1Selected, Mode=TwoWay}"  Margin="10,2" />
                <RadioButton Name="JoinType2" Content="按顺序组合"  GroupName="JoinType" IsChecked="{Binding VideoModel.IsJoinType2Selected, Mode=TwoWay}"  Margin="10,2" />
            </StackPanel>
            <StackPanel Height="30">
                <Label FontWeight="ExtraBold" FontSize="16" Grid.Row="1">文件信息：</Label>
            </StackPanel>
            <StackPanel Height="200">
                <Grid>
                    <DataGrid Grid.Row="1" ItemsSource="{Binding VideoModel.FolderInfos}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" VerticalScrollBarVisibility="Auto" MaxHeight="200">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="文件夹" Binding="{Binding DirectoryInfo.Name,Mode=OneWay}" Width="*"></DataGridTextColumn>
                            <DataGridTextColumn Header="视频数量" Binding="{Binding Num,Mode=OneWay}"  Width="*"></DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </StackPanel>

            <StackPanel Height="30">
                <Label FontWeight="ExtraBold" FontSize="16">视频合成进度：</Label>
            </StackPanel>

            <StackPanel Height="400">
                <DataGrid ItemsSource="{Binding VideoModel.ConcatVideos}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" IsReadOnly="True" VerticalScrollBarVisibility="Auto" MaxHeight="400" ScrollViewer.CanContentScroll="True">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="序号" Binding="{Binding Index}" Width="60"></DataGridTextColumn>
                        <DataGridTextColumn Header="文件名" Binding="{Binding FileName}" Width="*"></DataGridTextColumn>
                        <DataGridTextColumn Header="大小（MB）" Binding="{Binding Size}"  Width="100"></DataGridTextColumn>
                        <DataGridTextColumn Header="时长（秒）" Binding="{Binding Seconds}"  Width="100"></DataGridTextColumn>
                        <DataGridTextColumn Header="状态" Binding="{Binding Status}"  Width="100"></DataGridTextColumn>
                        <DataGridTemplateColumn Header="进度" Width="200">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Vertical" Margin="5,2">
                                        <ProgressBar Value="{Binding ProgressValue}" 
                                                     Maximum="100" 
                                                     Height="20" 
                                                     Margin="0,2"/>
                                        <TextBlock Text="{Binding Progress}" 
                                                   HorizontalAlignment="Center" 
                                                   FontSize="11" 
                                                   Margin="0,2"/>
                                    </StackPanel>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </StackPanel>
        </StackPanel>
    </Grid>
</UserControl>
