<UserControl
    x:Class="PDF_Office.Views.Dialog.PageEditDialogs.SplitDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pageeditdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.PageEditDialogs"
    xmlns:prism="http://prismlibrary.com/"
    Width="480"
    Height="481"
    d:DataContext="{d:DesignInstance Type=pageeditdialogs:SplitDialogViewModel}"
    d:DesignHeight="450"
    d:DesignWidth="800"
    prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
    prism:ViewModelLocator.AutoWireViewModel="True"
    mc:Ignorable="d">
    <cus:DialogContent Header="拆分页面">
        <cus:DialogContent.Content>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <StackPanel Margin="16,4,16,0">
                    <TextBlock
                        Margin="0,12"
                        FontSize="14"
                        FontWeight="SemiBold"
                        Text="拆分方式" />
                    <StackPanel Orientation="Horizontal">
                        <RadioButton
                            Name="RbtnPage"
                            VerticalAlignment="Center"
                            Content="平均每"
                            GroupName="SplitMode"
                            IsChecked="{Binding Model.IsAveragePages, Mode=TwoWay}" />
                        <cus:NumericUpDown
                            Height="32"
                            Margin="8,0"
                            IsEnabled="{Binding ElementName=RbtnPage, Path=IsChecked}"
                            Maximum="{Binding PageCount}"
                            Minimum="1"
                            Value="{Binding Model.PageNum, Mode=TwoWay}" />
                        <TextBlock VerticalAlignment="Center" Text="页拆分为一个PDF文件" />
                    </StackPanel>
                    <StackPanel Margin="0,12" Orientation="Horizontal">
                        <RadioButton
                            Name="RbtnPdf"
                            VerticalAlignment="Center"
                            Content="平均拆分为"
                            GroupName="SplitMode"
                            IsChecked="{Binding Model.IsAveragePDF, Mode=TwoWay}" />
                        <cus:NumericUpDown
                            Height="32"
                            Margin="8,0"
                            IsEnabled="{Binding ElementName=RbtnPdf, Path=IsChecked}"
                            Maximum="{Binding PageCount}"
                            Minimum="1"
                            Value="{Binding Model.FilesCount, Mode=TwoWay}" />
                        <TextBlock VerticalAlignment="Center" Text="个PDF文件" />
                    </StackPanel>
                    <StackPanel Margin="0,0,0,12" Orientation="Horizontal">
                        <RadioButton
                            x:Name="RbtnPagerange"
                            VerticalAlignment="Center"
                            Content="按页面范围拆分"
                            GroupName="SplitMode"
                            IsChecked="{Binding Model.IsCustomRange, Mode=TwoWay}" />
                        <cus:WritableComboBox
                            Width="110"
                            Height="32"
                            Margin="8,0"
                            IsAllPageVisible="Collapsed"
                            IsEnabled="{Binding ElementName=RbtnPagerange, Path=IsChecked}"
                            SelectedIndex="{Binding Model.PageSelectedIndex, Mode=TwoWay}"
                            Text="{Binding CustomPageText, Mode=TwoWay}" />
                    </StackPanel>
                </StackPanel>
                <StackPanel Grid.Row="1" Margin="16,0">
                    <TextBlock
                        FontSize="14"
                        FontWeight="SemiBold"
                        LineHeight="22"
                        Text="文档命名" />
                    <TextBox
                        Width="346"
                        Height="32"
                        HorizontalAlignment="Left"
                        VerticalContentAlignment="Center"
                        BorderThickness="1"
                        Focusable="False"
                        FontSize="14"
                        IsReadOnly="True"
                        Text="{Binding Model.FileName}" />
                    <CheckBox
                        Margin="0,6"
                        VerticalContentAlignment="Center"
                        Content="将原始文档名前置"
                        FontSize="14"
                        IsChecked="{Binding Model.IsSourceNameFront}" />


                    <StackPanel Margin="0,8" Orientation="Horizontal">
                        <CheckBox
                            Name="ChkSign"
                            Width="{Binding ElementName=ChkSeparator, Path=ActualWidth}"
                            Margin="0,6"
                            VerticalContentAlignment="Center"
                            Content="标签"
                            FontSize="14"
                            IsChecked="{Binding Model.HasLabel}" />
                        <TextBox
                            Width="110"
                            Height="32"
                            Margin="16,0"
                            VerticalContentAlignment="Center"
                            IsEnabled="{Binding ElementName=ChkSign, Path=IsChecked}"
                            Text="{Binding Model.FileNameLabel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox
                            Name="ChkSeparator"
                            Margin="0,6"
                            VerticalContentAlignment="Center"
                            Content="分隔符"
                            FontSize="14"
                            IsChecked="{Binding Model.HasDeimiter}" />
                        <TextBox
                            Width="110"
                            Height="32"
                            Margin="16,0"
                            VerticalContentAlignment="Center"
                            IsEnabled="{Binding ElementName=ChkSeparator, Path=IsChecked}"
                            Text="{Binding Model.FileNameDeimiter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                    </StackPanel>
                </StackPanel>
            </Grid>
        </cus:DialogContent.Content>
        <cus:DialogContent.BottmBar>
            <Grid>
                <Button
                    Width="98"
                    Height="32"
                    Margin="16,0"
                    HorizontalAlignment="Right"
                    Command="{Binding CancelCommand}"
                    Content="取消" />
                <Button
                    Width="98"
                    Height="32"
                    Margin="124,0"
                    HorizontalAlignment="Right"
                    Command="{Binding SplitCommnad}"
                    Content="拆分" />
            </Grid>
        </cus:DialogContent.BottmBar>
    </cus:DialogContent>
</UserControl>
