<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePictureToPDFDialog"
             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:prism="http://prismlibrary.com/" 
             xmlns:homepagetoolsdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.HomePageToolsDialogs" 
             d:DataContext="{d:DesignInstance Type=homepagetoolsdialogs:HomePagePictureToPDFDialogViewModel}"
             prism:ViewModelLocator.AutoWireViewModel="True"
             xmlns:convert="clr-namespace:PDF_Office.DataConvert"
             d:DesignHeight="554"
             d:DesignWidth="892"
             mc:Ignorable="d">
    <UserControl.Resources>
        <ResourceDictionary>
            <convert:UnVisivleConvert x:Key="unVisibleConvert"/>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="632"/>
            <ColumnDefinition Width="260"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="482"/>
                <RowDefinition Height="72"/>
            </Grid.RowDefinitions>
            <Button Name="BtnBlank" Grid.Row="0" Background="Green" Height="400" Width="400" Visibility="{Binding AddFileVisibility}" Command="{Binding ADDPictureCommand}">
            </Button>
            <ListView x:Name="listView" DataContext="{Binding ImagesDataTable}" Grid.Row="0" Background="White"  ItemsSource="{Binding}" SelectionChanged="listView_SelectionChanged" Visibility="{Binding ElementName=BtnBlank, Path=Visibility, Converter={StaticResource unVisibleConvert}}">
                <ListView.ContextMenu>
                    <ContextMenu  StaysOpen="True" >
                        <MenuItem Header="打开文件" Name="OpenFileMenuItem"  Click="OpenFileMenuItem_Click"/>
                        <MenuItem Header="移除" Name="RemoveFileMenuItem" Click="RemoveFileMenuItem_Click"/>
                    </ContextMenu>
                </ListView.ContextMenu>
                <ListView.View>
                    <GridView>
                        <GridViewColumn  Header="文档名"  Width="400" DisplayMemberBinding="{Binding FileName}"/>
                        <GridViewColumn Header="大小" Width="100" DisplayMemberBinding="{Binding FileSize}"/>
                        <GridViewColumn Header="状态" Width="80" >
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding FileState}" TextDecorations="Underline" Foreground="Black"/>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
                <ListView.ItemContainerStyle>
                    <Style TargetType="ListViewItem">
                        <Setter Property="Height" Value="42"/>
                        <Style.Triggers>
                            <Trigger Property="ListView.AlternationIndex" Value="1">
                                <Setter Property="Background" Value="LightGray"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </ListView.ItemContainerStyle>
            </ListView>
            <Grid Grid.Row="1">
                <Button x:Name="MenuBtn"  Width="113"
                    Height="40"
                    Margin="25,0,0,0"
                    HorizontalAlignment="Left" Click="Menu_Click">
                    <StackPanel Orientation="Horizontal" >
                        <Border HorizontalAlignment="Right">
                            <TextBlock Text="添加文件" FontSize="18" Foreground="Black"></TextBlock>
                        </Border>
                        <Border  Margin="12,0,0,0">
                            <Path  VerticalAlignment="Center" HorizontalAlignment="Right" Stroke="Black"  Data="M0 0L8 4 L16 0" Height="10" Stretch="Fill" />
                        </Border>
                    </StackPanel>
                </Button>
                <Popup x:Name="menuPop1" StaysOpen="False"  AllowsTransparency="True" PlacementTarget="{Binding ElementName=MenuBtn}">
                    <Grid Height="auto" Width="auto" HorizontalAlignment="Left">
                        <Border BorderThickness="0" CornerRadius="3" Background="White" Margin="3">
                            <Border.Effect>
                                <DropShadowEffect ShadowDepth="0" Color="#FFB6B6B6"/>
                            </Border.Effect>
                            <StackPanel Margin="0">
                                <MenuItem x:Name="添加文件" Header="添加文件" Command="{Binding ADDPictureCommand}"></MenuItem>
                                <MenuItem x:Name="添加文件夹" Header="添加文件夹" Command="{Binding ADDPictureFilesCommand}"></MenuItem>
                            </StackPanel>
                        </Border>
                    </Grid>
                </Popup>

                <Button
                    Width="40"
                    Height="40"
                    Margin="0,0,90,0"
                    HorizontalAlignment="Right">

                </Button>
                <Button
                    Width="40"
                    Height="40"
                    Margin="25,0"
                    HorizontalAlignment="Right"
                    IsEnabled="{Binding RemoveIsEnable}"
                    Command="{Binding RemovePictureFileCommand}">

                </Button>
            </Grid>
        </Grid>
        <Grid Grid.Column="1" Background="WhiteSmoke">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="72"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <StackPanel Margin="15,23,0,0">
                    <TextBlock Text="导出"/>
                    <StackPanel Margin="0,8,0,0">
                        <RadioButton Name="NewFilesRadioButtom" Click="RadioButton_Click" IsChecked="True">
                            <TextBlock Text="新建文档"/>
                        </RadioButton>
                        <RadioButton Name="OneNewFileNameRadioButtom" Margin="0,8,0,0" Click="RadioButton_Click">
                            <TextBlock Text="合并为同一份PDF文档"/>
                        </RadioButton>
                        <RadioButton Name="SelectFileNameRadioButton" Margin="0,8,0,0" Click="RadioButton_Click">
                            <TextBlock Text="插入现有PDF文档"/>
                        </RadioButton>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="0,4,0,0">
                        <TextBox IsEnabled="False" Text="{Binding SelectFileName}" VerticalContentAlignment="Center" Height="32" Width="190"/>
                        <Button Width="32" Command="{Binding SelectFileCommand}" IsEnabled="{Binding ElementName=SelectFileNameRadioButton,Path=IsChecked}">

                        </Button>
                    </StackPanel>
                </StackPanel>
            </Grid>
            <Grid Grid.Row="1">
                <StackPanel Margin="15,0,0,0">
                    <TextBlock Text="OCR"/>
                    <CheckBox Name="NeedOCRCheckBox" Margin="0,7,0,0">
                        <TextBlock Text="在需要时识别文本"/>
                    </CheckBox>
                    <ComboBox Height="28.55" Width="228" HorizontalAlignment="Left" Margin="0,4,0,0" IsEnabled="{Binding ElementName=NeedOCRCheckBox,Path=IsChecked}"></ComboBox>
                    <CheckBox  Margin="0,16,0,0" IsEnabled="{Binding ElementName=NeedOCRCheckBox,Path=IsChecked}">
                        <TextBlock Text="识别为TXT"/>
                    </CheckBox>
                </StackPanel>
            </Grid>
            <Grid Grid.Row="2">
                <Button Height="40" Width="228" Background="Black" Command="{Binding ToPDFCommand}">
                    <TextBlock Text="导出文档" FontSize="18" Foreground="White"/>
                </Button>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
