|
@@ -12,7 +12,11 @@ using System.IO;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows;
|
|
using System.Windows.Forms;
|
|
using System.Windows.Forms;
|
|
|
|
+using CheckBox = System.Windows.Controls.CheckBox;
|
|
using DialogResult = Prism.Services.Dialogs.DialogResult;
|
|
using DialogResult = Prism.Services.Dialogs.DialogResult;
|
|
|
|
+using static PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageSetPasswordDialogModel;
|
|
|
|
+using PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs;
|
|
|
|
+using PDF_Office.Helper;
|
|
|
|
|
|
namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing
|
|
namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing
|
|
{
|
|
{
|
|
@@ -53,6 +57,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private EnumPermissionsMod enumPermissionsMod = EnumPermissionsMod.StatusUnknown | EnumPermissionsMod.StatusRestrictPrinting | EnumPermissionsMod.StatusRestrictCopying;
|
|
|
|
+
|
|
private string _changeMod = "0";
|
|
private string _changeMod = "0";
|
|
///<value>
|
|
///<value>
|
|
///"0"为ChangeMod.None;
|
|
///"0"为ChangeMod.None;
|
|
@@ -84,6 +90,64 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
_printMod = value;
|
|
_printMod = value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ private string _isEnableConfirm = "False";
|
|
|
|
+ public string IsEnabledConfirm
|
|
|
|
+ {
|
|
|
|
+ get { return _isEnableConfirm; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref _isEnableConfirm, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private bool _enableConfirm = false;
|
|
|
|
+ public bool EnableConfirm
|
|
|
|
+ {
|
|
|
|
+ get { return _enableConfirm; }
|
|
|
|
+ set { SetProperty(ref _enableConfirm, value); }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private string _openPassword = "";
|
|
|
|
+ public string OpenPassword
|
|
|
|
+ {
|
|
|
|
+ get { return _openPassword; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref _openPassword, value);
|
|
|
|
+ CheckEnableConfirmEncrypt();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private string _permissionsPassword = "";
|
|
|
|
+ public string PermissionsPassword
|
|
|
|
+ {
|
|
|
|
+ get { return _permissionsPassword; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref _permissionsPassword, value);
|
|
|
|
+ CheckEnableConfirmEncrypt();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private string _openPasswordMsg = "Open Password";
|
|
|
|
+ public string OpenPasswordMsg
|
|
|
|
+ {
|
|
|
|
+ get { return _openPasswordMsg; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref _openPasswordMsg, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private string _permissionsPasswordMsg = "Permission Password";
|
|
|
|
+ public string PermissionsPasswordMsg
|
|
|
|
+ {
|
|
|
|
+ get { return _permissionsPasswordMsg; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref _permissionsPasswordMsg, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
private string safetyGridIsEnabled = "True";
|
|
private string safetyGridIsEnabled = "True";
|
|
public string SafetyGridIsEnabled
|
|
public string SafetyGridIsEnabled
|
|
@@ -111,16 +175,101 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private string _isEnableConfirm = "False";
|
|
|
|
- public string IsEnabledConfirm
|
|
|
|
|
|
+ private Visibility _openTextVisibility = Visibility.Collapsed;
|
|
|
|
+ public Visibility OpenTextVisibility
|
|
{
|
|
{
|
|
- get { return _isEnableConfirm; }
|
|
|
|
|
|
+ get { return _openTextVisibility; }
|
|
set
|
|
set
|
|
{
|
|
{
|
|
- SetProperty(ref _isEnableConfirm, value);
|
|
|
|
|
|
+ SetProperty(ref _openTextVisibility, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Visibility _openPasswordVisibility = Visibility.Visible;
|
|
|
|
+ public Visibility OpenPasswordVisibility
|
|
|
|
+ {
|
|
|
|
+ get { return _openPasswordVisibility; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ if (value == Visibility.Visible)
|
|
|
|
+ {
|
|
|
|
+ OpenTextVisibility = Visibility.Collapsed;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ OpenTextVisibility = Visibility.Visible;
|
|
|
|
+ }
|
|
|
|
+ SetProperty(ref _openPasswordVisibility, value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private Visibility _permissionsPasswordVisibility = Visibility.Visible;
|
|
|
|
+ public Visibility PermissionsPasswordVisibility
|
|
|
|
+ {
|
|
|
|
+ get { return _permissionsPasswordVisibility; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ if (value == Visibility.Visible)
|
|
|
|
+ {
|
|
|
|
+ PermissionsTextVisibility = Visibility.Collapsed;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ PermissionsTextVisibility = Visibility.Visible;
|
|
|
|
+ }
|
|
|
|
+ SetProperty(ref _permissionsPasswordVisibility, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Visibility _permissionsTextVisibility = Visibility.Collapsed;
|
|
|
|
+ public Visibility PermissionsTextVisibility
|
|
|
|
+ {
|
|
|
|
+ get { return _permissionsTextVisibility; }
|
|
|
|
+ set { SetProperty(ref _permissionsTextVisibility, value); }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private bool? _isRestrictPrinting;
|
|
|
|
+ public bool? IsRestrictPrinting
|
|
|
|
+ {
|
|
|
|
+ get { return _isRestrictPrinting; }
|
|
|
|
+ set { SetProperty(ref _isRestrictPrinting, value); }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private bool? _isRestrictCopying;
|
|
|
|
+ public bool? IsRestrictCopying
|
|
|
|
+ {
|
|
|
|
+ get { return _isRestrictCopying; }
|
|
|
|
+ set { SetProperty(ref _isRestrictCopying, value); }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private bool _needOpenPassword;
|
|
|
|
+ public bool NeedOpenPassword
|
|
|
|
+ {
|
|
|
|
+ get { return _needOpenPassword; }
|
|
|
|
+ set { SetProperty(ref _needOpenPassword, value); }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private bool _needPermissionsPassword;
|
|
|
|
+ public bool NeedPermissionsPassword
|
|
|
|
+ {
|
|
|
|
+ get { return _needPermissionsPassword; }
|
|
|
|
+ set { SetProperty(ref _needPermissionsPassword, value); }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private bool _isOpenPasswordDisplayed;
|
|
|
|
+ public bool IsOpenPasswordDisplayed
|
|
|
|
+ {
|
|
|
|
+ get { return _isOpenPasswordDisplayed; }
|
|
|
|
+ set { SetProperty(ref _isOpenPasswordDisplayed, value); }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private bool _isPermissionsPasswordDisplayed;
|
|
|
|
+ public bool IsPermissionsPasswordDisplayed
|
|
|
|
+ {
|
|
|
|
+ get { return _isPermissionsPasswordDisplayed; }
|
|
|
|
+ set { SetProperty(ref _isPermissionsPasswordDisplayed, value); }
|
|
|
|
+ }
|
|
|
|
+
|
|
private DataTable pdfDataTable = new DataTable();
|
|
private DataTable pdfDataTable = new DataTable();
|
|
public DataTable PDFDataTable
|
|
public DataTable PDFDataTable
|
|
{
|
|
{
|
|
@@ -176,6 +325,16 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
|
|
|
|
#region 委托声明
|
|
#region 委托声明
|
|
|
|
|
|
|
|
+ public DelegateCommand<object> DisplayPasswordCommand { get; set; }
|
|
|
|
+
|
|
|
|
+ public DelegateCommand<object> SetOpenPasswordCommand { get; set; }
|
|
|
|
+
|
|
|
|
+ public DelegateCommand<object> SetPermissionsPasswordCommand { get; set; }
|
|
|
|
+
|
|
|
|
+ public DelegateCommand<object> SetRestrictCommand { get; set; }
|
|
|
|
+
|
|
|
|
+ public DelegateCommand EncryptCommand { get; set; }
|
|
|
|
+
|
|
public DelegateCommand DelegateSetOpenCommand { get; set; }
|
|
public DelegateCommand DelegateSetOpenCommand { get; set; }
|
|
|
|
|
|
public DelegateCommand DelegateSetEditCommand { get; set; }
|
|
public DelegateCommand DelegateSetEditCommand { get; set; }
|
|
@@ -186,6 +345,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
|
|
|
|
public DelegateCommand DelegateConfirmEncryptCommand { get; set; }
|
|
public DelegateCommand DelegateConfirmEncryptCommand { get; set; }
|
|
|
|
|
|
|
|
+ public DelegateCommand CancelEncryptCommand { get; set; }
|
|
|
|
+
|
|
public DelegateCommand DelegateCancelEncryptCommand { get; set; }
|
|
public DelegateCommand DelegateCancelEncryptCommand { get; set; }
|
|
|
|
|
|
public DelegateCommand ADDPDFCommand { get; set; }
|
|
public DelegateCommand ADDPDFCommand { get; set; }
|
|
@@ -205,11 +366,19 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
PDFDataTable.Columns.Add("FileState");
|
|
PDFDataTable.Columns.Add("FileState");
|
|
HomePageSetPasswordDialogModel.PasswordForOpen = "";
|
|
HomePageSetPasswordDialogModel.PasswordForOpen = "";
|
|
HomePageSetPasswordDialogModel.PasswordForEdit = "";
|
|
HomePageSetPasswordDialogModel.PasswordForEdit = "";
|
|
|
|
+
|
|
|
|
+ DisplayPasswordCommand = new DelegateCommand<object>(DisplayPassword);
|
|
|
|
+ SetOpenPasswordCommand = new DelegateCommand<object>(SetOpenPassword);
|
|
|
|
+ SetPermissionsPasswordCommand = new DelegateCommand<object>(SetPermissionsPassword);
|
|
|
|
+ SetRestrictCommand = new DelegateCommand<object>(SetRestrict);
|
|
|
|
+ EncryptCommand = new DelegateCommand(ConfirmEncrypt);
|
|
|
|
+
|
|
DelegateConfirmEncryptCommand = new DelegateCommand(ConfirmEncrypt);
|
|
DelegateConfirmEncryptCommand = new DelegateCommand(ConfirmEncrypt);
|
|
DelegateSetOpenCommand = new DelegateCommand(SetCanOpen);
|
|
DelegateSetOpenCommand = new DelegateCommand(SetCanOpen);
|
|
DelegateSetEditCommand = new DelegateCommand(SetCanEdit);
|
|
DelegateSetEditCommand = new DelegateCommand(SetCanEdit);
|
|
DelegateCanOpenTextChangedCommand = new DelegateCommand(CanOpenTextChanged);
|
|
DelegateCanOpenTextChangedCommand = new DelegateCommand(CanOpenTextChanged);
|
|
DelegateCanEditTextChangedCommand = new DelegateCommand(CanEditTextChanged);
|
|
DelegateCanEditTextChangedCommand = new DelegateCommand(CanEditTextChanged);
|
|
|
|
+
|
|
ADDPDFCommand = new DelegateCommand(addpdf);
|
|
ADDPDFCommand = new DelegateCommand(addpdf);
|
|
ADDOpenedPDFCommand = new DelegateCommand(addOpenedPDFFiles);
|
|
ADDOpenedPDFCommand = new DelegateCommand(addOpenedPDFFiles);
|
|
ADDPDFFilesCommand = new DelegateCommand(addpdffiles);
|
|
ADDPDFFilesCommand = new DelegateCommand(addpdffiles);
|
|
@@ -222,7 +391,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
{
|
|
{
|
|
if (setPasswordDialogModel.CanOpen)
|
|
if (setPasswordDialogModel.CanOpen)
|
|
{
|
|
{
|
|
- if (HomePageSetPasswordDialogModel.PasswordForOpen.Length > 0)
|
|
|
|
|
|
+ if (SetPasswordDialogModel.PasswordForOpen.Length > 0)
|
|
{
|
|
{
|
|
IsEnabledConfirm = "True";
|
|
IsEnabledConfirm = "True";
|
|
return;
|
|
return;
|
|
@@ -230,7 +399,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
}
|
|
}
|
|
if (setPasswordDialogModel.CanEdit)
|
|
if (setPasswordDialogModel.CanEdit)
|
|
{
|
|
{
|
|
- if (HomePageSetPasswordDialogModel.PasswordForEdit.Length > 0)
|
|
|
|
|
|
+ if (SetPasswordDialogModel.PasswordForEdit.Length > 0)
|
|
{
|
|
{
|
|
IsEnabledConfirm = "True";
|
|
IsEnabledConfirm = "True";
|
|
return;
|
|
return;
|
|
@@ -239,17 +408,38 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
IsEnabledConfirm = "False";
|
|
IsEnabledConfirm = "False";
|
|
}
|
|
}
|
|
|
|
|
|
- private void InitPermissionsDictionary(ref Dictionary<string, HomePageSetPasswordDialogModel.PrintMod> GetPrintMod, ref Dictionary<string, HomePageSetPasswordDialogModel.ChangeMod> GetChangeMod)
|
|
|
|
|
|
+ private void CheckEnableConfirmEncrypt()
|
|
{
|
|
{
|
|
- GetPrintMod.Add("0", HomePageSetPasswordDialogModel.PrintMod.None);
|
|
|
|
- GetPrintMod.Add("1", HomePageSetPasswordDialogModel.PrintMod.LowDpi);
|
|
|
|
- GetPrintMod.Add("2", HomePageSetPasswordDialogModel.PrintMod.HighDpi);
|
|
|
|
|
|
+ EnableConfirm = true;
|
|
|
|
+ if (!(NeedOpenPassword || NeedPermissionsPassword))
|
|
|
|
+ {
|
|
|
|
+ EnableConfirm = false;
|
|
|
|
+ }
|
|
|
|
+ if (NeedOpenPassword && string.IsNullOrEmpty(OpenPassword))
|
|
|
|
+ {
|
|
|
|
+ EnableConfirm = false;
|
|
|
|
+ }
|
|
|
|
+ if (NeedPermissionsPassword && string.IsNullOrEmpty(PermissionsPassword))
|
|
|
|
+ {
|
|
|
|
+ EnableConfirm = false;
|
|
|
|
+ }
|
|
|
|
+ if (NeedPermissionsPassword && (!((bool)IsRestrictCopying || (bool)IsRestrictPrinting)))
|
|
|
|
+ {
|
|
|
|
+ EnableConfirm = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- GetChangeMod.Add("0", HomePageSetPasswordDialogModel.ChangeMod.None);
|
|
|
|
- GetChangeMod.Add("1", HomePageSetPasswordDialogModel.ChangeMod.ChangePage);
|
|
|
|
- GetChangeMod.Add("2", HomePageSetPasswordDialogModel.ChangeMod.FormAndSignature);
|
|
|
|
- GetChangeMod.Add("3", HomePageSetPasswordDialogModel.ChangeMod.AnnotAndFormAndSignature);
|
|
|
|
- GetChangeMod.Add("4", HomePageSetPasswordDialogModel.ChangeMod.ExceptAbstrat);
|
|
|
|
|
|
+ private void InitPermissionsDictionary(ref Dictionary<string, SetPasswordDialogModel.PrintMod> GetPrintMod, ref Dictionary<string, SetPasswordDialogModel.ChangeMod> GetChangeMod)
|
|
|
|
+ {
|
|
|
|
+ GetPrintMod.Add("0", SetPasswordDialogModel.PrintMod.None);
|
|
|
|
+ GetPrintMod.Add("1", SetPasswordDialogModel.PrintMod.LowDpi);
|
|
|
|
+ GetPrintMod.Add("2", SetPasswordDialogModel.PrintMod.HighDpi);
|
|
|
|
+
|
|
|
|
+ GetChangeMod.Add("0", SetPasswordDialogModel.ChangeMod.None);
|
|
|
|
+ GetChangeMod.Add("1", SetPasswordDialogModel.ChangeMod.ChangePage);
|
|
|
|
+ GetChangeMod.Add("2", SetPasswordDialogModel.ChangeMod.FormAndSignature);
|
|
|
|
+ GetChangeMod.Add("3", SetPasswordDialogModel.ChangeMod.AnnotAndFormAndSignature);
|
|
|
|
+ GetChangeMod.Add("4", SetPasswordDialogModel.ChangeMod.ExceptAbstrat);
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
#region 逻辑函数
|
|
#region 逻辑函数
|
|
@@ -275,29 +465,120 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
CheckCanConfirmEncrypt();
|
|
CheckCanConfirmEncrypt();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void DisplayPassword(object e)
|
|
|
|
+ {
|
|
|
|
+ var chk = e as CheckBox;
|
|
|
|
+ if (chk != null)
|
|
|
|
+ {
|
|
|
|
+ if (chk.Name == "DisplayOpenPasswordChk")
|
|
|
|
+ {
|
|
|
|
+ if (chk.IsChecked == true)
|
|
|
|
+ {
|
|
|
|
+ OpenPasswordVisibility = Visibility.Collapsed;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ OpenPasswordVisibility = Visibility.Visible;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (chk.IsChecked == true)
|
|
|
|
+ {
|
|
|
|
+ PermissionsPasswordVisibility = Visibility.Collapsed;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ PermissionsPasswordVisibility = Visibility.Visible;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void SetOpenPassword(object e)
|
|
|
|
+ {
|
|
|
|
+ var chk = e as CheckBox;
|
|
|
|
+ if (chk != null)
|
|
|
|
+ {
|
|
|
|
+ IsOpenPasswordDisplayed = false;
|
|
|
|
+ OpenPasswordVisibility = Visibility.Visible;
|
|
|
|
+ }
|
|
|
|
+ CheckEnableConfirmEncrypt();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void SetPermissionsPassword(object e)
|
|
|
|
+ {
|
|
|
|
+ var chk = e as CheckBox;
|
|
|
|
+ if (chk != null)
|
|
|
|
+ {
|
|
|
|
+ IsPermissionsPasswordDisplayed = false;
|
|
|
|
+ PermissionsPasswordVisibility = Visibility.Visible;
|
|
|
|
+ if (chk.IsChecked == true)
|
|
|
|
+ {
|
|
|
|
+ IsRestrictPrinting = true;
|
|
|
|
+ IsRestrictCopying = true;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ IsRestrictPrinting = false;
|
|
|
|
+ IsRestrictCopying = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ CheckEnableConfirmEncrypt();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void SetRestrict(object e)
|
|
|
|
+ {
|
|
|
|
+ var chk = e as CheckBox;
|
|
|
|
+ if (chk != null)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ if ((bool)chk.IsChecked)
|
|
|
|
+ {
|
|
|
|
+ if (chk.Tag.ToString() == "Printing")
|
|
|
|
+ {
|
|
|
|
+ enumPermissionsMod |= EnumPermissionsMod.StatusRestrictPrinting;
|
|
|
|
+ }
|
|
|
|
+ else if (chk.Tag.ToString() == "Copying")
|
|
|
|
+ {
|
|
|
|
+ enumPermissionsMod |= EnumPermissionsMod.StatusRestrictCopying;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (chk.Tag.ToString() == "Printing")
|
|
|
|
+ {
|
|
|
|
+ enumPermissionsMod -= EnumPermissionsMod.StatusRestrictPrinting;
|
|
|
|
+ }
|
|
|
|
+ else if (chk.Tag.ToString() == "Copying")
|
|
|
|
+ {
|
|
|
|
+ enumPermissionsMod -= EnumPermissionsMod.StatusRestrictCopying;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ CheckEnableConfirmEncrypt();
|
|
|
|
+ }
|
|
|
|
+
|
|
public void ConfirmEncrypt()
|
|
public void ConfirmEncrypt()
|
|
{
|
|
{
|
|
HomePageBatchProcessingDialogModel.closeDialog = true;
|
|
HomePageBatchProcessingDialogModel.closeDialog = true;
|
|
SafetyGridIsEnabled = "False";
|
|
SafetyGridIsEnabled = "False";
|
|
string openPassword = "";
|
|
string openPassword = "";
|
|
- string editPassword = "";
|
|
|
|
|
|
+ string permissionsPassword = "";
|
|
CPDFPermissionsInfo permissionsInfo = new CPDFPermissionsInfo();
|
|
CPDFPermissionsInfo permissionsInfo = new CPDFPermissionsInfo();
|
|
- if (setPasswordDialogModel.CanOpen)
|
|
|
|
|
|
+ if (NeedOpenPassword)
|
|
{
|
|
{
|
|
- if (!string.IsNullOrEmpty(HomePageSetPasswordDialogModel.PasswordForOpen))
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty(OpenPassword))
|
|
{
|
|
{
|
|
- openPassword = HomePageSetPasswordDialogModel.PasswordForOpen;
|
|
|
|
|
|
+ openPassword = OpenPassword;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (setPasswordDialogModel.CanEdit)
|
|
|
|
|
|
+ if (NeedPermissionsPassword)
|
|
{
|
|
{
|
|
- if (!string.IsNullOrEmpty(HomePageSetPasswordDialogModel.PasswordForEdit))
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty(PermissionsPassword))
|
|
{
|
|
{
|
|
- editPassword = HomePageSetPasswordDialogModel.PasswordForEdit;
|
|
|
|
- Dictionary<string, HomePageSetPasswordDialogModel.PrintMod> GetPrintMod = new Dictionary<string, HomePageSetPasswordDialogModel.PrintMod>();
|
|
|
|
- Dictionary<string, HomePageSetPasswordDialogModel.ChangeMod> GetChangeMod = new Dictionary<string, HomePageSetPasswordDialogModel.ChangeMod>(); ;
|
|
|
|
- InitPermissionsDictionary(ref GetPrintMod, ref GetChangeMod);
|
|
|
|
- permissionsInfo = setPasswordDialogModel.CreatePermissionsInfo(GetPrintMod[PrintMod], GetChangeMod[ChangeMod]);
|
|
|
|
|
|
+ permissionsPassword = PermissionsPassword;
|
|
|
|
+ permissionsInfo = CreatePermissionsInfo(enumPermissionsMod);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
fileNamesIndex = 0;
|
|
fileNamesIndex = 0;
|
|
@@ -338,8 +619,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
}
|
|
}
|
|
//FileInfo fileinfo = new FileInfo(filename);
|
|
//FileInfo fileinfo = new FileInfo(filename);
|
|
//string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
|
|
//string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
|
|
- document.Encrypt(openPassword, editPassword, permissionsInfo);
|
|
|
|
- document.WriteToFilePath(filename + "SetPassword");
|
|
|
|
|
|
+ document.Encrypt(openPassword, permissionsPassword, permissionsInfo);
|
|
|
|
+ document.WriteToFilePath(CommonHelper.CreateFilePath(filename + "SetPassword"));
|
|
PDFDataTable.Rows[fileNamesIndex]["FileState"] = "complete";
|
|
PDFDataTable.Rows[fileNamesIndex]["FileState"] = "complete";
|
|
PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "complete";
|
|
PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "complete";
|
|
fileNamesIndex++;
|
|
fileNamesIndex++;
|
|
@@ -348,6 +629,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
|
|
SafetyGridIsEnabled = "True";
|
|
SafetyGridIsEnabled = "True";
|
|
HomePageBatchProcessingDialogModel.closeDialog = false;
|
|
HomePageBatchProcessingDialogModel.closeDialog = false;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
#region 批量处理逻辑函数
|
|
#region 批量处理逻辑函数
|