<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageSetPasswordDialog"
             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/"
             prism:ViewModelLocator.AutoWireViewModel="True"
             xmlns:convert="clr-namespace:PDF_Office.DataConvert"
             d:DesignHeight="462"
             d:DesignWidth="892"
             mc:Ignorable="d">
    <UserControl.Resources>
        <ResourceDictionary>
            <convert:UnVisivleConvert x:Key="unVisibleConvert"/>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid IsEnabled="{Binding SafetyGridIsEnabled}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="632"/>
            <ColumnDefinition Width="260"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="398"/>
                <RowDefinition Height="72"/>
            </Grid.RowDefinitions>
            <Button Name="BtnBlank" Grid.Row="0" Background="Green" Height="300" Width="300" Visibility="{Binding AddFileVisibility}" Command="{Binding ADDPDFCommand}">
            </Button>
            <ListView x:Name="listView" DataContext="{Binding PDFDataTable,Mode=TwoWay}" 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 ADDPDFCommand}"></MenuItem>
                                <MenuItem x:Name="添加文件夹" Header="添加文件夹" Command="{Binding ADDPDFFilesCommand}"></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 RemovePDFFileCommand}">

                </Button>
            </Grid>
        </Grid>
        <Grid Grid.Column="1" Background="WhiteSmoke" IsEnabled="{Binding SetSafetyGridIsEnabled}">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="72"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <StackPanel Margin="15,23,0,0">
                    <TextBlock Text="设置密码" Width="48" Height="20" HorizontalAlignment="Left"/>
                    <StackPanel Margin="0,11,0,0">
                        <CheckBox x:Name="CanOpenCheckBox" IsChecked="{Binding CanOpen}" Margin="0,0,0,10" Command="{Binding DelegateSetOpenCommand}">
                            <TextBlock Text="开启文档口令"></TextBlock>
                        </CheckBox>
                        <Grid HorizontalAlignment="Left" Width="228">
                            <PasswordBox x:Name="CanOpenPasswordBox" Width="228" Height="24" Visibility="Visible" VerticalAlignment="Center"
                                     GotFocus="PasswordBox_GotFocus" PasswordChanged="PasswordBox_PasswordChanged" IsEnabled="{Binding ElementName=CanOpenCheckBox, Path=IsChecked}">
                            </PasswordBox>
                            <TextBox x:Name="CanOpenTextBox" Width="228"  Height="24" Visibility="Hidden" VerticalAlignment="Center"
                                 GotFocus="TextBox_GotFocus" TextChanged="TextBox_TextChanged" >
                            </TextBox>
                            <Label x:Name="ShowOpenPasswordBoxEyeLabel" HorizontalAlignment="Right" Margin="0,3,0,3" 
                               MouseLeftButtonUp="ShowPasswordBoxEyeLabel_MouseLeftButtonUp">
                                <Border Height="23" Width="27" Background="MediumVioletRed" ></Border>
                            </Label>
                            <Label x:Name="ShowOpenTextBoxEyeLabel" HorizontalAlignment="Right" Visibility="Hidden" Margin="0,3,0,3" 
                               MouseLeftButtonUp="ShowTextBoxEyeLabel_MouseLeftButtonUp">
                                <Border Height="23" Width="27" Background="LightSeaGreen" ></Border>
                            </Label>
                        </Grid>
                    </StackPanel>
                    <StackPanel Margin="0,17,0,0">
                        <CheckBox IsChecked="{Binding CanEdit}" Name="CanEditCheckBox" Margin="0,0,0,10"  Command="{Binding  DelegateSetEditCommand}">
                            <TextBlock Text="许可口令"></TextBlock>
                        </CheckBox>
                        <Grid HorizontalAlignment="Left" Width="228">
                            <PasswordBox x:Name="CanEditPasswordBox" Width="228" Height="24" Visibility="Visible" VerticalAlignment="Center" 
                                     GotFocus="PasswordBox_GotFocus" PasswordChanged="PasswordBox_PasswordChanged" IsEnabled="{Binding ElementName=CanEditCheckBox, Path=IsChecked}">
                            </PasswordBox>
                            <TextBox x:Name="CanEditTextBox" Width="228"  Height="24" Visibility="Hidden" VerticalAlignment="Center"
                                 GotFocus="TextBox_GotFocus" TextChanged="TextBox_TextChanged">
                            </TextBox>
                            <Label x:Name="ShowEditPasswordBoxEyeLabel" HorizontalAlignment="Right" Margin="0,3,0,3" 
                               MouseLeftButtonUp="ShowPasswordBoxEyeLabel_MouseLeftButtonUp">
                                <Border Height="23" Width="27" Background="MediumVioletRed" 
                                      ></Border>
                            </Label>
                            <Label x:Name="ShowEditTextBoxEyeLabel" HorizontalAlignment="Right" Visibility="Hidden" Margin="0,3,0,3"  
                                MouseLeftButtonUp="ShowTextBoxEyeLabel_MouseLeftButtonUp">
                                <Border Height="23" Width="27" Background="LightSeaGreen" ></Border>
                            </Label>
                        </Grid>
                    </StackPanel>
                </StackPanel>
            </Grid>
            <Grid Grid.Row="1">
                <StackPanel Margin="15,0,0,0">
                    <TextBlock Text="允许打印" Width="48" Height="20" HorizontalAlignment="Left"/>
                    <ComboBox Height="24" Width="228" HorizontalAlignment="Left" Margin="0,8.5,0,0"  SelectedIndex="{Binding PrintMod,Mode=TwoWay}" IsEnabled="{Binding ElementName=CanEditCheckBox, Path=IsChecked}"></ComboBox>
                    <TextBlock Text="允许更改" Margin="0,20.5,0,0" Width="48" Height="20" HorizontalAlignment="Left"/>
                    <ComboBox Height="24" Width="228" HorizontalAlignment="Left" Margin="0,8.5,0,0" SelectedIndex="{Binding ChangeMod,Mode=TwoWay}" IsEnabled="{Binding ElementName=CanEditCheckBox, Path=IsChecked}"></ComboBox>
                    <TextBlock Text="加密级别" Width="48" Height="20" HorizontalAlignment="Left" Margin="0,20.5,0,0"/>
                    <ComboBox Height="24" Width="228" HorizontalAlignment="Left" Margin="0,8.5,0,0" >
                        <ComboBoxItem Tag="0">128-bit-RC4</ComboBoxItem>
                        <ComboBoxItem Tag="1">128-bit-AES</ComboBoxItem>
                        <ComboBoxItem Tag="2">256 -bit-AES</ComboBoxItem>
                    </ComboBox>
                </StackPanel>
            </Grid>
            <Grid Grid.Row="2">
                <Button Height="40" Width="228" Background="Black" Command="{Binding DelegateConfirmEncryptCommand}" IsEnabled="{Binding IsEnabledConfirm, Mode=TwoWay}">
                    <TextBlock Text="设置安全密码" FontSize="18" Foreground="White"/>
                </Button>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
