Sfoglia il codice sorgente

Merge branch 'dev' of http://git.kdan.cc:8865/Windows/PDFOffice_Windows_exe into dev

OYXH\oyxh 2 anni fa
parent
commit
ebab4ce73a
42 ha cambiato i file con 1798 aggiunte e 526 eliminazioni
  1. BIN
      PDF Office/ComPDFKit.Desk.dll
  2. BIN
      PDF Office/ComPDFKit.Viewer.dll
  3. 31 24
      PDF Office/Helper/PDFToolsHelper.cs
  4. 1 0
      PDF Office/Helper/PopControlHelper.cs
  5. 1 0
      PDF Office/Helper/RichTextBoxHelper.cs
  6. 34 23
      PDF Office/Helper/SecurityHelper.cs
  7. 6 0
      PDF Office/Helper/SettingHelper.cs
  8. 261 0
      PDF Office/Helper/Win32Helper.cs
  9. 11 4
      PDF Office/Model/Dialog/ToolsDialogs/SaftyDialogs/SetPasswordDialogModel.cs
  10. 1 0
      PDF Office/PDF Office.csproj
  11. 26 1
      PDF Office/Styles/PathButtonStyle.xaml
  12. 23 0
      PDF Office/Styles/TextBoxStyle.xaml
  13. 2 2
      PDF Office/ViewModels/BOTA/SearchContentViewModel.cs
  14. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogViewModel.cs
  15. 3 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogViewModel.cs
  16. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDocumentContentViewModel.cs
  17. 23 10
      PDF Office/ViewModels/Dialog/SettingsDialogViewModel.cs
  18. 3 1
      PDF Office/ViewModels/Dialog/ToolsDialogs/MergeDialogViewModel.cs
  19. 5 5
      PDF Office/ViewModels/Dialog/ToolsDialogs/SaftyDialogs/CheckPasswordDialogViewModel.cs
  20. 67 25
      PDF Office/ViewModels/Dialog/ToolsDialogs/SaftyDialogs/SetPasswordDialogViewModel.cs
  21. 155 5
      PDF Office/ViewModels/FillAndSign/FillAndSignContentViewModel.cs
  22. 45 6
      PDF Office/ViewModels/HomePanel/RecentFiles/RecentFilesContentViewModel.cs
  23. 18 2
      PDF Office/ViewModels/PropertyPanel/AnnotPanel/SharpsAnnotPropertyViewModel.cs
  24. 3 9
      PDF Office/ViewModels/TipContent/FileRestrictedTipViewModel.cs
  25. 82 15
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs
  26. 1 2
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Layout.cs
  27. 29 20
      PDF Office/ViewModels/Tools/ToolsBarContentViewModel.cs
  28. 35 13
      PDF Office/ViewModels/ViewContentViewModel.cs
  29. 187 32
      PDF Office/Views/BOTA/SearchContent.xaml
  30. 55 4
      PDF Office/Views/BOTA/SearchContent.xaml.cs
  31. 117 46
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialog.xaml
  32. 105 26
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialog.xaml
  33. 58 6
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDocumentContent.xaml
  34. 2 2
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModBookletContent.xaml
  35. 3 3
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModMultipleContent.xaml
  36. 26 28
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModPosterContent.xaml
  37. 7 20
      PDF Office/Views/Dialog/SettingsDialog.xaml
  38. 25 10
      PDF Office/Views/HomeContent.xaml
  39. 70 67
      PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml
  40. 269 112
      PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml
  41. 1 1
      PDF Office/Views/PropertyPanel/AnnotPanel/SharpsAnnotProperty.xaml
  42. 5 0
      PDFSettings/APPSettingProperties.cs

BIN
PDF Office/ComPDFKit.Desk.dll


BIN
PDF Office/ComPDFKit.Viewer.dll


+ 31 - 24
PDF Office/Helper/PDFToolsHelper.cs

@@ -279,30 +279,36 @@ namespace PDF_Office.Helper
 
 
 
-            AllTools.Add(split.toolItem);
-            AllTools.Add(extract.toolItem);
-            AllTools.Add(insert.toolItem);
-            AllTools.Add(compress.toolItem);
-            AllTools.Add(merge.toolItem);
-            AllTools.Add(print.toolItem);
-            AllTools.Add(security.toolItem);
-            AllTools.Add(convertPDF.toolItem);
+            ///设置快捷工具默认初始顺序
             AllTools.Add(pDFToWord.toolItem);
             AllTools.Add(pDFToExcel.toolItem);
             AllTools.Add(pDFToPPT.toolItem);
-            AllTools.Add(imageToPDF.toolItem);
-            AllTools.Add(oCR.toolItem);
-            AllTools.Add(waterMark.toolItem);
-            AllTools.Add(headerFooter.toolItem);
-            AllTools.Add(batesNumbers.toolItem);
-            AllTools.Add(batch.toolItem);
-            AllTools.Add(background.toolItem);
-            AllTools.Add(compareDoc.toolItem);
-            AllTools.Add(redact.toolItem);
-            AllTools.Add(pageEdit.toolItem);
-            AllTools.Add(batchRemove.toolItem);
-            AllTools.Add(formFiledRecognition.toolItem);
             AllTools.Add(pDFToImage.toolItem);
+            AllTools.Add(security.toolItem);
+            AllTools.Add(imageToPDF.toolItem);
+            AllTools.Add(merge.toolItem);
+            AllTools.Add(compress.toolItem);
+
+            //更多工具默认初始顺序
+            //AllTools.Add(split.toolItem);
+            //AllTools.Add(extract.toolItem);
+            //AllTools.Add(insert.toolItem);
+            //AllTools.Add(merge.toolItem);
+            //AllTools.Add(print.toolItem);
+            //AllTools.Add(convertPDF.toolItem);
+            //AllTools.Add(imageToPDF.toolItem);
+            //AllTools.Add(oCR.toolItem);
+            //AllTools.Add(waterMark.toolItem);
+            //AllTools.Add(headerFooter.toolItem);
+            //AllTools.Add(batesNumbers.toolItem);
+            //AllTools.Add(batch.toolItem);
+            //AllTools.Add(background.toolItem);
+            //AllTools.Add(compareDoc.toolItem);
+            //AllTools.Add(redact.toolItem);
+            //AllTools.Add(pageEdit.toolItem);
+            //AllTools.Add(batchRemove.toolItem);
+            //AllTools.Add(formFiledRecognition.toolItem);
+            //AllTools.Add(pDFToImage.toolItem);
         }
 
         /// <summary>
@@ -344,11 +350,12 @@ namespace PDF_Office.Helper
         /// </summary>
         private void InitQuickTools()
         {
+            //读取缓存的形式
+            //var cacheList = Settings.Default.AllPDFToolsList;
 
-            var cacheList = Settings.Default.AllPDFToolsList;
-
-            if (cacheList == null)
-                cacheList = new AllPDFToolsList();
+            //if (cacheList == null)
+            //暂时不用支持记录到缓存,且原方案有一定bug,先采用简单的形式加载处理
+            var  cacheList = new AllPDFToolsList();
 
             if(cacheList.Count > 0)
             {

+ 1 - 0
PDF Office/Helper/PopControlHelper.cs

@@ -597,6 +597,7 @@ namespace PDF_Office.Helper
                     childItem = new CusMenuItem();
                     childItem.SetFlagControl(child);
                     menu.Items.Add(child);
+                    Controls.Add(childItem);
                     break;
                 }
             }

+ 1 - 0
PDF Office/Helper/RichTextBoxHelper.cs

@@ -215,6 +215,7 @@ namespace PDF_Office.Helper
                 if (textappend.Equals(keyword, StringComparison.OrdinalIgnoreCase))
                 {
                     textRun.Background = new SolidColorBrush(textColor);
+                    textRun.FontWeight = FontWeight.FromOpenTypeWeight(600);
                 }
                 addBlock.Inlines.Add(textRun);
                 }

+ 34 - 23
PDF Office/Helper/SecurityHelper.cs

@@ -2,17 +2,28 @@
 using PDF_Office.Model;
 using PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs;
 using Prism.Services.Dialogs;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Management;
+using static PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs.SetPasswordDialogModel;
 using static PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs.DeleteSafetySettintgsModel;
 
 namespace PDF_Office.Helper
 {
-    public  class SecurityHelper
+    public class SecurityHelper
     {
+        /// <summary>
+        /// 由全局变量储存是否修改过密码
+        /// </summary>
+        public static bool IsPasswordChanged = false;
+        /// <summary>
+        /// 全局变量储存修改后的密码
+        /// </summary>
+        public static class PasswordInfo
+        {
+            public static string OpenPassword = null;
+            public static string PermissionsPassword = null;
+            public static CPDFPermissionsInfo CPDFPermissionsInfo = CreateDefaultPermissionsInfo();
+        }
+
         public static bool CheckHaveAllPermissions(CPDFDocument document)
         {
             CPDFPermissionsInfo permissionsInfo = document.GetPermissionsInfo();
@@ -36,31 +47,31 @@ namespace PDF_Office.Helper
         {
             CPDFPermissionsInfo permissionsInfo = document.GetPermissionsInfo();
             ///如果需求这个权限
-           if(((enumPermissionsSet & EnumPermissionsSet.StatusAllowsDocumentChanges) == EnumPermissionsSet.StatusAllowsDocumentChanges ) && (!permissionsInfo.AllowsDocumentChanges))
+            if (((enumPermissionsSet & EnumPermissionsSet.StatusAllowsDocumentChanges) == EnumPermissionsSet.StatusAllowsDocumentChanges) && (!permissionsInfo.AllowsDocumentChanges))
             {
-                    return false;
+                return false;
             }
-           if(((enumPermissionsSet& EnumPermissionsSet.StatusAllowsPrinting) == EnumPermissionsSet.StatusAllowsPrinting) && (!permissionsInfo.AllowsPrinting))
+            if (((enumPermissionsSet & EnumPermissionsSet.StatusAllowsPrinting) == EnumPermissionsSet.StatusAllowsPrinting) && (!permissionsInfo.AllowsPrinting))
             {
                 return false;
             }
-           if(((enumPermissionsSet&EnumPermissionsSet.StatusAllowsHighQualityPrinting) == EnumPermissionsSet.StatusAllowsHighQualityPrinting) && (!permissionsInfo.AllowsHighQualityPrinting))
+            if (((enumPermissionsSet & EnumPermissionsSet.StatusAllowsHighQualityPrinting) == EnumPermissionsSet.StatusAllowsHighQualityPrinting) && (!permissionsInfo.AllowsHighQualityPrinting))
             {
                 return false;
             }
-            if (((enumPermissionsSet&EnumPermissionsSet.StatusAllowsCopying) == EnumPermissionsSet.StatusAllowsCopying)&& (!permissionsInfo.AllowsCopying))
+            if (((enumPermissionsSet & EnumPermissionsSet.StatusAllowsCopying) == EnumPermissionsSet.StatusAllowsCopying) && (!permissionsInfo.AllowsCopying))
             {
                 return false;
             }
-            if (((enumPermissionsSet&EnumPermissionsSet.StatusAllowsDocumentAssembly) == EnumPermissionsSet.StatusAllowsDocumentAssembly) && (!permissionsInfo.AllowsDocumentAssembly))
+            if (((enumPermissionsSet & EnumPermissionsSet.StatusAllowsDocumentAssembly) == EnumPermissionsSet.StatusAllowsDocumentAssembly) && (!permissionsInfo.AllowsDocumentAssembly))
             {
                 return false;
             }
-            if(((enumPermissionsSet&EnumPermissionsSet.StatusAllowsFormFieldEntry) == EnumPermissionsSet.StatusAllowsFormFieldEntry) && (!permissionsInfo.AllowsDocumentAssembly))
+            if (((enumPermissionsSet & EnumPermissionsSet.StatusAllowsFormFieldEntry) == EnumPermissionsSet.StatusAllowsFormFieldEntry) && (!permissionsInfo.AllowsDocumentAssembly))
             {
                 return false;
             }
-            if (((enumPermissionsSet&EnumPermissionsSet.StatusAllowsCommenting) == EnumPermissionsSet.StatusAllowsCommenting) && (!permissionsInfo.AllowsCommenting))
+            if (((enumPermissionsSet & EnumPermissionsSet.StatusAllowsCommenting) == EnumPermissionsSet.StatusAllowsCommenting) && (!permissionsInfo.AllowsCommenting))
             {
                 return false;
             }
@@ -94,10 +105,10 @@ namespace PDF_Office.Helper
         /// </returns>
         public static VerifyPasswordResult VerifyPasswordByPasswordKind(CPDFDocument document, EnumPasswordKind enumPasswordKind, IDialogService dialogService)
         {
-            VerifyPasswordResult verifyPasswordResult  = new VerifyPasswordResult();
-            if ((!document.IsLocked)&&
-                ((enumPasswordKind == EnumPasswordKind.StatusOpenPassword)||
-                (enumPasswordKind == EnumPasswordKind.StatusPermissionsPassword)&& CheckHaveAllPermissions(document)))
+            VerifyPasswordResult verifyPasswordResult = new VerifyPasswordResult();
+            if ((!document.IsLocked) &&
+                ((enumPasswordKind == EnumPasswordKind.StatusOpenPassword) ||
+                (enumPasswordKind == EnumPasswordKind.StatusPermissionsPassword) && CheckHaveAllPermissions(document)))
             {
                 verifyPasswordResult.IsDiscryptied = true;
                 verifyPasswordResult.Password = null;
@@ -107,7 +118,8 @@ namespace PDF_Office.Helper
             DialogParameters value = new DialogParameters();
             value.Add(ParameterNames.PasswordKind, enumPasswordKind);
             value.Add(ParameterNames.PDFDocument, document);
-            dialogService.ShowDialog(DialogNames.CheckPasswordDialog, value, e => {
+            dialogService.ShowDialog(DialogNames.CheckPasswordDialog, value, e =>
+            {
                 verifyPasswordResult.IsDiscryptied = e.Parameters.GetValue<bool>(ParameterNames.PasswordResult);
                 verifyPasswordResult.Password = e.Parameters.GetValue<string>(ParameterNames.Password);
             });
@@ -142,7 +154,7 @@ namespace PDF_Office.Helper
         public static VerifyPasswordResult VerifyPasswordForSelectedPermissions(CPDFDocument document, EnumPermissionsSet enumPermissionsSet, IDialogService dialogService)
         {
             VerifyPasswordResult verifyPasswordResult = new VerifyPasswordResult();
-            if ((!document.IsLocked) &&CheckHaveSelectedPermissions(document, enumPermissionsSet))
+            if ((!document.IsLocked) && CheckHaveSelectedPermissions(document, enumPermissionsSet))
             {
                 verifyPasswordResult.IsDiscryptied = true;
                 verifyPasswordResult.Password = null;
@@ -160,7 +172,8 @@ namespace PDF_Office.Helper
                 value.Add(ParameterNames.PasswordKind, EnumPasswordKind.StatusPermissionsPassword);
             }
             value.Add(ParameterNames.PDFDocument, document);
-            dialogService.ShowDialog(DialogNames.CheckPasswordDialog, value, e => {
+            dialogService.ShowDialog(DialogNames.CheckPasswordDialog, value, e =>
+            {
                 verifyPasswordResult.IsDiscryptied = e.Parameters.GetValue<bool>(ParameterNames.PasswordResult);
                 verifyPasswordResult.Password = e.Parameters.GetValue<string>(ParameterNames.Password);
             });
@@ -168,8 +181,6 @@ namespace PDF_Office.Helper
         }
     }
 
-
-
     public class VerifyPasswordResult
     {
         public bool IsDiscryptied;

+ 6 - 0
PDF Office/Helper/SettingHelper.cs

@@ -54,6 +54,12 @@ namespace PDF_Office.Helper
                 fileInfo.LastOpenTime = DateTime.Now;
                 PDF_Office.Properties.Settings.Default.RecentOpenFiles.Insert(0, fileInfo);
             }
+
+            //限制最近文件列表显示的最大条数
+            if(Settings.Default.RecentOpenFiles.Count>Settings.Default.AppProperties.Description.FileCountInRecentFiles)
+            {
+                Settings.Default.RecentOpenFiles.RemoveRange(Settings.Default.AppProperties.Description.FileCountInRecentFiles, Settings.Default.RecentOpenFiles.Count-Settings.Default.AppProperties.Description.FileCountInRecentFiles);
+            }
             Settings.Default.Save();
         }
 

+ 261 - 0
PDF Office/Helper/Win32Helper.cs

@@ -0,0 +1,261 @@
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Security.Principal;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Helper
+{
+    /// <summary>
+    /// 设置成默认阅读器的辅助类
+    /// </summary>
+    public static class Win32Helper
+    {
+        [StructLayout(LayoutKind.Sequential)]
+        public struct SECURITY_ATTRIBUTES
+        {
+            public int nLength;
+            public IntPtr lpSecurityDescriptor;
+            public int bInheritHandle;
+        }
+        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+        public struct STARTUPINFO
+        {
+            public Int32 cb;
+            public string lpReserved;
+            public string lpDesktop;
+            public string lpTitle;
+            public Int32 dwX;
+            public Int32 dwY;
+            public Int32 dwXSize;
+            public Int32 dwYSize;
+            public Int32 dwXCountChars;
+            public Int32 dwYCountChars;
+            public Int32 dwFillAttribute;
+            public Int32 dwFlags;
+            public Int16 wShowWindow;
+            public Int16 cbReserved2;
+            public IntPtr lpReserved2;
+            public IntPtr hStdInput;
+            public IntPtr hStdOutput;
+            public IntPtr hStdError;
+        }
+
+        [StructLayout(LayoutKind.Sequential)]
+        public struct PROCESS_INFORMATION
+        {
+            public IntPtr hProcess;
+            public IntPtr hThread;
+            public int dwProcessId;
+            public int dwThreadId;
+        }
+
+        [Flags]
+        public enum HChangeNotifyEventID
+        {
+
+            SHCNE_ALLEVENTS = 0x7FFFFFFF,
+            SHCNE_ASSOCCHANGED = 0x08000000,
+            SHCNE_ATTRIBUTES = 0x00000800,
+            SHCNE_CREATE = 0x00000002,
+            SHCNE_DELETE = 0x00000004,
+            SHCNE_DRIVEADD = 0x00000100,
+            SHCNE_DRIVEADDGUI = 0x00010000,
+            SHCNE_DRIVEREMOVED = 0x00000080,
+            SHCNE_EXTENDED_EVENT = 0x04000000,
+            SHCNE_FREESPACE = 0x00040000,
+            SHCNE_MEDIAINSERTED = 0x00000020,
+            SHCNE_MEDIAREMOVED = 0x00000040,
+            SHCNE_MKDIR = 0x00000008,
+            SHCNE_NETSHARE = 0x00000200,
+            SHCNE_NETUNSHARE = 0x00000400,
+            SHCNE_RENAMEFOLDER = 0x00020000,
+            SHCNE_RENAMEITEM = 0x00000001,
+            SHCNE_RMDIR = 0x00000010,
+            SHCNE_SERVERDISCONNECT = 0x00004000,
+            SHCNE_UPDATEDIR = 0x00001000,
+            SHCNE_UPDATEIMAGE = 0x00008000,
+        }
+        [Flags]
+        public enum HChangeNotifyFlags
+        {
+            SHCNF_DWORD = 0x0003,
+            SHCNF_IDLIST = 0x0000,
+            SHCNF_PATHA = 0x0001,
+            SHCNF_PATHW = 0x0005,
+            SHCNF_PRINTERA = 0x0002,
+            SHCNF_PRINTERW = 0x0006,
+            SHCNF_FLUSH = 0x1000,
+            SHCNF_FLUSHNOWAIT = 0x2000
+        }
+
+        [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
+        public static extern bool CreateProcess(string lpApplicationName, string lpCommandLine, ref SECURITY_ATTRIBUTES lpProcessAttributes, ref SECURITY_ATTRIBUTES lpThreadAttributes,
+    bool bInheritHandles, uint dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, [In] ref STARTUPINFO lpStartupInfo, out PROCESS_INFORMATION lpProcessInformation);
+        [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
+        public static extern uint GetModuleFileName([In] IntPtr hModule, [Out] StringBuilder lpFilename, [In][MarshalAs(UnmanagedType.U4)] int nSize);
+        [DllImport("kernel32.dll")]
+        public static extern void ExitProcess(uint uExitCode);
+        [DllImport("shell32.dll")]
+        static extern void SHChangeNotify(HChangeNotifyEventID wEventId, HChangeNotifyFlags uFlags, IntPtr dwItem1, IntPtr dwItem2);
+
+        [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
+        public static extern UInt32 WaitForSingleObject(IntPtr hHandle, UInt32 dwMilliseconds);
+
+        /// <summary>
+        /// 注册为默认PDF浏览器
+        /// </summary>
+        /// <param name="isDefault"></param>
+        /// <returns></returns>
+        public static bool RegisterDefaultApp(bool isDefault)
+        {
+            bool isWin8OrHigher = false;
+            if (Environment.OSVersion.Version.Major > 6 || (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor > 1))
+            {
+                isWin8OrHigher = true;
+            }
+            try
+            {
+                AssemblyName assemblyName = Assembly.GetExecutingAssembly().GetName();
+                /*********** register APP Path  *******************/
+                RegistryKey appPathKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths", true);
+                if (appPathKey == null)
+                {
+                    return false;
+                }
+                RegistryKey appKey = appPathKey.CreateSubKey(assemblyName.Name + ".exe");
+                if (appKey != null)
+                {
+                    appKey.SetValue("", Assembly.GetExecutingAssembly().Location);
+                    appKey.SetValue("Path", Directory.GetParent(assemblyName.FullName).FullName);
+                    appKey.Close();
+                }
+                appPathKey.Close();
+                /*********** register ProgID  *******************/
+                RegistryKey progIdKey = Registry.ClassesRoot.CreateSubKey(assemblyName.Name + ".pdf.1");
+                if (progIdKey == null)
+                {
+                    return false;
+                }
+                progIdKey.SetValue("", assemblyName.Name);
+                RegistryKey openKey = progIdKey.CreateSubKey("Shell\\Open\\Command");
+                openKey.SetValue("", Assembly.GetExecutingAssembly().Location + " \"%s\"  \"%1\"");
+                openKey.Close();
+                progIdKey.Close();
+                /*********** register Default File Association  *******************/
+                RegistryKey softwareKey = Registry.LocalMachine.CreateSubKey("Software\\" + assemblyName.Name);
+                if (softwareKey == null)
+                {
+                    return false;
+                }
+                RegistryKey capabKey = softwareKey.CreateSubKey("Capabilities\\FileAssociations");
+                capabKey.SetValue(".pdf", assemblyName.Name + ".pdf.1");
+                capabKey.Close();
+                capabKey = softwareKey.CreateSubKey("Capabilities", true);
+                capabKey.SetValue("ApplicationDescription", assemblyName.Name);
+                capabKey.Close();
+                softwareKey.Close();
+                /*********** register Default App List  *******************/
+                RegistryKey regiserAppKeys = Registry.LocalMachine.OpenSubKey("SOFTWARE\\RegisteredApplications", true);
+                if (regiserAppKeys == null)
+                {
+                    return false;
+                }
+                regiserAppKeys.SetValue(assemblyName.Name, "SOFTWARE\\" + assemblyName.Name + "\\Capabilities");
+                regiserAppKeys.Close();
+                Registry.ClassesRoot.SetValue(".pdf", assemblyName.Name + ".pdf.1");
+                if (isDefault)
+                {
+                    if (isWin8OrHigher)
+                    {
+                        PROCESS_INFORMATION pInfo = new PROCESS_INFORMATION();
+                        STARTUPINFO sInfo = new STARTUPINFO();
+                        SECURITY_ATTRIBUTES pSec = new SECURITY_ATTRIBUTES();
+                        SECURITY_ATTRIBUTES tSec = new SECURITY_ATTRIBUTES();
+                        pSec.nLength = Marshal.SizeOf(pSec);
+                        tSec.nLength = Marshal.SizeOf(tSec);
+                        string commandLine = " \".pdf\" \"" + assemblyName.Name + ".pdf.1\"";
+                        CreateProcess("Resources\\exe\\SFTA.exe", commandLine, ref pSec, ref tSec, false, 0, IntPtr.Zero, null, ref sInfo, out pInfo);
+                        WaitForSingleObject(pInfo.hProcess, 3000);
+                    }
+                    else
+                    {
+                        RegistryKey defaultKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.pdf\\UserChoice", true);
+                        defaultKey.SetValue("ProgId", assemblyName.Name + ".pdf.1");
+                        defaultKey.Close();
+                        SHChangeNotify(HChangeNotifyEventID.SHCNE_ASSOCCHANGED, HChangeNotifyFlags.SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero);
+                    }
+                }
+                else
+                {
+                    RegistryKey defaultKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.pdf", true);
+                    RegistryKey userChoice = defaultKey.OpenSubKey("UserChoice");
+                    string checkId = userChoice.GetValue("ProgId").ToString();
+                    if (checkId == (assemblyName.Name + ".pdf.1") || checkId == "PDF Technologies, Inc..PDF Reader Pro")
+                    {
+                        defaultKey.DeleteSubKey("UserChoice");
+                        SHChangeNotify(HChangeNotifyEventID.SHCNE_ASSOCCHANGED, HChangeNotifyFlags.SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero);
+                    }
+                    defaultKey.Close();
+                }
+                return true;
+
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 判断是否是默认pdf阅读器
+        /// </summary>
+        /// <returns></returns>
+        public static bool IsDefaultApp()
+        {
+            try
+            {
+                AssemblyName assemblyName = Assembly.GetExecutingAssembly().GetName();
+                var asm = Assembly.GetExecutingAssembly();
+                RegistryKey defaultKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.pdf\\UserChoice");
+                AssemblyCompanyAttribute asmcpn = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCompanyAttribute));
+                AssemblyProductAttribute aspro = (AssemblyProductAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyProductAttribute));
+                string id = string.Format("{0}.{1}", asmcpn.Company, aspro.Product);
+                if (defaultKey != null)
+                {
+                    string checkId = defaultKey.GetValue("ProgId").ToString();
+                    if (checkId == "PDF Technologies, Inc..PDF Reader Pro" || checkId == id)
+                    {
+                        return true;
+                    }
+                    defaultKey.Close();
+                    if (checkId == (assemblyName.Name + ".pdf.1"))
+                    {
+                        return true;
+                    }
+                }
+
+            }
+            catch { }
+
+            return false;
+        }
+
+        /// <summary>
+        /// 判断当前程序是否以管理员身份运行
+        /// </summary>
+        /// <returns></returns>
+        public static bool IsRunAsAdmin()
+        {
+            WindowsIdentity id = WindowsIdentity.GetCurrent();
+            WindowsPrincipal principal = new WindowsPrincipal(id);
+            return principal.IsInRole(WindowsBuiltInRole.Administrator);
+        }
+    }
+}

+ 11 - 4
PDF Office/Model/Dialog/ToolsDialogs/SaftyDialogs/SetPasswordDialogModel.cs

@@ -7,13 +7,12 @@ using System.Runtime.CompilerServices;
 using System.Text;
 using System.Threading.Tasks;
 
+
 namespace PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs
 {
     public class SetPasswordDialogModel
     {
-
-
-
+         
         public enum EnumNeedPassword
         {
             StatusNeedOpenPassword = 1 << 0,
@@ -55,10 +54,18 @@ namespace PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs
             }
             return permissionsInfo;
         }
-
         ///<returns>
         ///生成带有指定权限的CPDFPermissionsInfo对象
         ///</returns>
+    }
 
+    public class SecurityInfo
+    {
+        public bool IsPasswordChanged = false;
+        public bool NeedOpenPassword = false;
+        public bool NeedPermissionsPassword = false;
+        public string OpenPassword = null;
+        public string PermissionsPassword = null;
+        public CPDFPermissionsInfo CPDFPermissionsInfo = SetPasswordDialogModel.CreateDefaultPermissionsInfo();
     }
 }

+ 1 - 0
PDF Office/PDF Office.csproj

@@ -317,6 +317,7 @@
     <Compile Include="EventAggregators\SplitEvent.cs" />
     <Compile Include="Helper\CacheFilePath.cs" />
     <Compile Include="Helper\ConverterHelper.cs" />
+    <Compile Include="Helper\Win32Helper.cs" />
     <Compile Include="Helper\DpiHelpers.cs" />
     <Compile Include="Helper\EditToolsHelper.cs" />
     <Compile Include="Helper\AdvancedInvokeCommandAction.cs" />

+ 26 - 1
PDF Office/Styles/PathButtonStyle.xaml

@@ -119,7 +119,32 @@
                             <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Collapsed" />
                             <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Visible" />
                         </Trigger>
-
+                        <MultiTrigger>
+                            <MultiTrigger.Conditions>
+                                <Condition Property="IsMouseOver" Value="True" />
+                                <Condition Property="IsChecked" Value="True" />
+                            </MultiTrigger.Conditions>
+                            <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseOverForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseOverBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Visible" />
+                        </MultiTrigger>
+                        <MultiTrigger>
+                            <MultiTrigger.Conditions>
+                                <Condition Property="IsPressed" Value="True" />
+                                <Condition Property="IsChecked" Value="True" />
+                            </MultiTrigger.Conditions>
+                            <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseOverForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseOverBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Visible" />
+                        </MultiTrigger>
                         <Trigger SourceName="PART_Content" Property="Text" Value="">
                             <Setter TargetName="PART_Content" Property="Visibility" Value="Collapsed" />
                         </Trigger>

+ 23 - 0
PDF Office/Styles/TextBoxStyle.xaml

@@ -77,4 +77,27 @@
             </MultiTrigger>
         </Style.Triggers>
     </Style>
+    
+    <Style x:Key="Print_normalTxtStyle" TargetType="TextBox">
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate>
+                    <Grid Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
+                        <Border BorderBrush="{StaticResource color.field.border.norm}" Background="{StaticResource color.field.bg.def}" BorderThickness="1" CornerRadius="4">
+                            <ScrollViewer x:Name="PART_ContentHost" Focusable="false"
+                                                  HorizontalScrollBarVisibility="Hidden" 
+                                                  VerticalScrollBarVisibility="Hidden"
+                                                  VerticalAlignment="Center" MinHeight="22" Margin="8,0,0,0" Opacity="1"/>
+                        </Border>
+                    </Grid>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsEnabled" Value="False">
+                            <Setter Property="Opacity" Value="0.6"></Setter>
+                         </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+
 </ResourceDictionary>

+ 2 - 2
PDF Office/ViewModels/BOTA/SearchContentViewModel.cs

@@ -86,7 +86,7 @@ namespace PDF_Office.ViewModels.BOTA
         List<string> HistorySearchText = new List<string>();
         const int MaxHistoryCount = 10;
 
-        private bool caseInsensitive;
+        private bool caseInsensitive = true;
 
         public bool CaseInsensitive
         {
@@ -107,7 +107,7 @@ namespace PDF_Office.ViewModels.BOTA
         {
             textSearch = new PDFTextSearch();
             SearchItemList = new ObservableCollection<SearchItem>();
-            MyProperty = new ObservableCollection<string>() { "1", "2"};
+            MyProperty = new ObservableCollection<string>() { "1", "2" };
             SearchChangedCommand = new DelegateCommand<object>(SearchChanged);
             CleanCommand = new DelegateCommand(clean);
 

+ 1 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogViewModel.cs

@@ -79,7 +79,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             }
         }
 
-        private string removeIsEnable = "False";
+        private string removeIsEnable = "True";
         public string RemoveIsEnable
         {
             get { return removeIsEnable; }

+ 3 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogViewModel.cs

@@ -397,9 +397,12 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
             {
                 PrintSettingsInfo.PrintDocument.PrinterSettings.PrinterName = PrinterName;
                 pageSetupDialog.Document = PrintSettingsInfo.PrintDocument;
+                pageSetupDialog.Document.DefaultPageSettings.Margins = new Margins((int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Left * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Right * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Top * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Bottom * 2.54));
+
                 if (pageSetupDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     PrintSettingsInfo.PrintDocument.DefaultPageSettings = pageSetupDialog.PageSettings;
+
                     if (!PrintSettingsInfo.PrintDocument.DefaultPageSettings.Landscape)
                     {
                         PrintOrientationIndex = 0;

+ 1 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDocumentContentViewModel.cs

@@ -109,7 +109,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
         public DocumentSettingsInfo documentSettingsInfo = new DocumentSettingsInfo();
 
         /// <summary>
-        /// 用于判断是否需要跳转第一页
+        /// 记录打印设置改变前的总页数,用于判断是否需要跳转第一页,仅当总页数改变时跳转
         /// </summary>
         int PreviousPrintedPageCount = 0;
 

+ 23 - 10
PDF Office/ViewModels/Dialog/SettingsDialogViewModel.cs

@@ -1,10 +1,12 @@
-using PDF_Office.Model.SettingsDialog;
+using PDF_Office.Helper;
+using PDF_Office.Model.SettingsDialog;
 using PDF_Office.Properties;
 using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -27,11 +29,11 @@ namespace PDF_Office.ViewModels.Dialog
 
         public DelegateCommand ResetAllCommand { get; set; }
 
-        public List<string> AnnoteFamilyList { get; set; }
+        public ObservableCollection<string> AnnoteFamilyList { get; set; }
 
-        public List<string> PageViewList { get; set; }
+        public ObservableCollection<string> PageViewList { get; set; }
 
-        public List<string> ZoomModeList { get; set; }
+        public ObservableCollection<string> ZoomModeList { get; set; }
 
         private int noteSelectedIndex;
 
@@ -144,7 +146,7 @@ namespace PDF_Office.ViewModels.Dialog
         }
 
 
-        private int modeSelectedIndex = 0;
+        private int modeSelectedIndex;
         //选中的模式
         public int ModeSelectedIndex
         {
@@ -155,6 +157,7 @@ namespace PDF_Office.ViewModels.Dialog
             }
         }
 
+
         private bool isDefualtApp;
 
         /// <summary>
@@ -179,7 +182,7 @@ namespace PDF_Office.ViewModels.Dialog
             }
         }
 
-        private int pageViewSelectedIndex = 0;
+        private int pageViewSelectedIndex;
 
         public int PageViewSelctedIndex
         {
@@ -191,7 +194,7 @@ namespace PDF_Office.ViewModels.Dialog
             }
         }
 
-        private int zoomModeSelectedIndex = 0;
+        private int zoomModeSelectedIndex ;
 
         public int ZoomModeSelectedIndex
         {
@@ -216,11 +219,15 @@ namespace PDF_Office.ViewModels.Dialog
             }
         }
 
+
         public SettingsDialogViewModel()
         {
             Annote = new AnnotateModel();
             Descript = new DescriptionModel();
             View = new InitialVIewModel();
+            PageViewList = new ObservableCollection<string>();
+            AnnoteFamilyList = new ObservableCollection<string>();
+            ZoomModeList = new ObservableCollection<string>();
 
             ResetAllCommand = new DelegateCommand(resetAll);
             ResetCommand = new DelegateCommand(reset);
@@ -231,6 +238,10 @@ namespace PDF_Office.ViewModels.Dialog
             //根据缓存还原下拉框 单选等
             InitAnnote();
             InitView();
+
+            //判断是否以管理员身份运行
+            IsSetDefualtAppEnable = Win32Helper.IsRunAsAdmin();
+            IsDefualtApp = Win32Helper.IsDefaultApp();
         }
 
         private void InitView()
@@ -310,7 +321,7 @@ namespace PDF_Office.ViewModels.Dialog
 
         private void InitPageViews()
         {
-            PageViewList = new List<string>();
+            PageViewList.Clear();
             PageViewList.Add("单页");
             PageViewList.Add("单页连续");
             PageViewList.Add("双页");
@@ -321,7 +332,7 @@ namespace PDF_Office.ViewModels.Dialog
 
         private void InitZoomMode()
         {
-            ZoomModeList = new List<string>();
+            ZoomModeList.Clear();
             ZoomModeList.Add("适应宽度");
             ZoomModeList.Add("适应页面");
             ZoomModeList.Add("实际大小");
@@ -329,7 +340,7 @@ namespace PDF_Office.ViewModels.Dialog
 
         private void InitAnnoteFamily()
         {
-            AnnoteFamilyList = new List<string>();
+            AnnoteFamilyList.Clear();
             AnnoteFamilyList.Add("Courier New");
             AnnoteFamilyList.Add("Arial");
             AnnoteFamilyList.Add("Times New Roman");
@@ -382,6 +393,8 @@ namespace PDF_Office.ViewModels.Dialog
                 View.Save();
                 Annote.Save();
                 Descript.Save();
+
+                Win32Helper.RegisterDefaultApp(IsDefualtApp);
                 Settings.Default.Save();
             }
             catch { }

+ 3 - 1
PDF Office/ViewModels/Dialog/ToolsDialogs/MergeDialogViewModel.cs

@@ -231,6 +231,8 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs
             }
 
             SaveFileDialog saveFileDialog = new SaveFileDialog();
+            saveFileDialog.FileName = "Untitle";
+            saveFileDialog.Filter = "PDF|*.pdf;";
             if (saveFileDialog.ShowDialog() == false)
             {
                 return;
@@ -287,7 +289,7 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs
 
             bool saveResult = SaveDoc.WriteToFilePath(path);
             SaveDoc.Release();
-
+            CommonHelper.ShowFileBrowser(path);
             DialogParameters valuePairs = new DialogParameters();
             valuePairs.Add(ParameterNames.FilePath, path);
             RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));

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

@@ -25,14 +25,14 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
             get { return _password; }
             set
             {
-                SetProperty(ref _password, value);
+                SetProperty(ref _password, value); 
                 IsRightValue = "unknow";
                 if (!string.IsNullOrEmpty(value)){
                     ClearPasswordButtonVisibility = Visibility.Visible;
                 }
                 else
                 {
-                    ClearPasswordButtonVisibility = Visibility.Collapsed;
+                    ClearPasswordButtonVisibility = Visibility.Hidden;
                 }
             }
         }
@@ -70,19 +70,19 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
                 }
                 else
                 {
-                    ErrorPasswordMsgVisibility = Visibility.Collapsed;
+                    ErrorPasswordMsgVisibility = Visibility.Hidden;
                 }
             }
         }
 
-        private Visibility _clearPasswordButtonVisibility = Visibility.Collapsed;
+        private Visibility _clearPasswordButtonVisibility = Visibility.Hidden;
         public Visibility ClearPasswordButtonVisibility
         {
             get { return _clearPasswordButtonVisibility; }
             set { SetProperty(ref _clearPasswordButtonVisibility, value); }
         }
 
-        private Visibility _errorPasswordMsgVisibility = Visibility.Collapsed;
+        private Visibility _errorPasswordMsgVisibility = Visibility.Hidden;
         public Visibility ErrorPasswordMsgVisibility
         {
             get { return _errorPasswordMsgVisibility; }

+ 67 - 25
PDF Office/ViewModels/Dialog/ToolsDialogs/SaftyDialogs/SetPasswordDialogViewModel.cs

@@ -327,46 +327,88 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
             dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, setPasswordpdf, e => { });
         }
 
-
         public void Encrypt()
         {
-
-            string openPassword = "";
-            string permissionsPassword = "";
-
-            CPDFPermissionsInfo permissionsInfo = null;
-
-            if (NeedOpenPassword)
-            {
-                if (!string.IsNullOrEmpty(OpenPassword))
-                {
-                    openPassword = OpenPassword;
-                }
-            }
-            if (NeedPermissionsPassword && (!string.IsNullOrEmpty(PermissionsPassword)))
+            viewContentViewModel.SecurityInfo.IsPasswordChanged = true;
+            if (NeedOpenPassword && (!string.IsNullOrEmpty(OpenPassword)))
             {
-                permissionsPassword = PermissionsPassword;
-                permissionsInfo = CreatePermissionsInfo(enumPermissionsMod);
+                this.viewContentViewModel.SecurityInfo.NeedOpenPassword = true;
+                this.viewContentViewModel.SecurityInfo.OpenPassword = OpenPassword;
             }
             else
             {
-                permissionsInfo = CreateDefaultPermissionsInfo();
+                this.viewContentViewModel.SecurityInfo.NeedOpenPassword = false;
+                viewContentViewModel.SecurityInfo.OpenPassword = null;
             }
-            cPDFViewer.Document.Encrypt(openPassword, permissionsPassword, permissionsInfo);
-           //cPDFViewer.ReloadDocument();
-            if (!string.IsNullOrEmpty(permissionsPassword) )
+
+            if (NeedPermissionsPassword && (!string.IsNullOrEmpty(PermissionsPassword)))
             {
-                cPDFViewer.Document.UnlockWithPassword(permissionsPassword);
-                SecurityHelper.CheckHaveAllPermissions(cPDFViewer.Document);
+                this.viewContentViewModel.SecurityInfo.NeedPermissionsPassword = true;
+                viewContentViewModel.SecurityInfo.PermissionsPassword = PermissionsPassword;
+                viewContentViewModel.SecurityInfo.CPDFPermissionsInfo = CreatePermissionsInfo(enumPermissionsMod);
             }
             else
             {
-                cPDFViewer.Document.UnlockWithPassword(openPassword);
+                this.viewContentViewModel.SecurityInfo.NeedPermissionsPassword = false;
+                viewContentViewModel.SecurityInfo.PermissionsPassword = null;
+                viewContentViewModel.SecurityInfo.CPDFPermissionsInfo = CreateDefaultPermissionsInfo();
             }
-            viewContentViewModel.PDFViewer.UndoManager.CanSave = true;
             RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.OK));
         }
 
+        //public void Encrypt()
+        //{
+
+        //    string openPassword = "";
+        //    string permissionsPassword = "";
+
+        //    CPDFPermissionsInfo permissionsInfo = null;
+
+        //    if (NeedOpenPassword)
+        //    {
+        //        if (!string.IsNullOrEmpty(OpenPassword))
+        //        {
+        //            openPassword = OpenPassword;
+        //        }
+        //    }
+        //    if (NeedPermissionsPassword && (!string.IsNullOrEmpty(PermissionsPassword)))
+        //    {
+        //        permissionsPassword = PermissionsPassword;
+        //        permissionsInfo = CreatePermissionsInfo(enumPermissionsMod);
+        //    }
+        //    else
+        //    {
+        //        permissionsInfo = CreateDefaultPermissionsInfo();
+        //    }
+
+        //    System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
+        //    /*
+        //     *设置这个对话框的起始保存路径
+        //     */
+        //    sfd.InitialDirectory = cPDFViewer.Document.FilePath;
+        //    /*
+        //     *设置保存的文件的类型,注意过滤器的语法 例子:“文件类型|*.后缀名;*.后缀名;”
+        //     */
+        //    sfd.Filter = "PDF|*.pdf;";
+        //    /*
+        //     *调用ShowDialog()方法显示该对话框,该方法的返回值代表用户是否点击了确定按钮
+        //     */
+        //    sfd.FileName = cPDFViewer.Document.FileName + "_EncryptedFile.pdf";
+        //    /*
+        //     * 做一些工作
+        //     */
+        //    if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+        //    {
+        //        cPDFViewer.Document.Encrypt(openPassword, permissionsPassword, permissionsInfo);
+        //        cPDFViewer.Document.WriteToFilePath(sfd.FileName);
+        //        MessageBoxEx.Show("保存成功");
+        //        RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.OK));
+        //    }
+        //    else
+        //    {
+        //    }
+        //}
+
 
         public void CancelEncrypt() => RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
 

+ 155 - 5
PDF Office/ViewModels/FillAndSign/FillAndSignContentViewModel.cs

@@ -28,6 +28,12 @@ using Control = System.Windows.Controls.Control;
 using Microsoft.Office.Interop.Word;
 using Point = System.Windows.Point;
 using System.Windows.Ink;
+using PDF_Office.EventAggregators;
+using System.Management.Instrumentation;
+using Prism.Events;
+using System.Windows.Input;
+using ContextMenu = System.Windows.Controls.ContextMenu;
+using MenuItem = System.Windows.Controls.MenuItem;
 
 namespace PDF_Office.ViewModels.FillAndSign
 {
@@ -38,9 +44,17 @@ namespace PDF_Office.ViewModels.FillAndSign
         private AnnotPropertyPanel propertyPanel = new AnnotPropertyPanel();
         private ViewContentViewModel viewContentViewModel;
         private bool isRightMenuAddAnnot = false;
+        private IEventAggregator events;
         public List<List<Point>> ShapePoints = new List<List<Point>>();
         private string Shape = "HookShape";
-
+        private PopMenu HightAnnotPopMenu;
+        private PopMenu FreeHandAnnotPopMenu;
+        private PopMenu FreeTextAnnotPopMenu;
+        private PopMenu StrickNoteAnnotPopMenu;
+        private PopMenu ShapeAnnotPopMenu;
+        private PopMenu LinkAnnotPopMenu;
+        private PopMenu StampAnnotPopMenu;
+        private PopMenu MultiAnnotPopMenu;
         private IRegionManager regions { get; set; }
         private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
         public static bool IsEdit = false;
@@ -58,13 +72,14 @@ namespace PDF_Office.ViewModels.FillAndSign
         public Dictionary<string, string> btnToProperty = new Dictionary<string, string>();
         #endregion
 
-        public FillAndSignContentViewModel(IRegionManager regionManager)
+        public FillAndSignContentViewModel(IRegionManager regionManager, IEventAggregator events)
         {
             regions = regionManager;
-
+            this.events = events;
             CheckCommand = new DelegateCommand<RoutedEventArgs>(CheckedEvent);
             ToolExpandDict.Add("Freetext", AnnotArgsType.AnnotFreeText);
             InitDictionary();
+            InitSelectFreeHandAnnotMenu();
         }
 
         private void CheckedEvent(RoutedEventArgs e)
@@ -439,18 +454,20 @@ namespace PDF_Office.ViewModels.FillAndSign
         private void AddToPropertyPanel(string viewContent, string toolTag = null, List<AnnotHandlerEventArgs> annots = null, Dictionary<AnnotAttrib, object> annotAttribsList = null, AnnotAttribEvent annotAttribEvent = null, bool isUpData = false)
         {
 
-            if (annots != null)
+            if (annots != null&& annots.Count!=0)
             {
                 propertyPanel.annotlists = annots;
                 propertyPanel.annot = annots[0];
+
             }
             else
             {
                 propertyPanel.annotlists = null;
                 propertyPanel.annot = null;
+                return;
             }
 
-            if (annotAttribsList != null)
+            if (annotAttribsList != null && annotAttribsList.Count != 0)
             {
                 if (annots.Count > 1)
                 {
@@ -511,6 +528,43 @@ namespace PDF_Office.ViewModels.FillAndSign
 
         }
 
+        /// <summary>
+        /// 手绘
+        /// </summary>
+        private void InitSelectFreeHandAnnotMenu()
+        {
+            var popMenu = new ContextMenu();
+            PopMenu pop = new PopMenu(popMenu);
+            var menuItem = new MenuItem();
+            menuItem.Name = "FreeHandCopy";
+            menuItem.Header = "复制";
+            pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
+
+            menuItem = new MenuItem();
+            menuItem.Name = "FreeHandCut";
+            menuItem.Header = "剪切";
+            pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
+
+            menuItem = new MenuItem();
+            menuItem.Name = "FreeHandPaste";
+            menuItem.Header = "粘贴";
+            pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
+
+            menuItem = new MenuItem();
+            menuItem.Name = "FreeHandDelete";
+            menuItem.Header = "删除";
+            pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
+            pop.AddItem(GetSeparator());
+            FreeHandAnnotPopMenu = pop;
+        }
+        private Separator GetSeparator()
+        {
+            Separator separator = new Separator();
+            separator.Height = 1;
+            separator.BorderBrush = new SolidColorBrush(Color.FromArgb(0x33, 0x00, 0x00, 0x00));
+            separator.BorderThickness = new Thickness(1);
+            return separator;
+        }
         private void BindingPDFViewerHandler()
         {
             //来自PDFViewer的响应事件
@@ -520,6 +574,9 @@ namespace PDF_Office.ViewModels.FillAndSign
 
                 PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
                 PDFViewer.AnnotActiveHandler += PDFViewer_AnnotActiveHandler;
+
+                PDFViewer.AnnotCommandHandler -= PDFViewer_AnnotCommandHandler;
+                PDFViewer.AnnotCommandHandler += PDFViewer_AnnotCommandHandler;
                 PDFViewer.AnnotEditHandler -= PDFViewer_AnnotEditHandler;
                 PDFViewer.AnnotEditHandler += PDFViewer_AnnotEditHandler;
             }
@@ -530,8 +587,101 @@ namespace PDF_Office.ViewModels.FillAndSign
             {
                 PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
                 PDFViewer.AnnotEditHandler -= PDFViewer_AnnotEditHandler;
+                PDFViewer.AnnotCommandHandler -= PDFViewer_AnnotCommandHandler;
             }
         }
+        //在注释工具的状态下,右键菜单
+        private void PDFViewer_AnnotCommandHandler(object sender, AnnotCommandArgs e)
+        {
+            if (e.AnnotEventArgsList == null || (PDFViewer != null && PDFViewer.MouseMode == MouseModes.FormEditTool))
+                return;
+
+            switch (e.CommandType)
+            {
+                case CommandType.Context:
+                    if (e.AnnotEventArgsList.Count > 0)
+                    {
+                        if (App.mainWindowViewModel.SelectedItem.IsInReadctonMode && e.AnnotEventArgsList[0].EventType == AnnotArgsType.AnnotRedaction)
+                        {
+                            //绑定标记密文处右键菜单
+                            events.GetEvent<RedactionCommandEvent>().Publish(new RedactionCommandEventArgs() { UniCode = App.mainWindowViewModel.SelectedItem.Unicode, Sender = sender, args = e });
+                        }
+                        else
+                        {
+                            if (e.AnnotEventArgsList.Count == 1)
+                            {
+                                var selectedAnnot = e.AnnotEventArgsList[0];
+                                switch (selectedAnnot.EventType)
+                                {
+                                  
+
+                                    case AnnotArgsType.AnnotFreehand:
+                                        e.PopupMenu = FreeHandAnnotPopMenu.OpenMenu(selectedAnnot, sender);
+                                        break;
+
+                                }
+                            }
+                            else
+                            {
+                                bool isHigh = true;//是否为高亮
+                                foreach (var item in e.AnnotEventArgsList)
+                                {
+                                    if (isHightAnnot(item) == false)
+                                    {
+                                        isHigh = false;
+                                        break;
+                                    }
+                                }
+
+                                MultiAnnotPopMenu.SetVisual("MultiCopy", !isHigh);
+                                MultiAnnotPopMenu.SetVisual("MultiCut", !isHigh);
+                                e.PopupMenu = MultiAnnotPopMenu.OpenMenu(e.AnnotEventArgsList, sender);//SelectMultiAnnotMenu(e.AnnotEventArgsList, isHigh);
+                            }
+                        }
+                        if (e.PopupMenu != null)
+                        {
+                            e.Handle = true;
+                        }
+                    }
+                    else
+                    {
+                        if (e.PressOnSelectedText || e.CommandTarget == TargetType.ImageSelection)
+                        {
+          
+                            if (e.PopupMenu != null)
+                            {
+                                e.Handle = true;
+                            }
+                        }
+                        else
+                        {
+                          
+                            if (e.PopupMenu != null)
+                            {
+                                e.Handle = true;
+                            }
+                        }
+                    }
+
+                    break;
+            }
+        }
+        private bool isHightAnnot(AnnotHandlerEventArgs annot)
+        {
+            if (annot.EventType == AnnotArgsType.AnnotUnderline ||
+                annot.EventType == AnnotArgsType.AnnotSquiggly ||
+                annot.EventType == AnnotArgsType.AnnotHighlight ||
+                annot.EventType == AnnotArgsType.AnnotStrikeout
+                )
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
         private void PDFViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
         {
             if (e != null && e.Count > 0)

+ 45 - 6
PDF Office/ViewModels/HomePanel/RecentFiles/RecentFilesContentViewModel.cs

@@ -167,10 +167,30 @@ namespace PDF_Office.ViewModels.HomePanel.RecentFiles
             var openFileInfo = obj as OpenFileInfo;
             if (openFileInfo != null)
             {
-                AlertsMessage alertsMessage = new AlertsMessage();
-                alertsMessage.HaveCheckBoxShow("提示", "删除文件", "不再提示", "取消", "OK");
+                bool needDelete = false;
+                //判断是否需要执行删除操作
+                if (!Settings.Default.AppProperties.DontTipBeforeDeleteRecent)
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                    alertsMessage.HaveCheckBoxShow("提示", "删除文件", "不再提示", "取消", "OK");
+                    if(alertsMessage.result == ContentResult.Ok)
+                    {
+                        needDelete = true;
+                        //已经勾选 下次不再提示
+                        Settings.Default.AppProperties.DontTipBeforeDeleteRecent = alertsMessage.isChecked;
+                        Settings.Default.Save();
+                    }
+                    else
+                    {
+                        needDelete = false;
+                    }
+                }
+                else
+                {
+                    needDelete = true;
+                }
 
-                if (alertsMessage.result == ContentResult.Ok)
+                if (needDelete)
                 {
                     SettingHelper.RemoveRecentOpenFile(openFileInfo.FilePath);
                     RecentFilesGroup.Remove(openFileInfo);
@@ -216,9 +236,28 @@ namespace PDF_Office.ViewModels.HomePanel.RecentFiles
                     SelectedItemsType = 2;
                 }
 
-                AlertsMessage alertsMessage = new AlertsMessage();
-                alertsMessage.HaveCheckBoxShow("提示", msg,"不再提示", "取消", "OK");
-                if (alertsMessage.result == ContentResult.Ok)
+                bool needDelete = false;
+                if (!Settings.Default.AppProperties.DontTipBeforeDeleteRecent)
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                    alertsMessage.HaveCheckBoxShow("提示", msg, "不再提示", "取消", "OK");
+                    if (alertsMessage.result == ContentResult.Ok)
+                    {
+                        needDelete = true;
+                        Settings.Default.AppProperties.DontTipBeforeDeleteRecent = alertsMessage.isChecked;
+                        Settings.Default.Save();
+                    }
+                    else
+                    {
+                        needDelete = false;
+                    }
+                }
+                else
+                {
+                    needDelete = true;
+                }
+
+                if (needDelete)
                 {
                     RemoveRecentFilesFrom(SelectedItemsType, openFileInfo);
                 }

+ 18 - 2
PDF Office/ViewModels/PropertyPanel/AnnotPanel/SharpsAnnotPropertyViewModel.cs

@@ -77,6 +77,16 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
+        private bool _isLineAnnot = false;
+        public bool IsLineAnnot
+        {
+            get { return _isLineAnnot; }
+            set
+            {
+                SetProperty(ref _isLineAnnot, value);
+            }
+        }
+
         private void UpdateDash(AnnotAttribEvent attribEvent)
         {
             if (Dash.Dashes != null && Dash.Dashes.Count > 0)
@@ -163,6 +173,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     rectPath.Rect = new Rect(0, 5, 28, 22);
                     DataPath = rectPath;
                     changeData[AnnotArgsType.AnnotSquare] = tag;
+                    IsLineAnnot = false;
                     break;
 
                 case "Circle":
@@ -172,6 +183,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     circlePath.Center = new Point(14, 14);
                     DataPath = circlePath;
                     changeData[AnnotArgsType.AnnotCircle] = tag;
+                    IsLineAnnot = false;
                     break;
 
                 case "Arrow":
@@ -185,6 +197,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                         arrowLine.EndSharp = C_LINE_TYPE.LINETYPE_ARROW;
                         DataPath = arrowLine.BuildArrowBody();
                         changeData[AnnotArgsType.AnnotLine] = tag;
+                        IsLineAnnot = true;
                         //  changeData[AnnotArgsType.AnnotLine] = tag;
                     }
 
@@ -197,6 +210,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                         arrowLine.LineEnd = new Point(32, 0);
                         DataPath = arrowLine.BuildArrowBody();
                         changeData[AnnotArgsType.AnnotLine] = tag;
+                        IsLineAnnot = true;
                     }
                    
                     break;
@@ -515,6 +529,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                             Dash = Square.LineDash;
                             SharpsType("Rect",true);
                             BasicVm.AnnotTypeTitle = "矩形";
+                            IsLineAnnot = false;
                         }
                         break;
 
@@ -530,6 +545,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                             Dash = Circle.LineDash;
                             SharpsType("Circle", true);
                             BasicVm.AnnotTypeTitle = "圆";
+                            IsLineAnnot = false;
                         }
                         break;
 
@@ -554,9 +570,9 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                                 SharpsType("Line", true);
                                 BasicVm.AnnotTypeTitle = "线条";
                             }
-                               
 
-                           
+                            IsLineAnnot = true;
+
                         }
 
                         break;

+ 3 - 9
PDF Office/ViewModels/TipContent/FileRestrictedTipViewModel.cs

@@ -6,14 +6,7 @@ using Prism.Commands;
 using Prism.Events;
 using Prism.Mvvm;
 using Prism.Regions;
-using Prism.Services.Dialogs;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using static Dropbox.Api.Files.ThumbnailMode;
+using Prism.Services.Dialogs; 
 using static PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs.DeleteSafetySettintgsModel;
 
 namespace PDF_Office.ViewModels.TipContent
@@ -50,7 +43,8 @@ namespace PDF_Office.ViewModels.TipContent
                 if (result.Password != null)
                 {
                     string filePath = PDFViewer.Document.FilePath;
-                    PDFViewer.ReloadDocument();
+                    PDFViewer.Document.Release();
+                    PDFViewer.InitDocument(filePath);
                     PDFViewer.Document.UnlockWithPassword(result.Password);
                 }
                 ///TODO:

+ 82 - 15
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -29,6 +29,7 @@ using System.Windows.Controls;
 using System.Windows.Forms;
 using System.Windows.Input;
 using System.Windows.Media;
+using System.Windows.Media.Imaging;
 using static Dropbox.Api.Sharing.ListFileMembersIndividualResult;
 using ContextMenu = System.Windows.Controls.ContextMenu;
 using HorizontalAlignment = System.Windows.HorizontalAlignment;
@@ -1046,6 +1047,7 @@ namespace PDF_Office.ViewModels.Tools
                         var color = (annot as TextHighlightAnnotArgs).Color;
                         Settings.Default.AppProperties.Annotate.HighLightColor = color;
                         HighLightColor = new SolidColorBrush(color);
+
                     }
                     else if (annot is TextUnderlineAnnotArgs)
                     {
@@ -1067,8 +1069,10 @@ namespace PDF_Office.ViewModels.Tools
                     }
                     else if (annot is FreeTextAnnotArgs)
                     {
-                        var color = (annot as FreeTextAnnotArgs).FontColor;
-                        Settings.Default.AppProperties.Annotate.TextAnnoteColor = color;
+                        var freeText = annot as FreeTextAnnotArgs;
+                        Settings.Default.AppProperties.Annotate.TextAnnoteColor = freeText.FontColor;
+                        Settings.Default.AppProperties.Annotate.TextFontFamaily = freeText.FontFamily.ToString();
+                        Settings.Default.AppProperties.Annotate.TextAlign = freeText.Align;
                     }
                     else if (annot is StickyAnnotArgs)
                     {
@@ -1182,11 +1186,28 @@ namespace PDF_Office.ViewModels.Tools
         }
 
         //手绘
-
         private void FreeHandLineStyle_Menu(object obj)
         {
-            if (obj != null)
+
+            if (obj as CusMenuItem != null)
             {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as FreehandAnnotArgs;
+                if (annot != null)
+                {
+                    var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
+                    if(menu.tag.ToString() == "Solid")
+                    {
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, AnnotPropertyPanel.GetLineDashStyle(true));
+                    }
+                    else
+                    {
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, AnnotPropertyPanel.GetLineDashStyle(false));
+                    }
+
+                    AnnotEvent?.UpdateAnnot();
+
+                }
 
             }
         }
@@ -1195,8 +1216,17 @@ namespace PDF_Office.ViewModels.Tools
 
         private void FreeTextFontFamily_Menu(object obj)
         {
-            if (obj != null)
+
+            if (obj as CusMenuItem != null)
             {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
+                if (annot != null)
+                {
+                    var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
+                    AnnotEvent?.UpdateAttrib(AnnotAttrib.FontFamily, new FontFamily(menu.tag.ToString()));
+                    AnnotEvent?.UpdateAnnot();
+                }
 
             }
         }
@@ -1236,8 +1266,20 @@ namespace PDF_Office.ViewModels.Tools
 
         private void StrikeNoteEditStrike_Menu(object obj)
         {
-            if (obj != null)
+            if (obj as CusMenuItem != null)
             {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
+                if (annot != null)
+                {
+                    List<AnnotHandlerEventArgs> list = new List<AnnotHandlerEventArgs>();
+                    list.Add(annot);
+                    GetStickyNote(list);
+                    annot.Author = Settings.Default.AppProperties.Description.Author;
+                    PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                    PDFViewer.SetToolParam(annot);
+                    isRightMenuAddAnnot = false;
+                }
 
             }
         }
@@ -1297,19 +1339,44 @@ namespace PDF_Office.ViewModels.Tools
             
         }
 
-        private void ShapeDefaultValues_Menu(object obj)
-        {
-            if (obj != null)
-            {
-
-            }
-        }
-
         //图章
         private void StampExportPicture_Menu(object obj)
         {
-            if (obj != null)
+            if (obj as CusMenuItem != null)
             {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as StampAnnotArgs;
+                if (annot != null)
+                {
+                    Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
+                    var format = menu.tag.ToString();
+                    if (format == "PDF")
+                        dlg.Filter = "PDF|*.pdf";
+                    else
+                        dlg.Filter = format + "|*." + format.ToLower();
+
+                    dlg.DefaultExt = "." + menu.tag.ToString().ToLower();
+                    dlg.FileName = PDFViewer.Document.FileName;
+                    if (dlg.ShowDialog() == true)
+                    {
+                        var stampPicture = dlg.FileName;
+                        if(menu.tag.ToString() == "PDF")
+                        {
+
+                        }
+                        else
+                        {
+                            var writeStamp = annot.GetStampDrawing();
+                            using (FileStream stream5 = new FileStream(stampPicture, FileMode.Create))
+                            {
+                                PngBitmapEncoder encoder5 = new PngBitmapEncoder();
+                                encoder5.Frames.Add(BitmapFrame.Create(writeStamp));
+                                encoder5.Save(stream5);
+                            }
+                        }
+                        
+                    }
+                }
 
             }
         }

+ 1 - 2
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Layout.cs

@@ -601,8 +601,7 @@ namespace PDF_Office.ViewModels.Tools
             menuItem = new MenuItem();
             menuItem.Name = "StrickNoteEdit";
             menuItem.Header = "编辑便签";
-            pop.AddItem(menuItem);
-
+            pop.BindingEvent(pop.AddItem(menuItem), StrikeNoteEditStrike_MenuCommand);
             menuItem = new MenuItem();
             menuItem.Name = "StrickNoteDefault";
             menuItem.Header = "设置当前属性为默认值";

+ 29 - 20
PDF Office/ViewModels/Tools/ToolsBarContentViewModel.cs

@@ -106,7 +106,8 @@ namespace PDF_Office.ViewModels.Tools
         {
             DialogParameters value = new DialogParameters();
             value.Add(ParameterNames.PDFViewer, PDFViewer);
-            dialogs.ShowDialog(DialogNames.CompressDialog, value, e => {
+            dialogs.ShowDialog(DialogNames.CompressDialog, value, e =>
+            {
 
                 OnOpened((Prism.Services.Dialogs.DialogResult)e);
             });
@@ -114,9 +115,9 @@ namespace PDF_Office.ViewModels.Tools
 
         private int GetIndex(int pageindex)
         {
-            PageIndex = (pageindex+1).ToString();
+            PageIndex = (pageindex + 1).ToString();
             App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Visible;
-            if (PageIndex == PageNumber) { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed;}
+            if (PageIndex == PageNumber) { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
             return 0;
         }
         private void CompressClear()
@@ -131,8 +132,8 @@ namespace PDF_Office.ViewModels.Tools
             string filepath = "";
             string password = "";
             int compressquality = 45;
-           doc=e.Parameters.GetValue<CPDFDocument>(ParameterNames.PDFDocument);
-            filepath= e.Parameters.GetValue<string>(ParameterNames.FilePath);
+            doc = e.Parameters.GetValue<CPDFDocument>(ParameterNames.PDFDocument);
+            filepath = e.Parameters.GetValue<string>(ParameterNames.FilePath);
             password = e.Parameters.GetValue<string>(ParameterNames.PassWord);
             compressquality = e.Parameters.GetValue<int>("compressDialogModel.CompressQuality");
             if (doc != null)
@@ -160,28 +161,36 @@ namespace PDF_Office.ViewModels.Tools
 
         private void OpenSetPasswordDialog()
         {
-            PDFViewer.ReloadDocument();
-            bool a =  PDFViewer.Document.UnlockWithPassword("321");
-            VerifyPasswordResult result = SecurityHelper.VerifyPasswordByPasswordKind(PDFViewer.Document, EnumPasswordKind.StatusPermissionsPassword, dialogs);
-            if (result.IsDiscryptied)
+            if (!viewContentViewModel.SecurityInfo.IsPasswordChanged)
             {
-                if (result.Password != null)
+                VerifyPasswordResult result = SecurityHelper.VerifyPasswordByPasswordKind(PDFViewer.Document, EnumPasswordKind.StatusPermissionsPassword, dialogs);
+                if (result.IsDiscryptied)
                 {
-                    PDFViewer.ReloadDocument();
-                    PDFViewer.Document.UnlockWithPassword(result.Password);
+                    if (result.Password != null)
+                    {
+                        string filePath = PDFViewer.Document.FilePath;
+                        PDFViewer.Document.Release();
+                        PDFViewer.InitDocument(filePath);
+                        PDFViewer.Document.UnlockWithPassword(result.Password);
+                    }
                 }
-                DialogParameters value = new DialogParameters();
-                value.Add(ParameterNames.PDFViewer,  this.PDFViewer);
-                value.Add(ParameterNames.ViewContentViewModel, viewContentViewModel);
+            }
 
-                dialogs.ShowDialog(DialogNames.SetPasswordDialog, value, e =>
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.PDFViewer, this.PDFViewer);
+            value.Add(ParameterNames.ViewContentViewModel, this.viewContentViewModel);
+            dialogs.ShowDialog(DialogNames.SetPasswordDialog, value, e =>
+            {
+                if (e.Result == ButtonResult.OK)
                 {
-                    if(e.Result == ButtonResult.OK)
+                    SecurityHelper.IsPasswordChanged = true;
+                    if (viewContentViewModel.SecurityInfo.IsPasswordChanged)
                     {
-                        this.eventAggregator.GetEvent<ShowTipEvent>().Publish(new ShowTipEventArgs() { enumTipKind = EnumTipKind.StatusSetPasswordSuccessfully,  Unicode = unicode})  ;
+                        viewContentViewModel.PDFViewer.UndoManager.CanSave = true;
                     }
-                });
-            }
+                    this.eventAggregator.GetEvent<ShowTipEvent>().Publish(new ShowTipEventArgs() { enumTipKind = EnumTipKind.StatusSetPasswordSuccessfully, Unicode = unicode });
+                }
+            });
         }
 
         private void OpenCancelPasswordDialog()

+ 35 - 13
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -3,32 +3,25 @@ using Prism.Commands;
 using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Threading.Tasks;
 using ComPDFKitViewer.PdfViewer;
 using Prism.Regions;
-using DryIoc;
-using System.Diagnostics;
 using Prism.Services.Dialogs;
 using PDF_Office.CustomControl;
 using PDF_Office.Model;
 using System.Windows;
 using System.Windows.Controls;
 using System.IO;
-using PDFSettings;
 using ComPDFKitViewer.AnnotEvent;
 using PDF_Office.ViewModels.Tools;
-using PDF_Office.Views;
 using Prism.Events;
 using PDF_Office.EventAggregators;
-using PDF_Office.Views.EditTools.Background;
-using PDF_Office.Views.Dialog;
 using PDF_Office.Helper;
-using System.Security.Policy;
-using System.Windows.Documents;
 using ComPDFKit.PDFDocument;
 using PDFSettings.Settings;
+using PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs;
+using static PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs.SetPasswordDialogModel;
+
 
 namespace PDF_Office.ViewModels
 {
@@ -78,11 +71,12 @@ namespace PDF_Office.ViewModels
         public string ReadModeRegionName { get; set; }
 
         public string ConverterBarContentRegionName { get; set; }
+
         public string TextEditContentRegionName { get; set; }
 
         public string BackgroundContentRegionName { get; set; }
 
-        public List<Point>FillAndSign=new List<Point>();
+        public List<Point> FillAndSign = new List<Point>();
 
         /// <summary>
         /// 文档的密码
@@ -434,6 +428,8 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        public SecurityInfo SecurityInfo = new SecurityInfo();
+
         private Dictionary<string, string> regionNameByTabItem;
 
         private Dictionary<string, string> barContentByTabItem;
@@ -620,7 +616,7 @@ namespace PDF_Office.ViewModels
                 region.RequestNavigate(LeftTipContentRegionName, "FileRestrictedTip", param);
             }
         }
-        public void ShowSelectedTip(ShowTipEventArgs showTipEventArgs)  
+        public void ShowSelectedTip(ShowTipEventArgs showTipEventArgs)
         {
             switch (showTipEventArgs.enumTipKind)
             {
@@ -1000,7 +996,7 @@ namespace PDF_Office.ViewModels
             if (pdfview != null)
             {
                 PDFViewer = pdfview;
-                if(pdfview.Tag!=null)
+                if (pdfview.Tag != null)
                 {
                     //保存密码
                     PassWord = pdfview.Tag.ToString();
@@ -1152,6 +1148,32 @@ namespace PDF_Office.ViewModels
                         return false;
                 }
 
+                if (SecurityInfo.IsPasswordChanged)
+                {
+                    string currentFilePath = PDFViewer.Document.FilePath;
+                    string tempFilePath = PDFViewer.Document.FilePath + ".temp.pdf";
+                    string openPassword = null;
+                    string permissionsPassword = null;
+                    CPDFPermissionsInfo cPDFPermissionsInfo = CreateDefaultPermissionsInfo();
+                    if (SecurityInfo.NeedOpenPassword)
+                    {
+                        openPassword = SecurityInfo.OpenPassword;
+                    }
+
+                    if (SecurityInfo.NeedPermissionsPassword)
+                    {
+                        permissionsPassword = SecurityInfo.PermissionsPassword;
+                        cPDFPermissionsInfo = SecurityInfo.CPDFPermissionsInfo;
+                    }
+                    PDFViewer.Document.Encrypt(openPassword, permissionsPassword, cPDFPermissionsInfo);
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                    alertsMessage.ShowDialog("", "文件安全设置已修改,需要另存为", "Cancel", "OK");
+                    if (alertsMessage.result == ContentResult.Ok)
+                        return saveAsFile();
+                    else
+                        return false;
+                }
+
                 bool result = PDFViewer.Document.WriteToLoadedPath();
                 if (result)
                 {

File diff suppressed because it is too large
+ 187 - 32
PDF Office/Views/BOTA/SearchContent.xaml


+ 55 - 4
PDF Office/Views/BOTA/SearchContent.xaml.cs

@@ -30,7 +30,8 @@ namespace PDF_Office.Views.BOTA
         {
             InitializeComponent();
         }
-
+        List<string> HistorySearchText = new List<string>();
+        const int MaxHistoryCount = 10;
         private void TextBox_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.Key==Key.Enter)
@@ -41,6 +42,13 @@ namespace PDF_Office.Views.BOTA
                     return;
                 }
                 (DataContext as SearchContentViewModel).SearchText(text.Text);
+                 HistorySearchText.Remove(text.Text);
+                if (HistorySearchText.Count >= MaxHistoryCount)
+                {
+                    HistorySearchText.RemoveAt(0);
+                }
+                HistorySearchText.Add(text.Text);
+                UpDataItem();
             }
         }
 
@@ -49,9 +57,9 @@ namespace PDF_Office.Views.BOTA
         /// </summary>
         private void BtnExptend_Click(object sender, RoutedEventArgs e)
         {
-            var btn = sender as CustomIconToggleBtn;
+            var btn = sender as PathButton;
             if (btn == null) return;
-
+            btn.IsChecked = !btn.IsChecked;
 
             var item = (sender as FrameworkElement).DataContext as CollectionViewGroup;
             if (item != null)
@@ -99,9 +107,52 @@ namespace PDF_Office.Views.BOTA
             ContextSearchText.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
             ContextSearchText.IsOpen = true;
         }
+        private void UpDataItem()
+        {
+            foreach (var item in ContextSearchText.Items)
+            {
+                if (item is MenuItem)
+                {
+                    (item as MenuItem).Click -= SearchContent_Click;
+                }
+            }
+            ContextSearchText.Items.Clear();
+            ContextSearchText.Items.Add(IgnoreItem);
+            ContextSearchText.Items.Add(IgnoreSeparator);
+
+            foreach (var item in HistorySearchText)
+            {
+                MenuItem Searchitem = new MenuItem();
+                Searchitem.Height = 32;
+                Searchitem.Header = item;
+
+                Searchitem.Padding = new Thickness(0, 7, 0, 7);
+
+                Searchitem.Click += SearchContent_Click;
+                ContextSearchText.Items.Add(Searchitem);
+            }
+
+            if (HistorySearchText.Count>0)
+            {
+                ContextSearchText.Items.Add(ClearSeparator);
+                ContextSearchText.Items.Add(ClearItem);
+            }
+        }
+
+        private void SearchContent_Click(object sender, RoutedEventArgs e)
+        {
+            MenuItem item = sender as MenuItem;
+            if (item != null)
+            {
+                SearchText.Text = item.Header.ToString();
+                (DataContext as SearchContentViewModel).SearchText(SearchText.Text);
+            }
+        }
 
-        private void MenuItem_Click(object sender, RoutedEventArgs e)
+        private void ClearItem_Click(object sender, RoutedEventArgs e)
         {
+            HistorySearchText.Clear();
+            UpDataItem();
         }
     }
 }

+ 117 - 46
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialog.xaml

@@ -14,6 +14,72 @@
              mc:Ignorable="d">
     <UserControl.Resources>
         <ResourceDictionary>
+            <Style x:Key="HeadStyle" TargetType="{x:Type GridViewColumnHeader}">
+                <Setter Property="OverridesDefaultStyle" Value="False" />
+                <Setter Property="TextBlock.HorizontalAlignment" Value="Left"/>
+                <Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
+                <Setter Property="Height" Value=" 32"/>
+                <Setter Property="Width" Value="Auto"/>
+                <Setter Property="TextBlock.FontFamily" Value="Segoe UI"></Setter>
+                <Setter Property="Template">
+                    <Setter.Value>
+                        <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
+                            <Grid Name="g" Background="#FFFFFF">
+                                <Border Name="bd" Padding="{TemplateBinding Padding}">
+                                    <ContentPresenter Margin="5,4,1,3" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
+                                </Border>
+                            </Grid>
+                            <ControlTemplate.Triggers>
+                                <Trigger Property="IsMouseOver" Value="True">
+                                    <Setter TargetName="g" Property="Background">
+                                        <Setter.Value>
+                                            <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
+                                                <GradientStop Offset="0.3" Color="#CED0D4" />
+                                            </LinearGradientBrush>
+                                        </Setter.Value>
+                                    </Setter>
+                                </Trigger>
+
+                            </ControlTemplate.Triggers>
+                        </ControlTemplate>
+                    </Setter.Value>
+                </Setter>
+            </Style>
+            <!--  ListViewItem的样式  -->
+            <Style x:Key="listitem1" TargetType="{x:Type ListViewItem}">
+                <Style.Setters>
+                    <Setter Property="SnapsToDevicePixels" Value="True" />
+                    <Setter Property="Template">
+                        <Setter.Value>
+                            <ControlTemplate TargetType="{x:Type ListViewItem}">
+                                <Border
+                                x:Name="bd"
+                                Padding="{TemplateBinding Padding}"
+                                SnapsToDevicePixels="True">
+                                    <GridViewRowPresenter
+                                    Margin="3"
+                                    Columns="{TemplateBinding GridView.ColumnCollection}"
+                                    Content="{TemplateBinding Content}" />
+                                </Border>
+                                <ControlTemplate.Triggers>
+                                    <Trigger Property="IsSelected" Value="True">
+                                        <Trigger.Setters>
+                                            <Setter TargetName="bd" Property="Background">
+                                                <Setter.Value>
+                                                    <LinearGradientBrush StartPoint="0.5,0.22" EndPoint="0.5,1">
+                                                        <GradientStop Offset="0.31" Color="LightGray" />
+                                                        <GradientStop Offset="0.88" Color="Gray" />
+                                                    </LinearGradientBrush>
+                                                </Setter.Value>
+                                            </Setter>
+                                        </Trigger.Setters>
+                                    </Trigger>
+                                </ControlTemplate.Triggers>
+                            </ControlTemplate>
+                        </Setter.Value>
+                    </Setter>
+                </Style.Setters>
+            </Style>
             <convert:UnVisivleConvert x:Key="unVisibleConvert"/>
         </ResourceDictionary>
     </UserControl.Resources>
@@ -35,51 +101,56 @@
                   DragLeave="MainPage_DragLeave"
                   >
                 <!--<Label Name="DropGrid" Background="#18A0FB" Opacity="0.5" Panel.ZIndex="1" Visibility="Collapsed"/>-->
-            <Button Name="BtnBlank"  Background="Green" Height="480" Width="632" Visibility="{Binding AddFileVisibility}" Command="{Binding ADDPictureCommand}">
-            </Button>
-            <ListView x:Name="listView" DataContext="{Binding ImagesDataTable}"  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>
-                                    <StackPanel Orientation="Horizontal">
+                <Button Name="BtnBlank"  Background="Green" Height="480" Width="632" Visibility="{Binding AddFileVisibility}" Command="{Binding ADDPictureCommand}">
+                </Button>
+                <ListView x:Name="listView"  DataContext="{Binding ImagesDataTable}"   Background="White"   ItemsSource="{Binding}" SelectionChanged="listView_SelectionChanged" BorderThickness="1,0,1,1" 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  ColumnHeaderContainerStyle="{StaticResource HeadStyle}">
+                            <GridViewColumn  Header="文档名"  Width="400" DisplayMemberBinding="{Binding FileName}">
+                            </GridViewColumn>
+                                <GridViewColumn Header="大小" Width="100" DisplayMemberBinding="{Binding FileSize}"/>
+                            <GridViewColumn Header="状态" Width="82" >
+                                <GridViewColumn.CellTemplate>
+                                    <DataTemplate>
+                                        <StackPanel Orientation="Horizontal">
                                             <cus:BatchStatus StatusValue="{Binding FileState,Mode=TwoWay}" Width="16" Height="16" MaxStatusValue="{Binding MaxPageRange,Mode=TwoWay}"/>
-                                            <Button Name="DeleteTemplateBtn" Width="14" Height="14" Content="X" Foreground="Red" FontSize="8" VerticalAlignment="Center" Margin="38,0,0,0" Click="DeleteTemplateBtn_Click">
-                                        </Button>
-                                    </StackPanel>
-                                    <DataTemplate.Triggers>
-                                        <DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource FindAncestor, AncestorType=ListViewItem}}" Value="True">
-                                            <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Visible"/>
-                                        </DataTrigger>
-                                        <DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource FindAncestor, AncestorType=ListViewItem}}" Value="False">
-                                            <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Hidden"/>
-                                        </DataTrigger>
-                                    </DataTemplate.Triggers>
-                                </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>
+                                            <Button Name="DeleteTemplateBtn" Width="17" Height="17"  Margin="39,0,0,0" Click="DeleteTemplateBtn_Click" Style="{StaticResource btn.sec}">
+                                                <Grid Width="14" Height="14">
+                                                    <Path Data ="M7 14C10.866 14 14 10.866 14 7C14 3.13401 10.866 0 7 0C3.13401 0 0 3.13401 0 7C0 10.866 3.13401 14 7 14ZM10.5303 4.53038L8.06069 7L10.5303 9.46962L9.46967 10.5303L7.00002 8.06066L4.53033 10.5303L3.46967 9.46967L5.93936 7L3.46967 4.53033L4.53033 3.46967L7.00002 5.93934L9.46967 3.46971L10.5303 4.53038Z" Fill="#CED0D4" Stretch="Fill"/>
+                                                </Grid>
+                                            </Button>
+                                        </StackPanel>
+                                        <DataTemplate.Triggers>
+                                            <DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource FindAncestor, AncestorType=ListViewItem}}" Value="True">
+                                                <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Visible"/>
+                                            </DataTrigger>
+                                            <DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource FindAncestor, AncestorType=ListViewItem}}" Value="False">
+                                                <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Hidden"/>
+                                            </DataTrigger>
+                                        </DataTemplate.Triggers>
+                                    </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 Grid.Row="1">
                 <Button x:Name="MenuBtn"  Width="113"
@@ -153,7 +224,7 @@
                     </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 Width="32" Command="{Binding SelectFileCommand}" IsEnabled="{Binding ElementName=SelectFileNameRadioButton,Path=IsChecked}" Style="{StaticResource btn.sec}">
 
                         </Button>
                     </StackPanel>
@@ -178,5 +249,5 @@
             </Grid>
         </Grid>
     </Grid>
-       
+
 </UserControl>

File diff suppressed because it is too large
+ 105 - 26
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialog.xaml


+ 58 - 6
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDocumentContent.xaml

@@ -3,8 +3,62 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:prism="http://prismlibrary.com/" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
              prism:ViewModelLocator.AutoWireViewModel="True" >
+    <UserControl.Resources>
+        <Style TargetType="Button" x:Key="PrePageBtnStyle">
+            <Setter Property="Height" Value="24"></Setter>
+            <Setter Property="Width" Value="24"></Setter>
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type Button}">
+                        <Grid  x:Name="UserfulRegion">
+                            <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1" CornerRadius="4" >
+                                <Grid>
+                                    <Rectangle Width="24" Height="24" Fill="Transparent"></Rectangle>
+                                    <Path x:Name="Path" Fill="{StaticResource color.icon.base.neutral.norm.lv1}" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M3.11071 4.24945L5.43035 1.9298L4.36969 0.869141L0.769719 4.46912C0.476825 4.76201 0.476826 5.23688 0.769719 5.52978L4.36969 9.12975L5.43035 8.06909L3.11071 5.74945H14.5V4.24945H3.11071Z"></Path>
+                                </Grid>
+                            </Border>
+                        </Grid>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style TargetType="Button" x:Key="NextPageBtnStyle">
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type Button}">
+                        <Grid  x:Name="UserfulRegion">
+                            <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1" CornerRadius="4" >
+                                <Grid>
+                                    
+                                <Rectangle Width="24" Height="24" Fill="Transparent"></Rectangle>
+                                <Path x:Name="Path" Fill="{StaticResource color.icon.base.neutral.norm.lv1}" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M11.8893 4.24992L0.5 4.24992V5.74992L11.8893 5.74992L9.56967 8.06958L10.6303 9.13024L14.2303 5.53026C14.5232 5.23737 14.5232 4.7625 14.2303 4.4696L10.6303 0.869629L9.56967 1.93029L11.8893 4.24992Z"></Path>
+                                </Grid>
+
+                            </Border>
+                        </Grid>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+        <Style TargetType="TextBox" x:Key="PageTxtStyle">
+            <Setter Property="Height" Value="24"></Setter>
+            <Setter Property="Width" Value="57"></Setter>
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="TextBox">
+                        <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1" Background="{StaticResource color.field.bg.def}" CornerRadius="4">
+                                    <ScrollViewer x:Name="PART_ContentHost" Focusable="false"
+                                                  HorizontalScrollBarVisibility="Hidden" 
+                                                  VerticalScrollBarVisibility="Hidden"
+                                                  VerticalAlignment="Center" MinHeight="20"/>
+                            </Border>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </UserControl.Resources>
     <Grid  Height="356" Width="212">
-        <Border Height="356" Width="212"  Background="#F7F8FA" HorizontalAlignment="Center" VerticalAlignment="Top">
+        <Border Height="356" Width="212"  Background="{StaticResource color.sys.layout.mg}" HorizontalAlignment="Center" VerticalAlignment="Top" CornerRadius="8">
             <Grid>
                 <Grid.RowDefinitions>
                     <RowDefinition Height="52"></RowDefinition>
@@ -29,10 +83,9 @@
                 </Border>
                 <Grid Grid.Row="2">
                     <StackPanel Orientation="Horizontal"   HorizontalAlignment="Center" VerticalAlignment="Center">
-                        <Button Name="PrePageBtn"   Width="20" Height="20" HorizontalAlignment="Left" FontSize="16" Background="WhiteSmoke" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Command="{Binding TurnPageCommand}" CommandParameter="{Binding ElementName=PrePageBtn}">
-                            <TextBlock Text="&lt;" VerticalAlignment="Center"></TextBlock>
+                        <Button Name="PrePageBtn" Tag="PrePage" Style="{StaticResource PrePageBtnStyle}" Height="24" Width="24"  HorizontalAlignment="Left" FontSize="16" Background="WhiteSmoke" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Command="{Binding TurnPageCommand}" CommandParameter="{Binding ElementName=PrePageBtn}">
                         </Button>
-                        <TextBox x:Name="CurrentPageIndexTxt" Width="30" Height="25" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10,0,5,0" Text="{Binding TargetPaperIndex, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"  >
+                        <TextBox x:Name="CurrentPageIndexTxt" Style="{StaticResource PageTxtStyle}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10,0,5,0" Text="{Binding TargetPaperIndex, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"  >
                             <i:Interaction.Triggers>
                                 <i:EventTrigger x:Name="PropertyChanged">
                                     <i:InvokeCommandAction Command="{Binding JumpPageCommand}" CommandParameter="{Binding ElementName=CurrentPageIndexTxt}"></i:InvokeCommandAction>
@@ -41,8 +94,7 @@
                         </TextBox>
                         <TextBlock  Text="of"  HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" FontFamily="Segoe UI" FontSize="14"></TextBlock>
                         <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Text="{Binding PrintedPageCount}"></TextBlock>
-                        <Button Name="NextPageBtn"  Width="20" Height="20" HorizontalAlignment="Left" FontSize="16"  Background="WhiteSmoke"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Command="{Binding TurnPageCommand}" CommandParameter="{Binding ElementName=NextPageBtn}">
-                            <TextBlock Text=">" VerticalAlignment="Center"></TextBlock>
+                        <Button Name="NextPageBtn"  Tag="NextPage" Style="{StaticResource NextPageBtnStyle}"  Height="24" Width="24"  HorizontalAlignment="Left" FontSize="16"  Background="WhiteSmoke"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Command="{Binding TurnPageCommand}" CommandParameter="{Binding ElementName=NextPageBtn}">
                         </Button>
                     </StackPanel>
                 </Grid>

+ 2 - 2
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModBookletContent.xaml

@@ -26,13 +26,13 @@
                 </StackPanel>
                 <StackPanel Grid.Row="1" Orientation="Horizontal">
                     <TextBlock Text="Sheets from:" FontFamily="Segoe UI" FontSize="14"  Width="94" Margin="0,0,16,0"   VerticalAlignment="Center" ></TextBlock>
-                    <TextBox Name="PaperFromTxt" Height="32" Width="50"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Text="{Binding PaperFrom,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
+                    <TextBox    Style="{StaticResource Print_normalTxtStyle}" Name="PaperFromTxt" Height="32" Width="50"  VerticalContentAlignment="Center" Text="{Binding PaperFrom,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
                         <TextBox.InputBindings>
                             <KeyBinding Command="{Binding SetSheetCommand}"  CommandParameter="{Binding ElementName=PaperFromTxt}"  Key="Return"></KeyBinding>
                         </TextBox.InputBindings>
                     </TextBox>
                     <TextBlock FontFamily="Segoe UI" FontSize="14" Text="to"  VerticalAlignment="Center" Margin="8,0,8,0" ></TextBlock>
-                    <TextBox Name="PaperToTxt" Height="32" Width="50"   HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Text="{Binding PaperTo,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
+                    <TextBox   Style="{StaticResource Print_normalTxtStyle}" Name="PaperToTxt" Height="32" Width="50"  VerticalContentAlignment="Center" Text="{Binding PaperTo,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
                         <TextBox.InputBindings>
                             <KeyBinding Command="{Binding SetSheetCommand}"  CommandParameter="{Binding ElementName=PaperToTxt}"  Key="Return"></KeyBinding>
                         </TextBox.InputBindings>

+ 3 - 3
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModMultipleContent.xaml

@@ -33,14 +33,14 @@
                         </i:Interaction.Triggers>
                     </ComboBox>
                     <StackPanel Grid.Row="0" Orientation="Horizontal" IsEnabled="{Binding EnableCustomiseMatrix,UpdateSourceTrigger=PropertyChanged, Mode=OneWay}">
-                        <TextBox Height="32" Width="53" Margin="16,0,8,0" Text="{Binding HorizontalPageNumber, UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}">
+                        <TextBox   Style="{StaticResource Print_normalTxtStyle}" VerticalContentAlignment="Center" Height="32" Width="53" Margin="16,0,8,0" Text="{Binding HorizontalPageNumber, UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}">
                             <TextBox.InputBindings>
                                 <KeyBinding  Command="{Binding SetCustomMatrixCommand}" Key="Return"></KeyBinding>
                             </TextBox.InputBindings>
 
                         </TextBox>
-                        <TextBlock Text="X" VerticalAlignment="Center"></TextBlock>
-                        <TextBox Height="32" Width="53"  Margin="8,0,0,0" Text="{Binding  VerticalPageNumber, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
+                        <TextBlock Text="X" VerticalAlignment="Center" Foreground="{StaticResource color.sys.text.neutral.lv3}"></TextBlock>
+                        <TextBox   Style="{StaticResource Print_normalTxtStyle}" VerticalContentAlignment="Center" Height="32" Width="53"  Margin="8,0,0,0" Text="{Binding  VerticalPageNumber, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
                             <TextBox.InputBindings>
                                 <KeyBinding  Command="{Binding SetCustomMatrixCommand}" Key="Return"></KeyBinding>
                             </TextBox.InputBindings>

+ 26 - 28
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModPosterContent.xaml

@@ -8,6 +8,24 @@
              d:DesignHeight="180"
              d:DesignWidth="466"
              prism:ViewModelLocator.AutoWireViewModel="True">
+    <UserControl.Resources>
+        <Style x:Key="LabelTxtStyle" TargetType="TextBox">
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate>
+                        <Grid Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
+                            <Border BorderBrush="{StaticResource color.field.border.dis}" Background="{StaticResource color.field.bg.dis}" CornerRadius="4">
+                                <Grid>
+                                    <TextBlock Text="{Binding DefaultLabel, Mode=OneWay}" Grid.Column="1" VerticalAlignment="Center" Foreground="#BBB"
+                                           Name="markText" Visibility="Visible" FontSize="14" Margin="8,0,0,0" FontFamily="Segoe UI"/>
+                                </Grid>
+                            </Border>
+                        </Grid>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </UserControl.Resources>
     <Border Background="#F7F8FA" CornerRadius="4"  Height="188">
         <Grid VerticalAlignment="Top">
             <Grid.RowDefinitions>
@@ -31,8 +49,8 @@
 
                 <StackPanel Orientation="Horizontal" Visibility="{Binding PageRangeSettingVisibility, Mode=TwoWay}" Margin="8,8,0,0">
                     <TextBlock Text="Page range:" VerticalAlignment="Center" FontSize="14" Width="80"></TextBlock>
-                    <cus:NumericUpDown x:Name="CustomRatioUpDown" Loaded="CustomRatioUpDown_Loaded" Width="90" Height="32" Margin="16,0,16,0" Text="{Binding TileRatio, Mode=TwoWay}" IsEnabled="{Binding ElementName=CustomRatioBtn, Path=IsChecked}" Minimum="20" Maximum="400"></cus:NumericUpDown>
-                    <TextBlock Text="%" VerticalAlignment="Center" FontSize="14"></TextBlock>
+                    <cus:NumericUpDown x:Name="CustomRatioUpDown" Loaded="CustomRatioUpDown_Loaded" Width="90" Height="32" Margin="16,0,16,0" Text="{Binding TileRatio, Mode=TwoWay}" IsEnabled="{Binding ElementName=CustomRatioBtn, Path=IsChecked}" Minimum="1" Maximum="400"></cus:NumericUpDown>
+                    <TextBlock Text="%" VerticalAlignment="Center" FontSize="14"  FontFamily="Segoe UI" Foreground="{StaticResource color.sys.text.neutral.lv3}"></TextBlock>
                 </StackPanel>
                 <StackPanel Orientation="Horizontal" Visibility="{Binding PagesPerSheetVisibility , Mode=TwoWay}"  Margin="8,8,0,0">
                     <TextBlock Text="Pages per sheet:" VerticalAlignment="Center" FontFamily="Segoe UI" FontSize="14" ></TextBlock>
@@ -44,13 +62,13 @@
                         </i:Interaction.Triggers>
                     </ComboBox>
                     <StackPanel Orientation="Horizontal" IsEnabled="{Binding EnableCustomSheet, Mode=TwoWay}">
-                        <TextBox Height="32" Width="48" Text="{Binding HorizontalSheetNumber}">
+                        <TextBox  Style="{StaticResource Print_normalTxtStyle}" Height="32" Width="48" VerticalContentAlignment="Center" Text="{Binding HorizontalSheetNumber}">
                             <TextBox.InputBindings>
                                 <KeyBinding Command="{Binding SetCustomSheetCommand}" Key="Return"></KeyBinding>
                             </TextBox.InputBindings>
                         </TextBox>
-                        <TextBlock Text="x" VerticalAlignment="Center" Margin="8,0,8,0"></TextBlock>
-                        <TextBox  Height="32" Width="48" Text="{Binding VerticalSheetNumber}">
+                        <TextBlock  Text="x" VerticalAlignment="Center" Margin="8,0,8,0"></TextBlock>
+                        <TextBox  Style="{StaticResource Print_normalTxtStyle}" Height="32" Width="48" VerticalContentAlignment="Center" Text="{Binding VerticalSheetNumber}">
                             <TextBox.InputBindings>
                                 <KeyBinding Command="{Binding SetCustomSheetCommand}" Key="Return"></KeyBinding>
                             </TextBox.InputBindings>
@@ -61,12 +79,12 @@
             <Grid Grid.Row="2"  Margin="8,8,0,0">
                 <StackPanel Orientation="Horizontal" >
                     <TextBlock Text="Overlap:" VerticalAlignment="Center" FontSize="14" Width="80"></TextBlock>
-                    <TextBox Height="32" Width="88" Margin="16,0,16,0" Text="{Binding OverlapNumber,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
+                    <TextBox Style="{StaticResource Print_normalTxtStyle}" VerticalContentAlignment="Center" Height="32" Width="88" Margin="16,0,16,0" Text="{Binding OverlapNumber,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
                         <TextBox.InputBindings>
                             <KeyBinding Command="{Binding SetOverlapCommand}" Key="Return"></KeyBinding>
                         </TextBox.InputBindings>
                     </TextBox>
-                    <TextBlock Text="mm" VerticalAlignment="Center" FontSize="14"></TextBlock>
+                    <TextBlock Text="mm" VerticalAlignment="Center" FontSize="14" FontFamily="Segoe UI" Foreground="{StaticResource color.sys.text.neutral.lv3}"></TextBlock>
                 </StackPanel>
             </Grid>
             <Grid Grid.Row="3"  Margin="8,8,0,0">
@@ -79,27 +97,7 @@
                 <StackPanel Orientation="Horizontal">
                     <CheckBox  Name="SetLabelChk" Margin="0,0,11,0" VerticalAlignment="Center" Command="{Binding SetLabelCommand}" CommandParameter="{Binding ElementName=SetLabelChk}"></CheckBox>
                     <TextBlock Text="Label" VerticalAlignment="Center" Margin="0,0,16,0" FontSize="14"></TextBlock>
-                    <TextBox Height="32" Width="361" Text="{Binding LabelString, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" IsEnabled="{Binding ElementName=SetLabelChk, Path=IsChecked}" IsReadOnly="True">
-                        <TextBox.Resources>
-                            <VisualBrush x:Key="HelpBrush" TileMode ="None" Opacity="0.3" Stretch="None" AlignmentX="Left">
-                                <VisualBrush.Visual>
-                                    <TextBlock Text="{Binding DefaultLabel, Mode=OneWay}"></TextBlock>
-                                </VisualBrush.Visual>
-                            </VisualBrush>
-                        </TextBox.Resources>
-                        <TextBox.Style>
-                            <Style TargetType="TextBox">
-                                <Style.Triggers>
-                                    <Trigger Property="Text" Value="{x:Null}">
-                                        <Setter Property="Background" Value="{StaticResource HelpBrush}"></Setter>
-                                    </Trigger>
-                                    <Trigger Property="Text" Value="">
-                                        <Setter Property="Background" Value="{StaticResource HelpBrush}"></Setter>
-                                    </Trigger>
-                                </Style.Triggers>
-                            </Style>
-                        </TextBox.Style>
-                    </TextBox>
+                    <TextBox Style="{StaticResource LabelTxtStyle}" Height="32" Width="361" Text="{Binding LabelString, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" IsEnabled="{Binding ElementName=SetLabelChk, Path=IsChecked}" IsReadOnly="True"></TextBox>
                 </StackPanel>
             </Grid>
         </Grid>

+ 7 - 20
PDF Office/Views/Dialog/SettingsDialog.xaml

@@ -114,7 +114,7 @@
             </Style>
         </ResourceDictionary>
     </UserControl.Resources>
-    <Grid>
+    <Grid Background="{StaticResource color.sys.layout.mg}">
         <Grid.RowDefinitions>
             <RowDefinition Height="40" />
             <RowDefinition />
@@ -123,7 +123,6 @@
             Grid.Row="1"
             BorderThickness="0"
             SelectedIndex="{Binding ModeSelectedIndex, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}"
-            Style="{StaticResource InfoTabControl}"
             TabStripPlacement="Left">
             <TabItem x:Name="TabItemGeneral" Style="{StaticResource InfoTabItem}">
                 <TabItem.Header>
@@ -310,14 +309,7 @@
                                         Width="348"
                                         Height="30"
                                         ItemsSource="{Binding PageViewList}"
-                                        SelectedIndex="{Binding PageViewSelctedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
-                                        <!--<ComboBoxItem Content="单页" Foreground="{StaticResource color.field.text.act}" />
-                                        <ComboBoxItem Content="单页连续" Foreground="{StaticResource color.field.text.act}" />
-                                        <ComboBoxItem Content="双页" Foreground="{StaticResource color.field.text.act}" />
-                                        <ComboBoxItem Content="双页连续" Foreground="{StaticResource color.field.text.act}" />
-                                        <ComboBoxItem Content="书本" Foreground="{StaticResource color.field.text.act}" />
-                                        <ComboBoxItem Content="书本连续" Foreground="{StaticResource color.field.text.act}" />-->
-                                    </ComboBox>
+                                        SelectedIndex="{Binding PageViewSelctedIndex, Mode=TwoWay}" />
                                 </WrapPanel>
                                 <WrapPanel Grid.Row="1" Margin="0,12">
                                     <Label
@@ -328,8 +320,7 @@
                                         Width="348"
                                         Height="30"
                                         ItemsSource="{Binding ZoomModeList}"
-                                        SelectedIndex="{Binding ZoomModeSelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
-                                    </ComboBox>
+                                        SelectedIndex="{Binding ZoomModeSelectedIndex, Mode=TwoWay}" />
                                 </WrapPanel>
                             </Grid>
                         </Border>
@@ -568,10 +559,8 @@
                                 <ComboBox
                                     Width="228"
                                     Height="30"
-                                    SelectedIndex="{Binding AnnoteSelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
-                                    <ComboBoxItem Content="系统字体" Foreground="{StaticResource color.field.text.act}" />
-                                    <ComboBoxItem Content="PingFang" Foreground="{StaticResource color.field.text.act}" />
-                                </ComboBox>
+                                    ItemsSource="{Binding AnnoteFamilyList}"
+                                    SelectedIndex="{Binding AnnoteSelectedIndex}" />
                                 <RadioButton
                                     Name="RbtLeft"
                                     Width="32"
@@ -733,10 +722,8 @@
                                 <ComboBox
                                     Width="228"
                                     Height="30"
-                                    SelectedIndex="{Binding NoteSelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
-                                    <ComboBoxItem Content="系统字体" Foreground="{StaticResource color.field.text.act}" />
-                                    <ComboBoxItem Content="PingFang" Foreground="{StaticResource color.field.text.act}" />
-                                </ComboBox>
+                                    ItemsSource="{Binding AnnoteFamilyList}"
+                                    SelectedIndex="{Binding NoteSelectedIndex, Mode=TwoWay}" />
                             </WrapPanel>
                         </WrapPanel>
                     </StackPanel>

+ 25 - 10
PDF Office/Views/HomeContent.xaml

@@ -8,7 +8,8 @@
     xmlns:homePanel="clr-namespace:PDF_Office.Views.HomePanel"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
-    xmlns:viewmodels="clr-namespace:PDF_Office.ViewModels" d:DataContext="{d:DesignInstance Type=viewmodels:HomeContentViewModel}"
+    xmlns:viewmodels="clr-namespace:PDF_Office.ViewModels"
+    d:DataContext="{d:DesignInstance Type=viewmodels:HomeContentViewModel}"
     d:DesignHeight="450"
     d:DesignWidth="800"
     prism:ViewModelLocator.AutoWireViewModel="True"
@@ -74,17 +75,28 @@
                     Content="Create PDF"
                     FontSize="16"
                     Initialized="BtnCreatPDF_Initialized"
-                    Style="{StaticResource btn.sec}" >
+                    Style="{StaticResource btn.sec}">
                     <Button.ContextMenu>
                         <ContextMenu Name="ContextCreatePDF">
-                            <MenuItem Header="New Blank Page" Command="{Binding CreateBlackPDFCommand}"/>
-                            <MenuItem Header="New From Web Page" Command="{Binding CreateFromHtmlCommnd}"/>
-                            <MenuItem Header="Import From Scanner" Command="{Binding CreateFromScanner}"/>
+                            <MenuItem Command="{Binding CreateBlackPDFCommand}" Header="New Blank Page" />
+                            <MenuItem Command="{Binding CreateFromHtmlCommnd}" Visibility="Collapsed" Header="New From Web Page" />
+                            <MenuItem Command="{Binding CreateFromScanner}" Header="Import From Scanner" />
                         </ContextMenu>
                     </Button.ContextMenu>
                 </Button>
-                <Button Name="BtnExpand" Width="26" Height="32" HorizontalAlignment="Right" Click="BtnExpand_Click"  Margin="4" Style="{StaticResource btn.icon-fill}">
-                    <Path Width="12" Height="12" Data="M6 7.56434L2.03039 3.59473L0.969727 4.65539L5.46967 9.15533C5.76256 9.44822 6.23743 9.44822 6.53033 9.15533L11.0303 4.65539L9.9696 3.59473L6 7.56434Z" Fill="{StaticResource color.icon.arrow.gray.def}"/>
+                <Button
+                    Name="BtnExpand"
+                    Width="26"
+                    Height="32"
+                    Margin="4"
+                    HorizontalAlignment="Right"
+                    Click="BtnExpand_Click"
+                    Style="{StaticResource btn.icon-fill}">
+                    <Path
+                        Width="12"
+                        Height="12"
+                        Data="M6 7.56434L2.03039 3.59473L0.969727 4.65539L5.46967 9.15533C5.76256 9.44822 6.23743 9.44822 6.53033 9.15533L11.0303 4.65539L9.9696 3.59473L6 7.56434Z"
+                        Fill="{StaticResource color.icon.arrow.gray.def}" />
                 </Button>
             </Grid>
 
@@ -98,7 +110,8 @@
                 Command="{Binding ShowToolCommand}"
                 CommandParameter="Guid"
                 Style="{StaticResource ToggleBtnSelectStyle}"
-                Tag="GridMode">
+                Tag="GridMode"
+                Visibility="Collapsed">
                 <StackPanel Margin="8,0,8,0" Orientation="Horizontal">
                     <Path Data="M3.8655 5.79653C3.32363 6.16977 3 6.78565 3 7.44363V15C3 16.1046 3.89543 17 5 17H9V13.1785C9 12.6262 9.44772 12.1785 10 12.1785C10.5523 12.1785 11 12.6262 11 13.1785V17H15C16.1046 17 17 16.1046 17 15V7.44363C17 6.78565 16.6764 6.16977 16.1345 5.79653L11.1345 2.3526C10.4514 1.88206 9.54865 1.88206 8.8655 2.3526L3.8655 5.79653Z" Fill="{Binding ElementName=BtnGuid, Path=Foreground}" />
                     <TextBlock
@@ -120,7 +133,8 @@
                 Command="{Binding ShowToolCommand}"
                 CommandParameter="Tools"
                 Style="{StaticResource ToggleBtnSelectStyle}"
-                Tag="GridMode">
+                Tag="GridMode"
+                Visibility="Collapsed">
                 <StackPanel Margin="8,0,8,0" Orientation="Horizontal">
                     <Path Data="M3.8655 5.79653C3.32363 6.16977 3 6.78565 3 7.44363V15C3 16.1046 3.89543 17 5 17H9V13.1785C9 12.6262 9.44772 12.1785 10 12.1785C10.5523 12.1785 11 12.6262 11 13.1785V17H15C16.1046 17 17 16.1046 17 15V7.44363C17 6.78565 16.6764 6.16977 16.1345 5.79653L11.1345 2.3526C10.4514 1.88206 9.54865 1.88206 8.8655 2.3526L3.8655 5.79653Z" Fill="{Binding ElementName=BtnTool, Path=Foreground}" />
                     <TextBlock
@@ -142,7 +156,8 @@
                 Command="{Binding ShowToolCommand}"
                 CommandParameter="Cloud"
                 Style="{StaticResource ToggleBtnSelectStyle}"
-                Tag="GridMode">
+                Tag="GridMode"
+                Visibility="Collapsed">
                 <StackPanel Margin="8,0,8,0" Orientation="Horizontal">
                     <Path Data="M14.95 16.5H5.5C3.01472 16.5 1 14.4853 1 12C1 9.51472 3.01472 7.5 5.5 7.5L5.52018 7.50004C5.74751 4.9771 7.86787 3 10.45 3C13.1838 3 15.4 5.21619 15.4 7.95C15.4 8.10931 15.3925 8.26686 15.3778 8.42232C17.4134 8.63601 19 10.3577 19 12.45C19 14.6701 17.2137 16.4729 15 16.4997V16.5H14.95Z" Fill="{Binding ElementName=BtnCloud, Path=Foreground}" />
                     <TextBlock

+ 70 - 67
PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml

@@ -2,74 +2,71 @@
     x:Class="PDF_Office.Views.HomePanel.PDFTools.QuickToolsContent"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:converter="clr-namespace:PDF_Office.DataConvert"
+    xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:local="clr-namespace:PDF_Office.Views.HomePanel"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
-    xmlns:converter="clr-namespace:PDF_Office.DataConvert"
     xmlns:pDFTools="clr-namespace:PDF_Office.Views.HomePanel.PDFTools"
-    xmlns:prism ="http://prismlibrary.com/"
-    prism:ViewModelLocator.AutoWireViewModel="True"
+    xmlns:prism="http://prismlibrary.com/"
     d:DesignHeight="450"
     d:DesignWidth="800"
+    prism:ViewModelLocator.AutoWireViewModel="True"
     Loaded="UserControl_Loaded"
     mc:Ignorable="d">
     <UserControl.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
-                <ResourceDictionary Source="../../../Styles/CustomListItemStyle.xaml"/>
+                <ResourceDictionary Source="../../../Styles/CustomListItemStyle.xaml" />
             </ResourceDictionary.MergedDictionaries>
             <converter:BoolToVisible x:Key="BoolToVisibilityConverter" />
-            <converter:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert"/>
-            <Style x:Key="LabelSty"
-               TargetType="{x:Type Label}">
-                <Setter Property="Padding"
-                    Value="10,5" />
-                <Setter Property="Background"
-                    Value="CadetBlue" />
-                <Setter Property="Foreground"
-                    Value="White" />
+            <converter:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert" />
+            <Style x:Key="LabelSty" TargetType="{x:Type Label}">
+                <Setter Property="Padding" Value="10,5" />
+                <Setter Property="Background" Value="CadetBlue" />
+                <Setter Property="Foreground" Value="White" />
             </Style>
 
             <DataTemplate x:Key="DataTemplate">
-                <pDFTools:PDFToolItem x:Name="data" Cursor="Hand"/>
+                <pDFTools:PDFToolItem x:Name="data" Cursor="Hand" />
             </DataTemplate>
 
             <DataTemplate x:Key="ExpendDataTemplate">
-                <pDFTools:PDFToolExpendItem x:Name="Expenddata" Cursor="Hand"/>
+                <pDFTools:PDFToolExpendItem x:Name="Expenddata" Cursor="Hand" />
             </DataTemplate>
 
             <ItemsPanelTemplate x:Key="ListItemsPanelTemplate">
-                <WrapPanel AllowDrop="True"
-                       Orientation="Horizontal" />
+                <WrapPanel AllowDrop="True" Orientation="Horizontal" />
             </ItemsPanelTemplate>
 
-            <Style x:Key="QuickToolsListBoxItemStyle" BasedOn="{StaticResource ListBoxItemStyle}"
-               TargetType="{x:Type customControl:ListItemQuickTool}">
-                <EventSetter Event="PreviewMouseLeftButtonUp"
-                             Handler="QuickTools_Click"/>
+            <Style
+                x:Key="QuickToolsListBoxItemStyle"
+                BasedOn="{StaticResource ListBoxItemStyle}"
+                TargetType="{x:Type customControl:ListItemQuickTool}">
+                <EventSetter Event="PreviewMouseLeftButtonUp" Handler="QuickTools_Click" />
 
             </Style>
 
         </ResourceDictionary>
-        
+
     </UserControl.Resources>
     <Grid Grid.ColumnSpan="2" Margin="0,0,20,0">
         <Grid.RowDefinitions>
-            <RowDefinition Height="Auto"/>
-            <RowDefinition Height="*"/>
+            <RowDefinition Height="Auto" />
+            <RowDefinition Height="*" />
         </Grid.RowDefinitions>
         <TextBlock
-                x:Name="TxbQuickToolsTitle"
-                Margin="0,0,0,16"
-                FontSize="24"
-                FontWeight="SemiBold"
-                Text="Quick Tools" />
+            x:Name="TxbQuickToolsTitle"
+            Margin="0,0,0,16"
+            FontSize="24"
+            FontWeight="SemiBold"
+            Text="Quick Tools" />
 
 
         <StackPanel
-            x:Name="PnlToolsUIBtns" Grid.ColumnSpan="2"
-            Grid.Column="0" 
+            x:Name="PnlToolsUIBtns"
+            Grid.Column="0"
+            Grid.ColumnSpan="2"
             Margin="0,0,12,0"
             HorizontalAlignment="Right"
             VerticalAlignment="Top"
@@ -81,51 +78,57 @@
                 Width="68"
                 Height="28"
                 Margin="0,0,0,0"
-                Content="Tools"
                 Command="{Binding ShowToolCommand}"
-               >
-
-            </Button>
+                Content="Tools"
+                Visibility="Collapsed" />
             <Button
                 x:Name="BtnMore"
                 Width="28"
                 Height="28"
                 Margin="12,0,0,0"
-                 Background="#FFFFFF" BorderThickness="0" Content="..."
-                Command="{Binding OpenMenuCommand}" CommandParameter="{Binding ElementName=BtnMore}"
-               >
-            </Button>
+                Background="#FFFFFF"
+                BorderThickness="0"
+                Command="{Binding OpenMenuCommand}"
+                CommandParameter="{Binding ElementName=BtnMore}"
+                Content="..." />
 
         </StackPanel>
 
         <Grid
-                x:Name="GridAllTools"
-                Grid.Row="1" Height="270"
-                SizeChanged="GridAllTools_SizeChanged">
-
-            <customControl:ListBoxEx x:Name="ListBoxExpendToolBars" HorizontalAlignment="Stretch"  MinWidth="540" 
-                        Grid.Row="3"
-                        AllowDrop="True"
-                        BorderThickness="0" Background="Transparent"
-                        ItemContainerStyle="{StaticResource QuickToolsListBoxItemStyle}"
-                        ItemTemplate="{StaticResource ExpendDataTemplate}"
-                        ItemsPanel="{StaticResource ListItemsPanelTemplate}"
-                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                        SelectionMode="Single" 
-                        Visibility="{Binding IsExpendTools,Converter={StaticResource BoolToVisibilityConverter}}"
-                                     />
-
-            <customControl:ListBoxEx x:Name="ListBoxToolBars" HorizontalAlignment="Stretch"  MinWidth="540" 
-                        Grid.Row="3"
-                        AllowDrop="True"
-                        BorderThickness="0" Background="Transparent"
-                        ItemContainerStyle="{StaticResource QuickToolsListBoxItemStyle}"
-                        ItemTemplate="{StaticResource DataTemplate}"
-                        ItemsPanel="{StaticResource ListItemsPanelTemplate}"
-                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                        SelectionMode="Single" 
-                         Visibility="{Binding IsExpendTools,Converter={StaticResource InvertBoolToVisibleConvert}}"             
-                                     />
+            x:Name="GridAllTools"
+            Grid.Row="1"
+            Height="270"
+            SizeChanged="GridAllTools_SizeChanged">
+
+            <customControl:ListBoxEx
+                x:Name="ListBoxExpendToolBars"
+                Grid.Row="3"
+                MinWidth="540"
+                HorizontalAlignment="Stretch"
+                AllowDrop="True"
+                Background="Transparent"
+                BorderThickness="0"
+                ItemContainerStyle="{StaticResource QuickToolsListBoxItemStyle}"
+                ItemTemplate="{StaticResource ExpendDataTemplate}"
+                ItemsPanel="{StaticResource ListItemsPanelTemplate}"
+                ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                SelectionMode="Single"
+                Visibility="{Binding IsExpendTools, Converter={StaticResource BoolToVisibilityConverter}}" />
+
+            <customControl:ListBoxEx
+                x:Name="ListBoxToolBars"
+                Grid.Row="3"
+                MinWidth="540"
+                HorizontalAlignment="Stretch"
+                AllowDrop="True"
+                Background="Transparent"
+                BorderThickness="0"
+                ItemContainerStyle="{StaticResource QuickToolsListBoxItemStyle}"
+                ItemTemplate="{StaticResource DataTemplate}"
+                ItemsPanel="{StaticResource ListItemsPanelTemplate}"
+                ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                SelectionMode="Single"
+                Visibility="{Binding IsExpendTools, Converter={StaticResource InvertBoolToVisibleConvert}}" />
 
         </Grid>
 

+ 269 - 112
PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml

@@ -1,16 +1,19 @@
-<UserControl x:Class="PDF_Office.Views.HomePanel.RecentFiles.RecentFilesContent"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.RecentFiles"
-             xmlns:customControl ="clr-namespace:PDF_Office.CustomControl"
-             xmlns:DataConvert ="clr-namespace:PDF_Office.DataConvert"
-             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
-             xmlns:prism ="http://prismlibrary.com/"
-             prism:ViewModelLocator.AutoWireViewModel="True"
-             mc:Ignorable="d" Loaded="UserControl_Loaded"
-             d:DesignHeight="450" d:DesignWidth="800">
+<UserControl
+    x:Class="PDF_Office.Views.HomePanel.RecentFiles.RecentFilesContent"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:DataConvert="clr-namespace:PDF_Office.DataConvert"
+    xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+    xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.RecentFiles"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    Loaded="UserControl_Loaded"
+    mc:Ignorable="d">
     <UserControl.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
@@ -24,9 +27,10 @@
             <DataConvert:InvertBoolConvert x:Key="InvertBoolConvert" />
 
             <DataTemplate x:Key="listviewItem">
-                <local:DocItemListViewControl HorizontalAlignment="Stretch"
-                                              OpenFileItemHandler ="DocItemListViewControl_OpenFileItemHandler"
-                                              DeleteItemHandler="DocItemListViewControl_DeleteItemHandler" />
+                <local:DocItemListViewControl
+                    HorizontalAlignment="Stretch"
+                    DeleteItemHandler="DocItemListViewControl_DeleteItemHandler"
+                    OpenFileItemHandler="DocItemListViewControl_OpenFileItemHandler" />
             </DataTemplate>
 
             <DataTemplate x:Key="gridviewItem">
@@ -41,18 +45,23 @@
                 <WrapPanel />
             </ItemsPanelTemplate>
 
-            <ContextMenu x:Key="FlyoutMenu" FontSize="14"
-                         Opened="ContextMenu_Opened">
+            <ContextMenu
+                x:Key="FlyoutMenu"
+                FontSize="14"
+                Opened="ContextMenu_Opened">
                 <ContextMenu.ItemContainerStyle>
                     <Style TargetType="MenuItem">
                         <Setter Property="Padding" Value="0,7,0,7" />
                         <Setter Property="VerticalContentAlignment" Value="Center" />
                     </Style>
                 </ContextMenu.ItemContainerStyle>
-                <MenuItem Name="FilePathMenuItem" Header="打开文件路径" IsEnabled="True" Click="FilePathMenuItem_Click">
+                <MenuItem
+                    Name="FilePathMenuItem"
+                    Click="FilePathMenuItem_Click"
+                    Header="打开文件路径"
+                    IsEnabled="True">
                     <MenuItem.Icon>
-                        <Path Fill="Black"
-                              Data="M5.24031 1.5H0.5V14.5H15.5V4H7.24031L5.24031 1.5ZM1.5 13.5V2.5H4.75969L6.75969 5H14.5V13.5H1.5ZM4 7.5H12V6.5H4V7.5Z">
+                        <Path Data="M5.24031 1.5H0.5V14.5H15.5V4H7.24031L5.24031 1.5ZM1.5 13.5V2.5H4.75969L6.75969 5H14.5V13.5H1.5ZM4 7.5H12V6.5H4V7.5Z" Fill="Black">
                             <Path.RenderTransform>
                                 <TranslateTransform X="3.0000" Y="0" />
                             </Path.RenderTransform>
@@ -60,9 +69,13 @@
                     </MenuItem.Icon>
                 </MenuItem>
 
-                <MenuItem Name="DeleteMenuItem" Header="从最近列表删除" IsEnabled="True" Click="DeleteMenuItem_Click">
+                <MenuItem
+                    Name="DeleteMenuItem"
+                    Click="DeleteMenuItem_Click"
+                    Header="从最近列表删除"
+                    IsEnabled="True">
                     <MenuItem.Icon>
-                        <Path Fill="Black" Data="M9 0H3V2H0V3H1V14H11V3H12V2H9V0ZM2 13V3H3H4H8H9H10V13H2ZM8 2V1H4V2H8ZM4 12V4H3V12H4ZM6.5 4V12H5.5V4H6.5ZM9 12V4H8V12H9Z">
+                        <Path Data="M9 0H3V2H0V3H1V14H11V3H12V2H9V0ZM2 13V3H3H4H8H9H10V13H2ZM8 2V1H4V2H8ZM4 12V4H3V12H4ZM6.5 4V12H5.5V4H6.5ZM9 12V4H8V12H9Z" Fill="Black">
                             <Path.RenderTransform>
                                 <TranslateTransform X="5.0000" Y="0" />
                             </Path.RenderTransform>
@@ -71,24 +84,25 @@
                 </MenuItem>
             </ContextMenu>
 
-            <Style x:Key="SubFilesListViewItemStyle" BasedOn="{StaticResource FilesListViewItemStyle}" TargetType="{x:Type ListViewItem}">
+            <Style
+                x:Key="SubFilesListViewItemStyle"
+                BasedOn="{StaticResource FilesListViewItemStyle}"
+                TargetType="{x:Type ListViewItem}">
                 <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}" />
                 <Setter Property="HorizontalContentAlignment" Value="Center" />
                 <Setter Property="Margin" Value="0,0,0,0" />
-                <EventSetter Event="PreviewMouseRightButtonDown"
-                             Handler="ListViewItem_PreviewMouseRightButtonDown" />
-                <EventSetter Event="PreviewMouseDoubleClick"
-                             Handler="RecentFilesList_PreviewMouseDoubleClick">
-                </EventSetter>
+                <EventSetter Event="PreviewMouseRightButtonDown" Handler="ListViewItem_PreviewMouseRightButtonDown" />
+                <EventSetter Event="PreviewMouseDoubleClick" Handler="RecentFilesList_PreviewMouseDoubleClick" />
             </Style>
 
-            <Style x:Key="HomeGridViewItemStyle" BasedOn="{StaticResource FilesGridItemStyle}" TargetType="{x:Type ListViewItem}">
+            <Style
+                x:Key="HomeGridViewItemStyle"
+                BasedOn="{StaticResource FilesGridItemStyle}"
+                TargetType="{x:Type ListViewItem}">
                 <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}" />
                 <Setter Property="HorizontalContentAlignment" Value="Center" />
-                <EventSetter Event="PreviewMouseRightButtonDown"
-                             Handler="ListViewItem_PreviewMouseRightButtonDown" />
-                <EventSetter Event="PreviewMouseDoubleClick"
-                             Handler="RecentFilesList_PreviewMouseDoubleClick" />
+                <EventSetter Event="PreviewMouseRightButtonDown" Handler="ListViewItem_PreviewMouseRightButtonDown" />
+                <EventSetter Event="PreviewMouseDoubleClick" Handler="RecentFilesList_PreviewMouseDoubleClick" />
             </Style>
         </ResourceDictionary>
     </UserControl.Resources>
@@ -101,31 +115,74 @@
                 <RowDefinition />
             </Grid.RowDefinitions>
             <Grid x:Name="GridRecentFilesTile" Margin="32,38,0,13">
-                <TextBlock x:Name="TxbRecentlyTile" Text="Recent" HorizontalAlignment="Left" FontWeight="Semibold" FontSize="20" Padding="0,6,0,0" Margin="0,0,0,0" />
-                <StackPanel x:Name="PnlRightBtns" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,0,0" Orientation="Horizontal" HorizontalAlignment="Right">
-                    <Border  Background="#EEF2F3" Height="30" CornerRadius="4" Padding="1,0,1,0">
+                <TextBlock
+                    x:Name="TxbRecentlyTile"
+                    Margin="0,0,0,0"
+                    Padding="0,6,0,0"
+                    HorizontalAlignment="Left"
+                    FontSize="20"
+                    FontWeight="Semibold"
+                    Text="Recent" />
+                <StackPanel
+                    x:Name="PnlRightBtns"
+                    Grid.Column="0"
+                    Grid.ColumnSpan="2"
+                    Margin="0,0,0,0"
+                    HorizontalAlignment="Right"
+                    Orientation="Horizontal">
+                    <Border
+                        Height="30"
+                        Padding="1,0,1,0"
+                        Background="#EEF2F3"
+                        CornerRadius="4">
                         <StackPanel Orientation="Horizontal">
-                            <RadioButton x:Name="BtnListMode" GroupName="Mode" Tag="ListMode" Width="40" Height="28" Foreground="#333333"
-                                         HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
-                                         IsChecked="{Binding IsListMode,Mode=OneTime}"
-                                         Style="{StaticResource ListModeRadioBtnStyle}">
-                                <Grid  Margin="-5,0,0,0" HorizontalAlignment="Center">
-                                    <Path Data="M3 5L17 5" Stroke="{Binding ElementName=BtnListMode,Path=Foreground}" StrokeThickness="1.5" StrokeStartLineCap="Round" />
-                                    <Path Data="M3 10H17" Stroke="{Binding ElementName=BtnListMode,Path=Foreground}" StrokeThickness="1.5" StrokeStartLineCap="Round" />
-                                    <Path Data="M3 15H17" Stroke="{Binding ElementName=BtnListMode,Path=Foreground}" StrokeThickness="1.5" StrokeStartLineCap="Round" />
+                            <RadioButton
+                                x:Name="BtnListMode"
+                                Width="40"
+                                Height="28"
+                                HorizontalContentAlignment="Center"
+                                VerticalContentAlignment="Center"
+                                Foreground="#333333"
+                                GroupName="Mode"
+                                IsChecked="{Binding IsListMode, Mode=OneTime}"
+                                Style="{StaticResource ListModeRadioBtnStyle}"
+                                Tag="ListMode">
+                                <Grid Margin="-5,0,0,0" HorizontalAlignment="Center">
+                                    <Path
+                                        Data="M3 5L17 5"
+                                        Stroke="{Binding ElementName=BtnListMode, Path=Foreground}"
+                                        StrokeStartLineCap="Round"
+                                        StrokeThickness="1.5" />
+                                    <Path
+                                        Data="M3 10H17"
+                                        Stroke="{Binding ElementName=BtnListMode, Path=Foreground}"
+                                        StrokeStartLineCap="Round"
+                                        StrokeThickness="1.5" />
+                                    <Path
+                                        Data="M3 15H17"
+                                        Stroke="{Binding ElementName=BtnListMode, Path=Foreground}"
+                                        StrokeStartLineCap="Round"
+                                        StrokeThickness="1.5" />
                                 </Grid>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
-                                        <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnListMode,Path =Tag}" />
+                                        <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnListMode, Path=Tag}" />
                                     </i:EventTrigger>
                                 </i:Interaction.Triggers>
                             </RadioButton>
 
-                            <RadioButton x:Name="BtnGridMode" GroupName="Mode" Tag="GridMode" Width="40" Height="28" Foreground="#6B869C"
-                                         HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
-                                         IsChecked="{Binding IsListMode,Converter={StaticResource InvertBoolConvert},Mode=OneTime}"
-                                         Style="{StaticResource ListModeRadioBtnStyle}">
-                                <Grid  Margin="-5,0,0,0" HorizontalAlignment="Center">
+                            <RadioButton
+                                x:Name="BtnGridMode"
+                                Width="40"
+                                Height="28"
+                                HorizontalContentAlignment="Center"
+                                VerticalContentAlignment="Center"
+                                Foreground="#6B869C"
+                                GroupName="Mode"
+                                IsChecked="{Binding IsListMode, Converter={StaticResource InvertBoolConvert}, Mode=OneTime}"
+                                Style="{StaticResource ListModeRadioBtnStyle}"
+                                Tag="GridMode">
+                                <Grid Margin="-5,0,0,0" HorizontalAlignment="Center">
                                     <Grid.RowDefinitions>
                                         <RowDefinition />
                                         <RowDefinition />
@@ -134,97 +191,197 @@
                                         <ColumnDefinition />
                                         <ColumnDefinition />
                                     </Grid.ColumnDefinitions>
-                                    <Rectangle Grid.Row="0" Grid.Column="0" Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round" />
-                                    <Rectangle Grid.Row="0" Grid.Column="1"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round" />
-                                    <Rectangle Grid.Row="1" Grid.Column="0"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round" />
-                                    <Rectangle Grid.Row="1" Grid.Column="1"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round" />
+                                    <Rectangle
+                                        Grid.Row="0"
+                                        Grid.Column="0"
+                                        Width="5"
+                                        Height="5"
+                                        Margin="1"
+                                        Stroke="{Binding ElementName=BtnGridMode, Path=Foreground}"
+                                        StrokeDashCap="Round"
+                                        StrokeThickness="1.5" />
+                                    <Rectangle
+                                        Grid.Row="0"
+                                        Grid.Column="1"
+                                        Width="5"
+                                        Height="5"
+                                        Margin="1"
+                                        Stroke="{Binding ElementName=BtnGridMode, Path=Foreground}"
+                                        StrokeDashCap="Round"
+                                        StrokeThickness="1.5" />
+                                    <Rectangle
+                                        Grid.Row="1"
+                                        Grid.Column="0"
+                                        Width="5"
+                                        Height="5"
+                                        Margin="1"
+                                        Stroke="{Binding ElementName=BtnGridMode, Path=Foreground}"
+                                        StrokeDashCap="Round"
+                                        StrokeThickness="1.5" />
+                                    <Rectangle
+                                        Grid.Row="1"
+                                        Grid.Column="1"
+                                        Width="5"
+                                        Height="5"
+                                        Margin="1"
+                                        Stroke="{Binding ElementName=BtnGridMode, Path=Foreground}"
+                                        StrokeDashCap="Round"
+                                        StrokeThickness="1.5" />
                                 </Grid>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
-                                        <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnGridMode,Path =Tag}" />
+                                        <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnGridMode, Path=Tag}" />
                                     </i:EventTrigger>
                                 </i:Interaction.Triggers>
                             </RadioButton>
                         </StackPanel>
                     </Border>
 
-                    <Separator  Margin="1 0 1 0" Width="1" Height="16" BorderBrush="#1A000000" BorderThickness="1" />
+                    <Separator
+                        Width="1"
+                        Height="16"
+                        Margin="1,0,1,0"
+                        BorderBrush="#1A000000"
+                        BorderThickness="1" />
 
-                    <Button x:Name="BtnDelete" Margin="0" Padding="0,0,0,0" MaxHeight="40" Width="28" Height="28" Background="Transparent" BorderThickness="0"
-                            IsEnabled="{Binding IsEmpty,Converter={StaticResource InvertBoolConvert},Mode=OneWay}"
-                            Command="{Binding RemoveFilesFromContainerCommand}" CommandParameter="{Binding ElementName=RecentFilesList,Path=SelectedItems}"
-                            Style="{StaticResource OnlyContentBtn}" Foreground="#6B6F7D">
+                    <Button
+                        x:Name="BtnDelete"
+                        Width="28"
+                        Height="28"
+                        MaxHeight="40"
+                        Margin="0"
+                        Padding="0,0,0,0"
+                        Background="Transparent"
+                        BorderThickness="0"
+                        Command="{Binding RemoveFilesFromContainerCommand}"
+                        CommandParameter="{Binding ElementName=RecentFilesList, Path=SelectedItems}"
+                        Foreground="#6B6F7D"
+                        IsEnabled="{Binding IsEmpty, Converter={StaticResource InvertBoolConvert}, Mode=OneWay}"
+                        Style="{StaticResource OnlyContentBtn}">
                         <Grid Width="20" Height="20">
-                            <Path Data="M8 2H12" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round" />
-                            <Path Data="M5 5V17H15V5" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round" />
-                            <Path Data="M17 5H3" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round" />
-                            <Path Data="M10 9V13" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round" />
+                            <Path
+                                Data="M8 2H12"
+                                Stroke="{Binding ElementName=BtnDelete, Path=Foreground}"
+                                StrokeDashCap="Round"
+                                StrokeThickness="2" />
+                            <Path
+                                Data="M5 5V17H15V5"
+                                Stroke="{Binding ElementName=BtnDelete, Path=Foreground}"
+                                StrokeDashCap="Round"
+                                StrokeThickness="2" />
+                            <Path
+                                Data="M17 5H3"
+                                Stroke="{Binding ElementName=BtnDelete, Path=Foreground}"
+                                StrokeDashCap="Round"
+                                StrokeThickness="2" />
+                            <Path
+                                Data="M10 9V13"
+                                Stroke="{Binding ElementName=BtnDelete, Path=Foreground}"
+                                StrokeDashCap="Round"
+                                StrokeThickness="2" />
                         </Grid>
                     </Button>
                 </StackPanel>
             </Grid>
 
-            <Grid  Grid.Row="2" Visibility="{Binding IsEmpty,Converter={StaticResource InvertBoolToVisibleConvert}}">
+            <Grid Grid.Row="2" Visibility="{Binding IsEmpty, Converter={StaticResource InvertBoolToVisibleConvert}}">
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="799*" />
                     <ColumnDefinition Width="*" />
                 </Grid.ColumnDefinitions>
-                <Border Visibility="{Binding IsListMode,Converter={StaticResource BoolToVisible}}">
-                    <ListView x:Name="RecentFilesList"
-                              ItemsSource="{Binding RecentFilesGroup}"
-                              Margin="32,0,0,0"
-                              VirtualizingPanel.IsVirtualizing="True"
-                              VirtualizingPanel.CacheLengthUnit="Page"
-                              VirtualizingPanel.CacheLength="1"
-                              VirtualizingPanel.ScrollUnit="Pixel"
-                              ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                              ScrollViewer.VerticalScrollBarVisibility="Auto"
-                              Background="Transparent" BorderThickness="0"
-                              Padding="0,0,0,0" MinHeight="216" MinWidth="380"
-                              SelectionMode="Multiple"
-                              ItemContainerStyle="{StaticResource SubFilesListViewItemStyle}"
-                              Style="{StaticResource FilesListViewStyle}"
-                              ItemTemplate="{StaticResource listviewItem}"
-                              ItemsPanel="{StaticResource listPanel}" Grid.ColumnSpan="2">
-                    </ListView>
+                <Border Visibility="{Binding IsListMode, Converter={StaticResource BoolToVisible}}">
+                    <ListView
+                        x:Name="RecentFilesList"
+                        Grid.ColumnSpan="2"
+                        MinWidth="380"
+                        MinHeight="216"
+                        Margin="32,0,0,0"
+                        Padding="0,0,0,0"
+                        Background="Transparent"
+                        BorderThickness="0"
+                        ItemContainerStyle="{StaticResource SubFilesListViewItemStyle}"
+                        ItemTemplate="{StaticResource listviewItem}"
+                        ItemsPanel="{StaticResource listPanel}"
+                        ItemsSource="{Binding RecentFilesGroup}"
+                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                        ScrollViewer.VerticalScrollBarVisibility="Auto"
+                        SelectionMode="Extended"
+                        Style="{StaticResource FilesListViewStyle}"
+                        VirtualizingPanel.CacheLength="1"
+                        VirtualizingPanel.CacheLengthUnit="Page"
+                        VirtualizingPanel.IsVirtualizing="True"
+                        VirtualizingPanel.ScrollUnit="Pixel" />
                 </Border>
 
-                <ListView x:Name="GridRecentFilesList"
-                          Visibility="{Binding IsListMode,Converter={StaticResource InvertBoolToVisibleConvert}}"
-                          ItemsSource="{Binding RecentFilesGroup}"
-                          Margin="32,0,0,0"
-                          VirtualizingPanel.IsVirtualizing="True"
-                          VirtualizingPanel.CacheLengthUnit="Page"
-                          VirtualizingPanel.CacheLength="1"
-                          VirtualizingPanel.ScrollUnit="Pixel"
-                          ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                          ScrollViewer.VerticalScrollBarVisibility="Auto"
-                          Background="Transparent" BorderThickness="0"
-                          Padding="0,0,0,0" MinHeight="216" MinWidth="380"
-                          SelectionMode="Multiple"
-                          ItemContainerStyle="{StaticResource HomeGridViewItemStyle}"
-                          Style="{StaticResource FilesGridViewStyle}"
-                          ItemTemplate="{StaticResource gridviewItem}"
-                          ItemsPanel="{StaticResource gridPanel}" Grid.ColumnSpan="2">
-                </ListView>
+                <ListView
+                    x:Name="GridRecentFilesList"
+                    Grid.ColumnSpan="2"
+                    MinWidth="380"
+                    MinHeight="216"
+                    Margin="32,0,0,0"
+                    Padding="0,0,0,0"
+                    Background="Transparent"
+                    BorderThickness="0"
+                    ItemContainerStyle="{StaticResource HomeGridViewItemStyle}"
+                    ItemTemplate="{StaticResource gridviewItem}"
+                    ItemsPanel="{StaticResource gridPanel}"
+                    ItemsSource="{Binding RecentFilesGroup}"
+                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                    ScrollViewer.VerticalScrollBarVisibility="Auto"
+                    SelectionMode="Extended"
+                    Style="{StaticResource FilesGridViewStyle}"
+                    VirtualizingPanel.CacheLength="1"
+                    VirtualizingPanel.CacheLengthUnit="Page"
+                    VirtualizingPanel.IsVirtualizing="True"
+                    VirtualizingPanel.ScrollUnit="Pixel"
+                    Visibility="{Binding IsListMode, Converter={StaticResource InvertBoolToVisibleConvert}}" />
             </Grid>
 
-            <StackPanel x:Name="BlankContentPanel" Grid.Row="1" Grid.RowSpan="2"  HorizontalAlignment="Center" VerticalAlignment="Center"
-                        Visibility="{Binding IsEmpty,Converter={StaticResource BoolToVisible}}">
+            <StackPanel
+                x:Name="BlankContentPanel"
+                Grid.Row="1"
+                Grid.RowSpan="2"
+                HorizontalAlignment="Center"
+                VerticalAlignment="Center"
+                Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisible}}">
 
 
-                <Button x:Name="BtnAddFiles" MaxHeight="128" Width="128" Height="128" Background="Transparent" BorderThickness="0"
-                           
-                            Command="{Binding OpenFilesCommand}" 
-                            Style="{StaticResource OnlyContentBtn}" Foreground="#6B6F7D">
+                <Button
+                    x:Name="BtnAddFiles"
+                    Width="128"
+                    Height="128"
+                    MaxHeight="128"
+                    Background="Transparent"
+                    BorderThickness="0"
+                    Command="{Binding OpenFilesCommand}"
+                    Foreground="#6B6F7D"
+                    Style="{StaticResource OnlyContentBtn}">
                     <Grid Width="128" Height="128">
-                        <Image Source="../../../Resources/HomeIcon/add.png" Width="128" Height="128" Stretch="Uniform" VerticalAlignment="Center" />
+                        <Image
+                            Width="128"
+                            Height="128"
+                            VerticalAlignment="Center"
+                            Source="../../../Resources/HomeIcon/add.png"
+                            Stretch="Uniform" />
                     </Grid>
                 </Button>
 
-                <TextBlock x:Name="NoFilesText" Text="No documents" TextAlignment="Center"  HorizontalAlignment="Center" FontSize="16" LineHeight="22" Foreground="#FF333333" FontFamily="Segoe UI" />
-                <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
-                    <TextBlock x:Name="clickFileText" Text="Drop documents here or click the '" Foreground="#FF999999" VerticalAlignment="Center" FontSize="14" />
+                <TextBlock
+                    x:Name="NoFilesText"
+                    HorizontalAlignment="Center"
+                    FontFamily="Segoe UI"
+                    FontSize="16"
+                    Foreground="#FF333333"
+                    LineHeight="22"
+                    Text="No documents"
+                    TextAlignment="Center" />
+                <StackPanel Margin="0,12,0,0" Orientation="Horizontal">
+                    <TextBlock
+                        x:Name="clickFileText"
+                        VerticalAlignment="Center"
+                        FontSize="14"
+                        Foreground="#FF999999"
+                        Text="Drop documents here or click the '" />
                 </StackPanel>
             </StackPanel>
         </Grid>

+ 1 - 1
PDF Office/Views/PropertyPanel/AnnotPanel/SharpsAnnotProperty.xaml

@@ -201,7 +201,7 @@
                 </Grid>
             </Border>
 
-            <Grid x:Name="GridFill" Margin="0,18,0,0">
+            <Grid x:Name="GridFill" Margin="0,18,0,0" Visibility="{Binding IsLineAnnot,Converter={StaticResource InvertBoolToVisibleConvert}}">
                 <Grid.RowDefinitions>
                     <RowDefinition Height="auto" />
                     <RowDefinition />

+ 5 - 0
PDFSettings/APPSettingProperties.cs

@@ -40,6 +40,11 @@ namespace PDFSettings
         /// </summary>
         public int RecentFileListMode = 0;
 
+        /// <summary>
+        /// 删除最近文件记录时是否显示询问弹窗
+        /// </summary>
+        public bool DontTipBeforeDeleteRecent = false;
+
         /// <summary>
         /// 切换语言时 重启时需要打开的文档列表
         /// </summary>