|
@@ -3,24 +3,227 @@
|
|
|
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:help="clr-namespace:PDF_Office.Helper"
|
|
|
xmlns:prism="http://prismlibrary.com/"
|
|
|
-
|
|
|
- xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:cus="clr-namespace:PDF_Office.CustomControl"
|
|
|
+ xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:cus="clr-namespace:PDF_Office.CustomControl" xmlns:saftydialogs="clr-namespace:PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs" d:DataContext="{d:DesignInstance Type=saftydialogs:SetPasswordDialogViewModel}"
|
|
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
|
|
d:DesignHeight="314"
|
|
|
d:DesignWidth="432"
|
|
|
+ prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
|
|
|
mc:Ignorable="d">
|
|
|
<UserControl.Resources>
|
|
|
- <Style TargetType="PasswordBox" x:Key="PasswordBoxStyle">
|
|
|
+ <Style TargetType="CheckBox" x:Key="EyeCheckbox">
|
|
|
+ <Setter Property="Cursor" Value="Hand"></Setter>
|
|
|
+ <Setter Property="Template">
|
|
|
+ <Setter.Value>
|
|
|
+ <ControlTemplate TargetType="{x:Type CheckBox}">
|
|
|
+ <Grid>
|
|
|
+
|
|
|
+ <Border Background="Transparent"
|
|
|
+ BorderBrush="White"
|
|
|
+ BorderThickness="1"
|
|
|
+ CornerRadius="0"
|
|
|
+ VerticalAlignment="Center" >
|
|
|
+ <Grid Height="{TemplateBinding Height}"
|
|
|
+ Width="{Binding ActualHeight,RelativeSource={RelativeSource Self}}">
|
|
|
+ <Ellipse x:Name="ellipse"
|
|
|
+ Fill="Blue" Margin="2" />
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+ </Grid>
|
|
|
+ <ControlTemplate.Triggers>
|
|
|
+ <Trigger Property="IsChecked" Value="True">
|
|
|
+ <Setter TargetName="ellipse" Property="Fill" Value="Red">
|
|
|
+ </Setter>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsChecked" Value="False">
|
|
|
+ <Setter TargetName="ellipse" Property="Fill" Value="Blue">
|
|
|
+ </Setter>
|
|
|
+ </Trigger>
|
|
|
+ </ControlTemplate.Triggers>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Setter.Value>
|
|
|
+ </Setter>
|
|
|
+ </Style>
|
|
|
+ <Style TargetType="PasswordBox" x:Key="OpenPasswordBoxStyle">
|
|
|
+ <Setter Property="Height" Value="32"/>
|
|
|
+ <Setter Property="FontSize" Value="14"/>
|
|
|
+ <Setter Property="Template">
|
|
|
+ <Setter.Value>
|
|
|
+ <ControlTemplate TargetType="PasswordBox">
|
|
|
+ <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
+ BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
+ Background="{TemplateBinding Background}"
|
|
|
+ SnapsToDevicePixels="True"
|
|
|
+ CornerRadius="5">
|
|
|
+ <Grid>
|
|
|
+ <Grid.ColumnDefinitions>
|
|
|
+ <ColumnDefinition></ColumnDefinition>
|
|
|
+ <ColumnDefinition Width="24"></ColumnDefinition>
|
|
|
+ </Grid.ColumnDefinitions>
|
|
|
+ <Grid Grid.Column="0">
|
|
|
+ <TextBlock Text="{TemplateBinding help:PasswordBoxHelper.DisplayText}" Grid.Column="1" VerticalAlignment="Center" Foreground="#BBB"
|
|
|
+ Name="markText" Visibility="Collapsed" FontSize="12" />
|
|
|
+ <ScrollViewer x:Name="PART_ContentHost" Focusable="false"
|
|
|
+ HorizontalScrollBarVisibility="Hidden"
|
|
|
+ VerticalScrollBarVisibility="Hidden"
|
|
|
+ VerticalAlignment="Center" MinHeight="20"/>
|
|
|
+ </Grid>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <ControlTemplate.Triggers>
|
|
|
+ <Trigger Property="IsEnabled" Value="false">
|
|
|
+ <Setter Property="Opacity" TargetName="border" Value="0.56"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsMouseOver" Value="true">
|
|
|
+ <Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsKeyboardFocused" Value="true">
|
|
|
+ <Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/>
|
|
|
+ </Trigger>
|
|
|
+ <DataTrigger Binding="{Binding Path = OpenPassword}" Value="">
|
|
|
+ <Setter Property="Visibility" TargetName="markText" Value="Visible"/>
|
|
|
+ </DataTrigger>
|
|
|
+ </ControlTemplate.Triggers>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Setter.Value>
|
|
|
+ </Setter>
|
|
|
+ </Style>
|
|
|
+
|
|
|
+ <Style TargetType="TextBox" x:Key="OpenPasswordTextBoxStyle">
|
|
|
+ <Setter Property="Height" Value="32"/>
|
|
|
+ <Setter Property="FontSize" Value="14"/>
|
|
|
+ <Setter Property="Template">
|
|
|
+ <Setter.Value>
|
|
|
+ <ControlTemplate TargetType="TextBox">
|
|
|
+ <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
+ BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
+ Background="{TemplateBinding Background}"
|
|
|
+ SnapsToDevicePixels="True"
|
|
|
+ CornerRadius="5">
|
|
|
+ <Grid>
|
|
|
+ <Grid.ColumnDefinitions>
|
|
|
+ <ColumnDefinition></ColumnDefinition>
|
|
|
+ <ColumnDefinition Width="24"></ColumnDefinition>
|
|
|
+ </Grid.ColumnDefinitions>
|
|
|
+ <Grid Grid.Column="0">
|
|
|
+ <TextBlock Text="{TemplateBinding help:PasswordBoxHelper.DisplayText}" Grid.Column="1" VerticalAlignment="Center" Foreground="#BBB"
|
|
|
+ Name="markText" Visibility="Collapsed" FontSize="12" />
|
|
|
+ <ScrollViewer x:Name="PART_ContentHost" Focusable="false"
|
|
|
+ HorizontalScrollBarVisibility="Hidden"
|
|
|
+ VerticalScrollBarVisibility="Hidden"
|
|
|
+ VerticalAlignment="Center" MinHeight="20"/>
|
|
|
+ </Grid>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <ControlTemplate.Triggers>
|
|
|
+ <Trigger Property="IsEnabled" Value="false">
|
|
|
+ <Setter Property="Opacity" TargetName="border" Value="0.56"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsMouseOver" Value="true">
|
|
|
+ <Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsKeyboardFocused" Value="true">
|
|
|
+ <Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/>
|
|
|
+ </Trigger>
|
|
|
+ <DataTrigger Binding="{Binding Path = OpenPassword}" Value="">
|
|
|
+ <Setter Property="Visibility" TargetName="markText" Value="Visible"/>
|
|
|
+ </DataTrigger>
|
|
|
+ </ControlTemplate.Triggers>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Setter.Value>
|
|
|
+ </Setter>
|
|
|
+ </Style>
|
|
|
+
|
|
|
+ <Style TargetType="PasswordBox" x:Key="PermissionsPasswordBoxStyle">
|
|
|
+ <Setter Property="Height" Value="32"/>
|
|
|
+ <Setter Property="FontSize" Value="14"/>
|
|
|
<Setter Property="Template">
|
|
|
<Setter.Value>
|
|
|
<ControlTemplate TargetType="PasswordBox">
|
|
|
- <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
- BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
- Background="{TemplateBinding Background}"
|
|
|
- SnapsToDevicePixels="True" CornerRadius="4">
|
|
|
- <TextBlock Text="Open Password"></TextBlock>
|
|
|
+ <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
+ BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
+ Background="{TemplateBinding Background}"
|
|
|
+ SnapsToDevicePixels="True"
|
|
|
+ CornerRadius="5">
|
|
|
+ <Grid>
|
|
|
+ <Grid.ColumnDefinitions>
|
|
|
+ <ColumnDefinition></ColumnDefinition>
|
|
|
+ <ColumnDefinition Width="24"></ColumnDefinition>
|
|
|
+ </Grid.ColumnDefinitions>
|
|
|
+ <Grid Grid.Column="0">
|
|
|
+ <TextBlock Text="{TemplateBinding help:PasswordBoxHelper.DisplayText}" Grid.Column="1" VerticalAlignment="Center" Foreground="#BBB"
|
|
|
+ Name="markText" Visibility="Collapsed" FontSize="12" />
|
|
|
+ <ScrollViewer x:Name="PART_ContentHost" Focusable="false"
|
|
|
+ HorizontalScrollBarVisibility="Hidden"
|
|
|
+ VerticalScrollBarVisibility="Hidden"
|
|
|
+ VerticalAlignment="Center" MinHeight="20"/>
|
|
|
+ </Grid>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <ControlTemplate.Triggers>
|
|
|
+ <Trigger Property="IsEnabled" Value="false">
|
|
|
+ <Setter Property="Opacity" TargetName="border" Value="0.56"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsMouseOver" Value="true">
|
|
|
+ <Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsKeyboardFocused" Value="true">
|
|
|
+ <Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/>
|
|
|
+ </Trigger>
|
|
|
+ <DataTrigger Binding="{Binding Path = PermissionsPassword}" Value="">
|
|
|
+ <Setter Property="Visibility" TargetName="markText" Value="Visible"/>
|
|
|
+ </DataTrigger>
|
|
|
+ </ControlTemplate.Triggers>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Setter.Value>
|
|
|
+ </Setter>
|
|
|
+ </Style>
|
|
|
+
|
|
|
+ <Style TargetType="TextBox" x:Key="PermissionsPasswordTextBoxStyle">
|
|
|
+ <Setter Property="Height" Value="32"/>
|
|
|
+ <Setter Property="FontSize" Value="14"/>
|
|
|
+ <Setter Property="Template">
|
|
|
+ <Setter.Value>
|
|
|
+ <ControlTemplate TargetType="TextBox">
|
|
|
+ <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
+ BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
+ Background="{TemplateBinding Background}"
|
|
|
+ SnapsToDevicePixels="True"
|
|
|
+ CornerRadius="5">
|
|
|
+ <Grid>
|
|
|
+ <Grid.ColumnDefinitions>
|
|
|
+ <ColumnDefinition></ColumnDefinition>
|
|
|
+ <ColumnDefinition Width="24"></ColumnDefinition>
|
|
|
+ </Grid.ColumnDefinitions>
|
|
|
+ <Grid Grid.Column="0">
|
|
|
+ <TextBlock Text="{TemplateBinding help:PasswordBoxHelper.DisplayText}" Grid.Column="1" VerticalAlignment="Center" Foreground="#BBB"
|
|
|
+ Name="markText" Visibility="Collapsed" FontSize="12" />
|
|
|
+ <ScrollViewer x:Name="PART_ContentHost" Focusable="false"
|
|
|
+ HorizontalScrollBarVisibility="Hidden"
|
|
|
+ VerticalScrollBarVisibility="Hidden"
|
|
|
+ VerticalAlignment="Center" MinHeight="20"/>
|
|
|
+ </Grid>
|
|
|
+ </Grid>
|
|
|
</Border>
|
|
|
+
|
|
|
+ <ControlTemplate.Triggers>
|
|
|
+ <Trigger Property="IsEnabled" Value="false">
|
|
|
+ <Setter Property="Opacity" TargetName="border" Value="0.56"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsMouseOver" Value="true">
|
|
|
+ <Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsKeyboardFocused" Value="true">
|
|
|
+ <Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/>
|
|
|
+ </Trigger>
|
|
|
+ <DataTrigger Binding="{Binding Path = PermissionsPassword}" Value="">
|
|
|
+ <Setter Property="Visibility" TargetName="markText" Value="Visible"/>
|
|
|
+ </DataTrigger>
|
|
|
+ </ControlTemplate.Triggers>
|
|
|
</ControlTemplate>
|
|
|
</Setter.Value>
|
|
|
</Setter>
|
|
@@ -28,24 +231,67 @@
|
|
|
</UserControl.Resources>
|
|
|
<cus:DialogContent Header="Set Pasword">
|
|
|
<cus:DialogContent.Content>
|
|
|
- <Grid Margin="16,0,16,0">
|
|
|
+ <Grid Margin="16,0,16,0" Width="400">
|
|
|
<Grid.RowDefinitions>
|
|
|
- <RowDefinition></RowDefinition>
|
|
|
- <RowDefinition></RowDefinition>
|
|
|
- <RowDefinition></RowDefinition>
|
|
|
- <RowDefinition></RowDefinition>
|
|
|
+ <RowDefinition Height="62"></RowDefinition>
|
|
|
+ <RowDefinition Height="78"></RowDefinition>
|
|
|
+ <RowDefinition Height="60"></RowDefinition>
|
|
|
</Grid.RowDefinitions>
|
|
|
<StackPanel Orientation="Vertical">
|
|
|
- <CheckBox>
|
|
|
- <TextBlock Text="Document Open Password"></TextBlock>
|
|
|
+ <CheckBox Name="OpenPasswordChk" IsChecked="{Binding NeedOpenPassword, Mode=TwoWay}" Command="{Binding SetOpenPasswordCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}">
|
|
|
+ <TextBlock Text="Document Open Password" FontFamily="Segoe UI" FontSize="14"></TextBlock>
|
|
|
+ </CheckBox>
|
|
|
+ <Grid Margin="0,8,0,16" IsEnabled="{Binding ElementName=OpenPasswordChk, Path=IsChecked}" >
|
|
|
+ <Grid.ColumnDefinitions>
|
|
|
+ <ColumnDefinition></ColumnDefinition>
|
|
|
+ <ColumnDefinition Width="24"></ColumnDefinition>
|
|
|
+ </Grid.ColumnDefinitions>
|
|
|
+ <PasswordBox Style="{StaticResource OpenPasswordBoxStyle}" help:PasswordBoxHelper.Password="{Binding OpenPassword, Mode=TwoWay , UpdateSourceTrigger=PropertyChanged}" help:PasswordBoxHelper.DisplayText="{Binding OpenPasswordMsg, Mode=TwoWay}" Grid.ColumnSpan="2">
|
|
|
+ </PasswordBox>
|
|
|
+ <TextBox Style="{StaticResource OpenPasswordTextBoxStyle}" Text="{Binding OpenPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.ColumnSpan="2" Visibility="{Binding OpenTextVisibility, Mode=TwoWay}" help:PasswordBoxHelper.DisplayText="{Binding OpenPasswordMsg, Mode=TwoWay}" ></TextBox>
|
|
|
+ <CheckBox IsChecked="{Binding IsOpenPasswordDisplayed,Mode=TwoWay}" x:Name="DisplayOpenPasswordChk" Style="{StaticResource EyeCheckbox}" Height="16" Grid.Column="1" HorizontalAlignment="Left" Panel.ZIndex="1" Command="{Binding DisplayPasswordCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}"></CheckBox>
|
|
|
+ </Grid>
|
|
|
+
|
|
|
+ <CheckBox Grid.Column="1" Height="56" VerticalAlignment="Bottom"></CheckBox>
|
|
|
+ </StackPanel>
|
|
|
+ <StackPanel Orientation="Vertical" Grid.Row="1" Margin="0,16,0,0">
|
|
|
+ <CheckBox Name="PermissionsPasswordChk" IsChecked="{Binding NeedPermissionsPassword, Mode=TwoWay}" Command="{Binding SetPermissionsPasswordCommand}" CommandParameter="{Binding RelativeSource = {RelativeSource Self}}">
|
|
|
+ <TextBlock Text="Permissions" FontFamily="Segoe UI" FontSize="14"></TextBlock>
|
|
|
+ </CheckBox>
|
|
|
+ <Grid Height="32" Margin="0,8,0,16" IsEnabled="{Binding ElementName=PermissionsPasswordChk, Path=IsChecked}" >
|
|
|
+ <Grid.ColumnDefinitions>
|
|
|
+ <ColumnDefinition></ColumnDefinition>
|
|
|
+ <ColumnDefinition Width="24"></ColumnDefinition>
|
|
|
+ </Grid.ColumnDefinitions>
|
|
|
+ <PasswordBox Style="{StaticResource PermissionsPasswordBoxStyle}" help:PasswordBoxHelper.Password="{Binding PermissionsPassword, Mode=TwoWay , UpdateSourceTrigger=PropertyChanged}" help:PasswordBoxHelper.DisplayText="{Binding PermissionsPasswordMsg, Mode=TwoWay}" Grid.ColumnSpan="2" Visibility="{Binding PermissionsPasswordVisibility, Mode=TwoWay}">
|
|
|
+ </PasswordBox>
|
|
|
+ <TextBox Style="{StaticResource PermissionsPasswordTextBoxStyle}" Text="{Binding PermissionsPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" help:PasswordBoxHelper.DisplayText="{Binding PermissionsPasswordMsg, Mode=TwoWay}" Grid.ColumnSpan="2" Visibility="{Binding PermissionsTextVisibility, Mode=TwoWay}" ></TextBox>
|
|
|
+ <CheckBox IsChecked="{Binding IsPermissionsPasswordDisplayed,Mode=TwoWay}" x:Name="DisplayPermissionsPasswordChk" Style="{StaticResource EyeCheckbox}" Height="16" Grid.Column="1" HorizontalAlignment="Left" Panel.ZIndex="1" Command="{Binding DisplayPasswordCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}"></CheckBox>
|
|
|
+ </Grid>
|
|
|
+
|
|
|
+ </StackPanel >
|
|
|
+ <StackPanel Grid.Row="2" Orientation="Vertical" IsEnabled="{Binding ElementName=PermissionsPasswordChk, Path=IsChecked}" >
|
|
|
+ <CheckBox Margin="0,8,0,0" IsChecked="{Binding IsRestrictPrinting,Mode=TwoWay}" Command="{Binding SetRestrictCommand}" CommandParameter="{Binding RelativeSource = {RelativeSource Self}}" Tag="Printing">
|
|
|
+ <TextBlock Text="Restrict document printing"></TextBlock>
|
|
|
+ </CheckBox>
|
|
|
+ <CheckBox Margin="0,8,0,0" IsChecked="{Binding IsRestrictCopying}" Command="{Binding SetRestrictCommand}" CommandParameter="{Binding RelativeSource = {RelativeSource Self}}" Tag="Copying">
|
|
|
+ <TextBlock Text="Restrict content copying"></TextBlock>
|
|
|
</CheckBox>
|
|
|
- <PasswordBox>
|
|
|
- </PasswordBox>
|
|
|
</StackPanel>
|
|
|
</Grid>
|
|
|
</cus:DialogContent.Content>
|
|
|
<cus:DialogContent.BottmBar>
|
|
|
- <Grid></Grid>
|
|
|
+ <Grid Width="400">
|
|
|
+ <Button Width="80" Height="32" HorizontalAlignment="Left" Command="{Binding BatchCommand}">
|
|
|
+ <TextBlock Text="Batch"></TextBlock>
|
|
|
+ </Button>
|
|
|
+ <Button Width="80" Height="32" Margin="0,0,96,0" HorizontalAlignment="Right" Command="{Binding EncryptCommand}" IsEnabled="{Binding EnableConfirm, Mode=TwoWay}" RenderTransformOrigin="1.5,1192508.3">
|
|
|
+ <TextBlock Text="Encrypt"></TextBlock>
|
|
|
+ </Button>
|
|
|
+ <Button Width="80" Height="32" HorizontalAlignment="Right" Command="{Binding CancelEncryptCommand}">
|
|
|
+ <TextBlock Text="Cancel"></TextBlock>
|
|
|
+ </Button>
|
|
|
+ </Grid>
|
|
|
</cus:DialogContent.BottmBar>
|
|
|
</cus:DialogContent>
|
|
|
</UserControl>
|