Browse Source

其他-clean代码

liuaoran 2 years ago
parent
commit
08b4e7d9c7

+ 2 - 2
PDF Office/Model/Dialog/ToolsDialogs/CompressDialogModel/CompressDialogModel.cs

@@ -8,14 +8,14 @@ namespace PDF_Office.Model.Dialog.ToolsDialogs
 {
     public class CompressDialogModel
     {
-       public enum qualityLevel { 
-        
+       public enum qualityLevel {  
         _large=100,
         _standard=80,
         _default=45,
         _little =40,
         _micro=10
         }
+
         public qualityLevel CompressQuality { get; set; }
 
         public static string PageIndex { get; set; }

+ 1 - 2
PDF Office/Model/Dialog/ToolsDialogs/SaftyDialogs/DeleteSafetySettintgsModel.cs

@@ -7,8 +7,7 @@ using System.Threading.Tasks;
 namespace PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs
 {
     public class DeleteSafetySettintgsModel
-    {
-      
+    { 
         public enum EnumNeedPassword
         {
             CannotDecrypt,

+ 5 - 2
PDF Office/Model/Dialog/ToolsDialogs/SaftyDialogs/SetPasswordDialogModel.cs

@@ -13,9 +13,9 @@ namespace PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs
 
         public bool CanEdit { get; set; }
 
-        public static string CanOpenPassword { get; set; }
+        public static string PasswordForOpen { get; set; }
 
-        public static string CanEditPassword { get; set; }
+        public static string PasswordForEdit { get; set; }
 
         public enum PrintMod
         {
@@ -33,6 +33,9 @@ namespace PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs
             ExceptAbstrat
         }
 
+        ///<returns>
+        ///生成带有指定权限的CPDFPermissionsInfo对象
+        ///</returns>
         public CPDFPermissionsInfo CreatePermissionsInfo(PrintMod printMod, ChangeMod changeMod)
         {
             CPDFPermissionsInfo permissionsInfo = new CPDFPermissionsInfo();

+ 27 - 22
PDF Office/ViewModels/Dialog/ToolsDialogs/CompressDialogs/CompressDialogViewModel.cs

@@ -15,23 +15,14 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs
 {
     public class CompressDialogViewModel : BindableBase, IDialogAware
     {
+        #region 参数和属性
+        private CPDFDocument.GetPageIndexDelegate indexDelegate = null;
+        private CompressDialogModel compressDialogModel;
+        private IntPtr compressingIntpr = IntPtr.Zero;
         private CPDFDocument document;
-
+        private Visibility _compressLargeStyle = Visibility.Hidden;
         public IDialogService dialogs;
 
-        public DelegateCommand LargeQualityCommand { get; set; }
-
-        public DelegateCommand StandardQualityCommand { get; set; }
-
-        public DelegateCommand LittleQualityCommand { get; set; }
-
-        public DelegateCommand MicroQualityCommand { get; set; }
-
-        public DelegateCommand CompressCommand { get; set; }
-
-        public DelegateCommand ConfirmCompressCommand { get; set; }
-
-        private Visibility _compressLargeStyle = Visibility.Hidden;
         public Visibility CompressLargeStyle
         {
             get { return _compressLargeStyle; }
@@ -68,12 +59,21 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs
                 SetProperty(ref _compressMicroStyle, value);
             }
         }
+        #endregion
 
-        private CPDFDocument.GetPageIndexDelegate indexDelegate = null;
+        #region 委托声明
+        public DelegateCommand LargeQualityCommand { get; set; }
+
+        public DelegateCommand StandardQualityCommand { get; set; }
 
-        CompressDialogModel compressDialogModel { get; set; }
+        public DelegateCommand LittleQualityCommand { get; set; }
 
-        private IntPtr compressingIntpr = IntPtr.Zero;
+        public DelegateCommand MicroQualityCommand { get; set; }
+
+        public DelegateCommand CompressCommand { get; set; }
+
+        public DelegateCommand ConfirmCompressCommand { get; set; }
+        #endregion
 
         public CompressDialogViewModel(IDialogService dialogService)
         {
@@ -86,6 +86,7 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs
             dialogs = dialogService;
         }
 
+        #region 逻辑函数
         private void LargeQuality()
         {
             compressDialogModel.CompressQuality = CompressDialogModel.qualityLevel._large;
@@ -129,7 +130,7 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs
             Trace.WriteLine(pageindex);
             return 0;
         }
-        private async void Compress()
+        private void Compress()
         {
 
             FolderBrowserDialog folderDialog = new FolderBrowserDialog();
@@ -158,16 +159,19 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs
                 value.Add(ParameterNames.FilePath, sfd.FileName);
                 value.Add("compressDialogModel.CompressQuality", (int)compressDialogModel.CompressQuality);
                 RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
-                dialogs.ShowDialog(DialogNames.CompressProgressBarDialog, value, e => {
-                
-                }); 
+                dialogs.ShowDialog(DialogNames.CompressProgressBarDialog, value, e =>
+                {
+
+                });
             }
             else
             {
                 MessageBox.Show("Cancel.");
             }
-
         }
+        #endregion
+
+        #region 框架行为
         public string Title => "";
 
         public event Action<IDialogResult> RequestClose;
@@ -193,5 +197,6 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs
                 compressDialogModel.CompressQuality = CompressDialogModel.qualityLevel._default;
             }
         }
+        #endregion
     }
 }

+ 13 - 10
PDF Office/ViewModels/Dialog/ToolsDialogs/CompressDialogs/CompressProgressBarDialogViewModel.cs

@@ -14,16 +14,15 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs
 {
     public class CompresProgressBarDialogViewModel : BindableBase, IDialogAware
     {
+        #region 参数和属性
         private IntPtr compressingIntpr = IntPtr.Zero;
-
         private CPDFDocument.GetPageIndexDelegate indexDelegate = null;
-
         private CPDFDocument tempDocument;
-
         private string _pageIndex = "0";
-        /// <summary>
-        /// 页面尺寸
-        /// </summary>
+
+        /// <value>
+        /// 当前页
+        /// </value>
         public string PageIndex
         {
             get { return _pageIndex; }
@@ -34,9 +33,9 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs
         }
 
         private string _pageNumber = "";
-        /// <summary>
-        /// 页面尺寸
-        /// </summary>
+        /// <value>
+        /// 总页数
+        /// </value>
         public string PageNumber
         {
             get { return _pageNumber; }
@@ -45,14 +44,17 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs
                 SetProperty(ref _pageNumber, value);
             }
         }
+        #endregion
 
+        #region 逻辑函数
         private int GetIndex(int pageindex)
         {
             PageIndex = pageindex.ToString();
             return 0;
         }
+        #endregion
 
-
+        #region 框架行为
         public string Title => "";
 
         public event Action<IDialogResult> RequestClose;
@@ -89,5 +91,6 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs
                 document.Release();
             }
         }
+        #endregion
     }
 }

+ 14 - 7
PDF Office/ViewModels/Dialog/ToolsDialogs/SaftyDialogs/CheckPasswordDialogViewModel.cs

@@ -12,10 +12,16 @@ using System.Xml.Linq;
 namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
 {
     public class CheckPasswordDialogViewModel : BindableBase,IDialogAware
-    {
+    { 
+        #region 参数和属性
         private CPDFDocument document;
+        #endregion
+
+        #region 委托声明
         public DelegateCommand DelegateConfirmCheckPasswordCommand { get; set; }
         public DelegateCommand DelegateCancelCheckPasswordCommand { get; set; }
+        #endregion
+
         public CheckPasswordDialogViewModel()
         {
             CheckPasswordDialogModel.Password = "";
@@ -23,12 +29,11 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
             DelegateCancelCheckPasswordCommand = new DelegateCommand(CancelCheckPassword);
         }
 
+        #region 逻辑函数
         private void ConfirmCheckPassword()
         {
-            if (false)//预留接口
-            {
-                 
-            }
+            if (false)//预留,用于检测输入密码的权限,以及是否输入了正确的密码
+            {  }
             var dialogResult = new DialogResult(ButtonResult.OK);
             dialogResult.Parameters.Add("CheckPassword", true);
             RequestClose.Invoke(dialogResult);
@@ -40,9 +45,10 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
             dialogResult.Parameters.Add("CheckPassword", false);
             RequestClose.Invoke(dialogResult);
         }
+        #endregion
 
-        public string Title =>"";
-
+        #region 框架相关
+        public string Title =>""; 
         public event Action<IDialogResult> RequestClose;
 
         public bool CanCloseDialog()
@@ -63,5 +69,6 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
                 document = doc;
             }
         }
+        #endregion
     }
 }

+ 52 - 8
PDF Office/ViewModels/Dialog/ToolsDialogs/SaftyDialogs/DeleteSafetySettingsDialogViewModel.cs

@@ -12,23 +12,51 @@ using System.Windows.Forms;
 
 namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
 {
-
     public class DeleteSafetySettingsDialogViewModel : BindableBase, IDialogAware
     {
-
+        #region 参数和属性
         DeleteSafetySettintgsModel deleteSafetySettintgsModel;
         public IDialogService dialogs;
-
         private CPDFDocument document;
+        #endregion
 
+        #region 委托声明
         public DelegateCommand CheckPasswordCommand { get; set; }
+        #endregion
 
         public DeleteSafetySettingsDialogViewModel(IDialogService dialogService)
         {
             dialogs = dialogService;
-            CheckPasswordCommand = new DelegateCommand(OpenCheckPassword);
+            CheckPasswordCommand = new DelegateCommand(OpenCheckPasswordDialog);
+        }
+
+        #region 检查函数
+        private bool CheckHaveAllPermissions()
+        {
+            CPDFPermissionsInfo permissionsInfo = document.GetPermissionsInfo();
+            if (permissionsInfo.AllowsDocumentChanges &&
+                permissionsInfo.AllowsPrinting &&
+                permissionsInfo.AllowsHighQualityPrinting &&
+                permissionsInfo.AllowsCopying &&
+                //permissionsInfo.AllowsDocumentAssembly&& //这个权限有问题
+                permissionsInfo.AllowsCommenting)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
         }
 
+        /// <summary>
+        /// 检测是否需要输入密码
+        /// </summary>
+        /// <returns>
+        /// EnumNeedPassword.VerifyPassword:需要确认密码;
+        /// EnumNeedPassword.DirectDescrypt:直接执行操作
+        /// EnumNeedPassword.CannotDecrypt:无可执行操作。
+        /// </returns>
         private DeleteSafetySettintgsModel.EnumNeedPassword CheckNeedPassword()
         {
             if (document.IsLocked)
@@ -38,15 +66,24 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
             else { }
             if (document.IsEncrypted)
             {
-                return DeleteSafetySettintgsModel.EnumNeedPassword.VerifyPassword;
+                if (CheckHaveAllPermissions())
+                {
+                    return DeleteSafetySettintgsModel.EnumNeedPassword.DirectDescrypt;
+                }
+                else
+                {
+                    return DeleteSafetySettintgsModel.EnumNeedPassword.VerifyPassword;
+                }
             }
             else
             {
                 return DeleteSafetySettintgsModel.EnumNeedPassword.CannotDecrypt;
             }
         }
+        #endregion
 
-        private void OpenCheckPassword()
+        #region 逻辑函数
+        private void OpenCheckPasswordDialog()
         {
             FolderBrowserDialog folderDialog = new FolderBrowserDialog();
             System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
@@ -100,11 +137,17 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
                     MessageBox.Show("取消保存");
                 }
             }
-            else { MessageBox.Show("无可用安全性设置"); }
+            else if (CheckNeedPassword() == DeleteSafetySettintgsModel.EnumNeedPassword.CannotDecrypt)
+            {
+                MessageBox.Show("无可用安全性设置");
+            }
+            else
+            { }
             RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
-
         }
+        #endregion
 
+        #region 框架相关
         public string Title => "";
 
         public event Action<IDialogResult> RequestClose;
@@ -127,5 +170,6 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
                 document = doc;
             }
         }
+        #endregion
     }
 }

+ 68 - 54
PDF Office/ViewModels/Dialog/ToolsDialogs/SaftyDialogs/SetPasswordDialogViewModel.cs

@@ -18,20 +18,12 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
 {
     public class SetPasswordDialogViewModel : BindableBase, IDialogAware
     {
+        #region 参数和属性
         private SetPasswordDialogModel setPasswordDialogModel = new SetPasswordDialogModel();
-
         private CPDFDocument document;
 
-        public DelegateCommand DelegateSetOpenCommand { get; set; }
-        public DelegateCommand DelegateSetEditCommand { get; set; }
-        public DelegateCommand DelegateCanOpenTextChangedCommand { get; set; }
-        public DelegateCommand DelegateCanEditTextChangedCommand { get; set; }
-        public DelegateCommand DelegateConfirmEncryptCommand { get; set; }
-        public DelegateCommand DelegateCancelEncryptCommand { get; set; }
-        public DelegateCommand InputPasswordCommand { get; set; }
-         
         private bool _canOpen;
-        public bool CanOpen 
+        public bool CanOpen
         {
             get { return _canOpen; }
             set
@@ -52,7 +44,14 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
             }
         }
 
-        private string _changeMod="0";
+        private string _changeMod = "0";
+        ///<value>
+        ///"0"为ChangeMod.None;
+        ///"1"为ChangeMod.ChangePage;
+        ///"2"为ChangeMod.FormAndSignature;
+        ///"3"为ChangeMod.AnnotAndFormAndSignature;
+        ///"4"为ChangeMod.ExceptAbstrat;
+        ///</value>
         public string ChangeMod
         {
             get { return _changeMod; }
@@ -62,7 +61,12 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
             }
         }
 
-        private string _printMod="0";
+        private string _printMod = "0";
+        ///<value>
+        ///"0"为PrintMod.None;
+        ///"1"为PrintMod.LowDpi;
+        ///"2"为PrintMod.HighDpi;
+        ///</value>
         public string PrintMod
         {
             get { return _printMod; }
@@ -81,12 +85,21 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
                 SetProperty(ref _isEnableConfirm, value);
             }
         }
+        #endregion
 
+        #region 委托声明
+        public DelegateCommand DelegateSetOpenCommand { get; set; }
+        public DelegateCommand DelegateSetEditCommand { get; set; }
+        public DelegateCommand DelegateCanOpenTextChangedCommand { get; set; }
+        public DelegateCommand DelegateCanEditTextChangedCommand { get; set; }
+        public DelegateCommand DelegateConfirmEncryptCommand { get; set; }
+        public DelegateCommand DelegateCancelEncryptCommand { get; set; }
+        #endregion
 
         public SetPasswordDialogViewModel()
         {
-            SetPasswordDialogModel.CanOpenPassword = "";
-            SetPasswordDialogModel.CanEditPassword = "";
+            SetPasswordDialogModel.PasswordForOpen = "";
+            SetPasswordDialogModel.PasswordForEdit = "";
             DelegateConfirmEncryptCommand = new DelegateCommand(ConfirmEncrypt);
             DelegateCancelEncryptCommand = new DelegateCommand(CancelEncrypt);
             DelegateSetOpenCommand = new DelegateCommand(SetCanOpen);
@@ -95,11 +108,12 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
             DelegateCanEditTextChangedCommand = new DelegateCommand(CanEditTextChanged);
         }
 
+        #region 检查和初始化
         private void CheckCanConfirmEncrypt()
         {
             if (setPasswordDialogModel.CanOpen)
             {
-                if (SetPasswordDialogModel.CanOpenPassword.Length > 0)
+                if (SetPasswordDialogModel.PasswordForOpen.Length > 0)
                 {
                     IsEnabledConfirm = "True";
                     return;
@@ -107,7 +121,7 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
             }
             if (setPasswordDialogModel.CanEdit)
             {
-                if (SetPasswordDialogModel.CanEditPassword.Length > 0)
+                if (SetPasswordDialogModel.PasswordForEdit.Length > 0)
                 {
                     IsEnabledConfirm = "True";
                     return;
@@ -116,6 +130,21 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
             IsEnabledConfirm = "False";
         }
 
+        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
+
+        #region 逻辑函数
         public void SetCanOpen()
         {
             setPasswordDialogModel.CanOpen = CanOpen;
@@ -136,22 +165,7 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
         public void CanEditTextChanged()
         {
             CheckCanConfirmEncrypt();
-        }
-
-
-        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);
-        }
+        } 
 
         public void ConfirmEncrypt()
         {
@@ -176,39 +190,38 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
                 /*
                  * 做一些工作
                  */
-
-                    CPDFPermissionsInfo permissionsInfo = new CPDFPermissionsInfo();
-                    if (setPasswordDialogModel.CanOpen)
+                CPDFPermissionsInfo permissionsInfo = new CPDFPermissionsInfo();
+                if (setPasswordDialogModel.CanOpen)
+                {
+                    if (!string.IsNullOrEmpty(SetPasswordDialogModel.PasswordForOpen))
                     {
-                        if (!string.IsNullOrEmpty(SetPasswordDialogModel.CanOpenPassword))
-                        {
-                            openPassword = SetPasswordDialogModel.CanOpenPassword;
-                        }
+                        openPassword = SetPasswordDialogModel.PasswordForOpen;
                     }
-                    if (setPasswordDialogModel.CanEdit)
+                }
+                if (setPasswordDialogModel.CanEdit)
+                {
+                    if (!string.IsNullOrEmpty(SetPasswordDialogModel.PasswordForEdit))
                     {
-                        if (!string.IsNullOrEmpty(SetPasswordDialogModel.CanEditPassword))
-                        {
-                            editPassword = SetPasswordDialogModel.CanEditPassword;
-                            Dictionary<string, SetPasswordDialogModel.PrintMod> GetPrintMod = new Dictionary<string, SetPasswordDialogModel.PrintMod>();
-                            Dictionary<string, SetPasswordDialogModel.ChangeMod> GetChangeMod = new Dictionary<string, SetPasswordDialogModel.ChangeMod>(); ;
-                            InitPermissionsDictionary(ref GetPrintMod, ref GetChangeMod);
-                            permissionsInfo = setPasswordDialogModel.CreatePermissionsInfo(GetPrintMod[PrintMod], GetChangeMod[ChangeMod]);
-                        }
+                        editPassword = SetPasswordDialogModel.PasswordForEdit;
+                        Dictionary<string, SetPasswordDialogModel.PrintMod> GetPrintMod = new Dictionary<string, SetPasswordDialogModel.PrintMod>();
+                        Dictionary<string, SetPasswordDialogModel.ChangeMod> GetChangeMod = new Dictionary<string, SetPasswordDialogModel.ChangeMod>(); ;
+                        InitPermissionsDictionary(ref GetPrintMod, ref GetChangeMod);
+                        permissionsInfo = setPasswordDialogModel.CreatePermissionsInfo(GetPrintMod[PrintMod], GetChangeMod[ChangeMod]);
                     }
-                    document.Encrypt(openPassword, editPassword, permissionsInfo);
+                }
+                document.Encrypt(openPassword, editPassword, permissionsInfo);
 
-                    document.WriteToFilePath(sfd.FileName);
-                    MessageBox.Show(sfd.FileName + " 保存成功");
-                    RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
+                document.WriteToFilePath(sfd.FileName);
+                MessageBox.Show(sfd.FileName + " 保存成功");
+                RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
             }
         }
         public void CancelEncrypt() =>
             RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
+        #endregion
 
-
+        #region 框架相关
         public string Title => "";
-
         public event Action<IDialogResult> RequestClose;
 
         public bool CanCloseDialog()
@@ -229,5 +242,6 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
                 document = doc;
             }
         }
+        #endregion
     }
 }

+ 4 - 4
PDF Office/Views/Dialog/ToolsDialogs/SaftyDialogs/SetPasswordDialog.xaml.cs

@@ -74,7 +74,7 @@ namespace PDF_Office.Views.Dialog.ToolsDialogs.SaftyDialogs
                     return;
                 }
                 CanOpenTextBox.Text = CanOpenPasswordBox.Password;
-                SetPasswordDialogModel.CanOpenPassword = CanOpenTextBox.Text;
+                SetPasswordDialogModel.PasswordForOpen = CanOpenTextBox.Text;
                 ((SetPasswordDialogViewModel)this.DataContext).DelegateCanOpenTextChangedCommand.Execute();
             }
             else if (a.Name == canEditPasswordBoxName)
@@ -84,7 +84,7 @@ namespace PDF_Office.Views.Dialog.ToolsDialogs.SaftyDialogs
                     return;
                 }
                 CanEditTextBox.Text = CanEditPasswordBox.Password;
-                SetPasswordDialogModel.CanEditPassword = CanEditTextBox.Text;
+                SetPasswordDialogModel.PasswordForEdit = CanEditTextBox.Text;
                 ((SetPasswordDialogViewModel)this.DataContext).DelegateCanOpenTextChangedCommand.Execute();
             }
         }
@@ -99,7 +99,7 @@ namespace PDF_Office.Views.Dialog.ToolsDialogs.SaftyDialogs
                     return; 
                 }
                 CanOpenPasswordBox.Password = CanOpenTextBox.Text;
-                SetPasswordDialogModel.CanOpenPassword = CanOpenPasswordBox.Password;
+                SetPasswordDialogModel.PasswordForOpen = CanOpenPasswordBox.Password;
                 ((SetPasswordDialogViewModel)this.DataContext).DelegateCanOpenTextChangedCommand.Execute();
             }
             else if (a.Name == canEditTextBoxName)
@@ -107,7 +107,7 @@ namespace PDF_Office.Views.Dialog.ToolsDialogs.SaftyDialogs
                 if (canEditPasswordBoxHasFocus)
                 { return; }
                 CanEditPasswordBox.Password = CanEditTextBox.Text;
-                SetPasswordDialogModel.CanEditPassword = CanEditPasswordBox.Password;
+                SetPasswordDialogModel.PasswordForEdit = CanEditPasswordBox.Password;
                 ((SetPasswordDialogViewModel)this.DataContext).DelegateCanOpenTextChangedCommand.Execute();
             }
         }