Sfoglia il codice sorgente

文件列表 - 添加桌机版已有的项目PDFSettings;修复最近列表切换视图模式,数据绑定失败问题

chenrongqian 2 anni fa
parent
commit
20871da3de
35 ha cambiato i file con 1428 aggiunte e 71 eliminazioni
  1. 2 0
      PDF Office/App.config
  2. 4 0
      PDF Office/App.xaml.cs
  3. 283 0
      PDF Office/Helper/SettingHelper.cs
  4. 7 0
      PDF Office/PDF Office.csproj
  5. 11 2
      PDF Office/PDF Office.sln
  6. 33 31
      PDF Office/Properties/Resources.Designer.cs
  7. 11 5
      PDF Office/Properties/Resources.resx
  8. 12 1
      PDF Office/Properties/Settings.Designer.cs
  9. 7 5
      PDF Office/Properties/Settings.settings
  10. 4 4
      PDF Office/Styles/ListViewStyle.xaml
  11. 20 0
      PDF Office/Views/HomePanel/RecentFiles/RecentFilesView.xaml
  12. 39 23
      PDF Office/Views/HomePanel/RecentFiles/RecentFilesView.xaml.cs
  13. 104 0
      PDFSettings/APPSettingProperties.cs
  14. 95 0
      PDFSettings/BatesHeaderFooterList.cs
  15. 30 0
      PDFSettings/CustomStampList.cs
  16. 69 0
      PDFSettings/DefaultAnnotProperty.cs
  17. 47 0
      PDFSettings/DialogCounter.cs
  18. 146 0
      PDFSettings/DpiHelpers.cs
  19. 112 0
      PDFSettings/PDFBackgroundList.cs
  20. 72 0
      PDFSettings/PDFSettings.csproj
  21. 6 0
      PDFSettings/PDFSettings.csproj.user
  22. 55 0
      PDFSettings/ProductActiveInfo.cs
  23. 36 0
      PDFSettings/Properties/AssemblyInfo.cs
  24. 36 0
      PDFSettings/RecentOpenFiles.cs
  25. 38 0
      PDFSettings/RedactionSettings.cs
  26. 20 0
      PDFSettings/SignatureList.cs
  27. 129 0
      PDFSettings/WaterMarkTempleteList.cs
  28. BIN
      PDFSettings/bin/Debug/ComPDFKit.Desk.dll
  29. BIN
      PDFSettings/bin/Debug/ComPDFKit.Viewer.dll
  30. BIN
      PDFSettings/bin/Debug/PDFSettings.dll
  31. BIN
      PDFSettings/bin/Debug/PDFSettings.pdb
  32. BIN
      PDFSettings/bin/Release/ComPDFKit.Desk.dll
  33. BIN
      PDFSettings/bin/Release/ComPDFKit.Viewer.dll
  34. BIN
      PDFSettings/bin/Release/PDFSettings.dll
  35. BIN
      PDFSettings/bin/Release/PDFSettings.pdb

+ 2 - 0
PDF Office/App.config

@@ -1,5 +1,7 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <configuration>
+    <configSections>
+    </configSections>
     <startup> 
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
     </startup>

+ 4 - 0
PDF Office/App.xaml.cs

@@ -21,6 +21,8 @@ using Prism.Ioc;
 using Prism.Regions;
 using PDF_Office.Model;
 using PDF_Office.Views.PageEdit;
+using PDF_Office.Properties;
+using PDFSettings.Settings;
 
 namespace PDF_Office
 {
@@ -48,6 +50,8 @@ namespace PDF_Office
             LicenseVerify();
 
 
+            if (Settings.Default.RecentOpenFiles == null)
+                Settings.Default.RecentOpenFiles = new RecentOpenFiles();
         }
 
         /// <summary>

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

@@ -0,0 +1,283 @@
+using ComPDFKitViewer.AnnotEvent;
+using PDFSettings;
+using PDFSettings.Settings;
+using System;
+using System.Collections.Generic;
+using System.Security.Cryptography;
+using System.Text;
+using System.Dynamic;
+using System.Windows;
+using System.IO;
+using PDF_Office.Properties;
+using PDF_Office;
+
+namespace PDF_Office.Helper
+{
+    public class SettingHelper
+    {
+        public static void SortRecentOpenFiles(string filePath)
+        {
+            if (Settings.Default.RecentOpenFiles == null)
+                Settings.Default.RecentOpenFiles = new RecentOpenFiles();
+
+            OpenFileInfo existFile = null;
+            foreach (var file in Settings.Default.RecentOpenFiles)
+            {
+                if (file.FilePath.ToLower() == filePath.ToLower())
+                {
+                    if(file.FilePath != filePath)
+                    {
+                        file.FilePath = filePath;
+                        file.FileName = filePath.Substring(filePath.LastIndexOf("\\") + 1);
+                    }
+
+                    file.LastOpenTime = DateTime.Now;
+                    existFile = file;
+                    break;
+                }
+            }
+
+            if (existFile != null)
+            {
+                if (Settings.Default.RecentOpenFiles.IndexOf(existFile) != 0)
+                {
+                    Settings.Default.RecentOpenFiles.Remove(existFile);
+                    Settings.Default.RecentOpenFiles.Insert(0, existFile);
+                }
+            }
+            else
+            {
+                OpenFileInfo fileInfo = new OpenFileInfo();
+                fileInfo.FileName = filePath.Substring(filePath.LastIndexOf("\\") + 1);
+                fileInfo.FilePath = filePath;
+                fileInfo.ThumbImgPath = "";
+                fileInfo.LastOpenTime = DateTime.Now;
+                PDF_Office.Properties.Settings.Default.RecentOpenFiles.Insert(0, fileInfo);
+            }
+            Settings.Default.Save();
+        }
+
+        public static void RemoveRecentOpenFile(string filePath)
+        {
+            if (Settings.Default.RecentOpenFiles == null || Settings.Default.RecentOpenFiles.Count == 0)
+                return;
+               
+            OpenFileInfo deleteItem = null;
+            foreach(var item in Settings.Default.RecentOpenFiles)
+            {
+                if (item.FilePath.ToLower() == filePath.ToLower())
+                {
+                    deleteItem = item;
+                    break;
+                }
+            }
+
+            if(deleteItem!=null)
+            {
+                DeleteByPath(deleteItem.ThumbImgPath);
+                Settings.Default.RecentOpenFiles.Remove(deleteItem);
+                Settings.Default.Save();
+            }
+        }
+
+        public static void DeleteByPath(string path)
+        {
+            try
+            {
+                if (!string.IsNullOrEmpty(path) && System.IO.File.Exists(path))
+                    System.IO.File.Delete(path);
+            }
+            catch { }
+        }
+
+        public static void RemoveAllRecentOpenFiles()
+        {
+            //if (Settings.Default.RecentOpenFiles == null || Settings.Default.RecentOpenFiles.Count == 0)
+            //    return;
+
+            //string folderPath =System.IO.Path.Combine(App.CurrentPath, "CoverImage");
+            //DirectoryInfo directoryInfo = new DirectoryInfo(folderPath);
+            //if(directoryInfo.Exists)
+            //{
+            //    var files = directoryInfo.GetFiles();
+            //    foreach(var file in files)
+            //    {
+            //        if (file.Exists)
+            //            file.Delete();
+            //    }
+            //}
+
+            //Settings.Default.RecentOpenFiles.Clear();
+            //Settings.Default.Save();
+        }
+
+        public static OpenFileInfo GetFileInfo(string filePath)
+        {
+            if (Settings.Default.RecentOpenFiles == null || Settings.Default.RecentOpenFiles.Count == 0)
+                return null;
+
+            foreach(var info in Settings.Default.RecentOpenFiles)
+            {
+                if (info.FilePath == filePath)
+                    return info;
+            }
+            return null;
+        }
+
+        public static void SetFileInfo(OpenFileInfo openFileInfo)
+        {
+            try
+            {
+                if (Settings.Default.RecentOpenFiles == null || Settings.Default.RecentOpenFiles.Count == 0 || openFileInfo == null)
+                    return;
+
+                for (int i = 0; i < Settings.Default.RecentOpenFiles.Count; i++)
+                {
+                    if (Settings.Default.RecentOpenFiles[i].FilePath == openFileInfo.FilePath)
+                    {
+                        Settings.Default.RecentOpenFiles[i] = openFileInfo;
+                        Settings.Default.Save();//保存时有可能会文件被占用
+                        return;
+                    }
+                }
+            }
+            catch { }
+        }
+
+        public static DefaultAnnotProperty GetAnnotDefaultProperty(AnnotArgsType annotToolType,string saveKey="")
+        {
+            //if (Settings.Default.DefautAnnotProperties != null)
+            //{
+            //    if(saveKey=="")
+            //    {
+            //        return Settings.Default.DefautAnnotProperties.GetAnnotProperty(annotToolType);
+            //    }
+            //    return Settings.Default.DefautAnnotProperties.GetAnnotProperty(annotToolType,saveKey);
+            //}
+            return null;
+        }
+
+        public static void SetAnnotDefaultProperty(DefaultAnnotProperty annotProperty)
+        {
+            //if (Settings.Default.DefautAnnotProperties == null)
+            //{
+            //    Settings.Default.DefautAnnotProperties = new DefaultAnnotProperties();
+            //}
+            //Settings.Default.DefautAnnotProperties.SetAnnotProperty(annotProperty);
+            //Settings.Default.Save();
+        }
+        private static string KeyAlaphabet = "0123456789ABCDEFGHIGKLMNOPQRSTUVWXYZ";
+        public static char NumberToChar(int num)
+        {
+            if (num >= 0 && num <= 35)
+            {
+                return KeyAlaphabet[num];
+            }
+            throw new ArgumentException("Wrong num value.", "ch");
+        }
+        /// <summary>
+        /// AES加密
+        /// </summary>
+        /// <param name="text">加密字符</param>
+        /// <param name="password">加密的密码</param>
+        /// <returns></returns>
+        public static string AESEncrypt(string text, string password)
+        {
+            RijndaelManaged rijndaelCipher = new RijndaelManaged();
+            rijndaelCipher.Mode = CipherMode.CBC;
+            rijndaelCipher.Padding = PaddingMode.PKCS7;
+            rijndaelCipher.KeySize = 128;
+            rijndaelCipher.BlockSize = 128;
+            byte[] pwdBytes = Encoding.UTF8.GetBytes(password);
+            byte[] keyBytes = new byte[16];
+            int len = pwdBytes.Length;
+            if (len > keyBytes.Length) len = keyBytes.Length;
+            Array.Copy(pwdBytes, keyBytes, len);
+            rijndaelCipher.Key = keyBytes;
+            rijndaelCipher.IV = new byte[16];
+            ICryptoTransform transform = rijndaelCipher.CreateEncryptor();
+            byte[] plainText = Encoding.UTF8.GetBytes(text);
+            byte[] cipherBytes = transform.TransformFinalBlock(plainText, 0, plainText.Length);
+            return Convert.ToBase64String(cipherBytes);
+        }
+        /// <summary>
+        /// AES解密
+        /// </summary>
+        /// <param name="text"></param>
+        /// <param name="password"></param>
+        /// <returns></returns>
+        public static string AESDecrypt(string text, string password)
+        {
+            RijndaelManaged rijndaelCipher = new RijndaelManaged();
+            rijndaelCipher.Mode = CipherMode.CBC;
+            rijndaelCipher.Padding = PaddingMode.PKCS7;
+            rijndaelCipher.KeySize = 128;
+            rijndaelCipher.BlockSize = 128;
+            byte[] encryptedData = Convert.FromBase64String(text);
+            byte[] pwdBytes = Encoding.UTF8.GetBytes(password);
+            byte[] keyBytes = new byte[16];
+            int len = pwdBytes.Length;
+            if (len > keyBytes.Length) len = keyBytes.Length;
+            Array.Copy(pwdBytes, keyBytes, len);
+            rijndaelCipher.Key = keyBytes;
+            rijndaelCipher.IV = new byte[16];
+            ICryptoTransform transform = rijndaelCipher.CreateDecryptor();
+            byte[] plainText = transform.TransformFinalBlock(encryptedData, 0, encryptedData.Length);
+            return Encoding.UTF8.GetString(plainText);
+        }
+
+        public static ProductActiveInfo GetProductActiveInfo()
+        {
+            //if (Settings.Default.ProductActiveStore != null)
+            //{
+            //    ProductActiveInfo activeInfo = new ProductActiveInfo();
+            //    ProductActiveStore storeInfo= Settings.Default.ProductActiveStore;
+            //    Random random = new Random((int)storeInfo.UpdateTime.Ticks);
+            //    StringBuilder keyBuilder = new StringBuilder();
+            //    for (int i = 0; i < 16; i++)
+            //    {
+            //        keyBuilder.Append(NumberToChar(random.Next(0, 35)));
+            //    }
+            //    string checkData = AESEncrypt(storeInfo.SignData, keyBuilder.ToString());
+            //    MD5 mD5 = MD5.Create();
+            //    byte[] hashCode = mD5.ComputeHash(Encoding.UTF8.GetBytes(checkData));
+            //    StringBuilder checkBuilder = new StringBuilder();
+            //    foreach (byte code in hashCode)
+            //    {
+            //        checkBuilder.Append(code.ToString("X2"));
+            //    }
+            //    if (checkBuilder.ToString() == storeInfo.CheckSum)
+            //    {
+            //        string decryptData = AESDecrypt(storeInfo.SignData, keyBuilder.ToString());
+            //        activeInfo = JsonConvert.DeserializeObject<ProductActiveInfo>(decryptData);
+            //    }
+            //    return activeInfo;
+            //}
+            return null;
+        }
+        public static void SetProductActiveStore(ProductActiveInfo activeInfo)
+        {
+            //ProductActiveStore activeStore = new ProductActiveStore();
+            //activeStore.UpdateTime = DateTime.Now;
+            //string rawData = JsonConvert.SerializeObject(activeInfo);
+            //Random random = new Random((int)activeStore.UpdateTime.Ticks);
+            //StringBuilder keyBuilder = new StringBuilder();
+            //for (int i = 0; i < 16; i++)
+            //{
+            //    keyBuilder.Append(NumberToChar(random.Next(0, 35)));
+            //}
+            //activeStore.SignData = AESEncrypt(rawData, keyBuilder.ToString());
+            //string checkData = AESEncrypt(activeStore.SignData, keyBuilder.ToString());
+            //MD5 mD5 = MD5.Create();
+            //byte[] hashCode = mD5.ComputeHash(Encoding.UTF8.GetBytes(checkData));
+            //StringBuilder checkBuilder = new StringBuilder();
+            //foreach(byte code in hashCode)
+            //{
+            //    checkBuilder.Append(code.ToString("X2"));
+            //}
+            //activeStore.CheckSum = checkBuilder.ToString();
+            //Settings.Default.ProductActiveStore = activeStore;
+            //Settings.Default.Save();
+        }
+    }
+}

+ 7 - 0
PDF Office/PDF Office.csproj

@@ -117,6 +117,7 @@
     </Compile>
     <Compile Include="CustomControl\Utils.cs" />
     <Compile Include="EventAggregators\PageEditRefreshEvent.cs" />
+    <Compile Include="Helper\SettingHelper.cs" />
     <Compile Include="Model\DialogNames.cs" />
     <Compile Include="CustomControl\SystemControl\InterTabClient.cs" />
     <Compile Include="CustomControl\LoadingControl.xaml.cs">
@@ -446,6 +447,12 @@
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\PDFSettings\PDFSettings.csproj">
+      <Project>{bee73aae-9a2c-446b-b64d-3a8f042c985d}</Project>
+      <Name>PDFSettings</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>

+ 11 - 2
PDF Office/PDF Office.sln

@@ -1,9 +1,14 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.32901.82
+# Visual Studio Version 17
+VisualStudioVersion = 17.1.32328.378
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDF Office", "PDF Office.csproj", "{F3A2111D-9EAF-4ECE-9A92-B7F21D429DCD}"
+	ProjectSection(ProjectDependencies) = postProject
+		{BEE73AAE-9A2C-446B-B64D-3A8F042C985D} = {BEE73AAE-9A2C-446B-B64D-3A8F042C985D}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDFSettings", "..\PDFSettings\PDFSettings.csproj", "{BEE73AAE-9A2C-446B-B64D-3A8F042C985D}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +20,10 @@ Global
 		{F3A2111D-9EAF-4ECE-9A92-B7F21D429DCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{F3A2111D-9EAF-4ECE-9A92-B7F21D429DCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{F3A2111D-9EAF-4ECE-9A92-B7F21D429DCD}.Release|Any CPU.Build.0 = Release|Any CPU
+		{BEE73AAE-9A2C-446B-B64D-3A8F042C985D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{BEE73AAE-9A2C-446B-B64D-3A8F042C985D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{BEE73AAE-9A2C-446B-B64D-3A8F042C985D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{BEE73AAE-9A2C-446B-B64D-3A8F042C985D}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 33 - 31
PDF Office/Properties/Resources.Designer.cs

@@ -1,70 +1,72 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     此代码由工具生成。
-//     运行时版本: 4.0.30319.42000
+//     运行时版本:4.0.30319.42000
 //
-//     对此文件的更改可能导致不正确的行为,如果
-//     重新生成代码,则所做更改将丢失。
+//     对此文件的更改可能导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-
-namespace PDF_Office.Properties
-{
+namespace PDF_Office.Properties {
+    using System;
+    
+    
     /// <summary>
-    ///   强类型资源类,用于查找本地化字符串等。
+    ///   一个强类型资源类,用于查找本地化字符串等。
     /// </summary>
     // 此类是由 StronglyTypedResourceBuilder
     // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
-    // 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
     // (以 /str 作为命令选项),或重新生成 VS 项目。
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    internal class Resources
-    {
-
+    internal class Resources {
+        
         private static global::System.Resources.ResourceManager resourceMan;
-
+        
         private static global::System.Globalization.CultureInfo resourceCulture;
-
+        
         [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
-        internal Resources()
-        {
+        internal Resources() {
         }
-
+        
         /// <summary>
-        ///   返回此类使用的缓存 ResourceManager 实例。
+        ///   返回此类使用的缓存 ResourceManager 实例。
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Resources.ResourceManager ResourceManager
-        {
-            get
-            {
-                if ((resourceMan == null))
-                {
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
                     global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PDF_Office.Properties.Resources", typeof(Resources).Assembly);
                     resourceMan = temp;
                 }
                 return resourceMan;
             }
         }
-
+        
         /// <summary>
         ///   重写当前线程的 CurrentUICulture 属性,对
         ///   使用此强类型资源类的所有资源查找执行重写。
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Globalization.CultureInfo Culture
-        {
-            get
-            {
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
                 return resourceCulture;
             }
-            set
-            {
+            set {
                 resourceCulture = value;
             }
         }
+        
+        /// <summary>
+        ///   查找类似 PDF Files (*.pdf)|*.pdf 的本地化字符串。
+        /// </summary>
+        internal static string OpenDialogFilter {
+            get {
+                return ResourceManager.GetString("OpenDialogFilter", resourceCulture);
+            }
+        }
     }
 }

+ 11 - 5
PDF Office/Properties/Resources.resx

@@ -46,7 +46,7 @@
     
     mimetype: application/x-microsoft.net.object.binary.base64
     value   : The object must be serialized with 
-            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
             : and then encoded with base64 encoding.
     
     mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
             : and then encoded with base64 encoding.
     -->
   <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
     <xsd:element name="root" msdata:IsDataSet="true">
       <xsd:complexType>
         <xsd:choice maxOccurs="unbounded">
@@ -68,9 +69,10 @@
               <xsd:sequence>
                 <xsd:element name="value" type="xsd:string" minOccurs="0" />
               </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="name" use="required" type="xsd:string" />
               <xsd:attribute name="type" type="xsd:string" />
               <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
             </xsd:complexType>
           </xsd:element>
           <xsd:element name="assembly">
@@ -85,9 +87,10 @@
                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
               </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
             </xsd:complexType>
           </xsd:element>
           <xsd:element name="resheader">
@@ -109,9 +112,12 @@
     <value>2.0</value>
   </resheader>
   <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
+  <data name="OpenDialogFilter" xml:space="preserve">
+    <value>PDF Files (*.pdf)|*.pdf</value>
+  </data>
 </root>

+ 12 - 1
PDF Office/Properties/Settings.Designer.cs

@@ -12,7 +12,7 @@ namespace PDF_Office.Properties {
     
     
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
     internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
         
         private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -22,5 +22,16 @@ namespace PDF_Office.Properties {
                 return defaultInstance;
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        public global::PDFSettings.Settings.RecentOpenFiles RecentOpenFiles {
+            get {
+                return ((global::PDFSettings.Settings.RecentOpenFiles)(this["RecentOpenFiles"]));
+            }
+            set {
+                this["RecentOpenFiles"] = value;
+            }
+        }
     }
 }

+ 7 - 5
PDF Office/Properties/Settings.settings

@@ -1,7 +1,9 @@
 <?xml version='1.0' encoding='utf-8'?>
-<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
-  <Profiles>
-    <Profile Name="(Default)" />
-  </Profiles>
-  <Settings />
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="PDF_Office.Properties" GeneratedClassName="Settings">
+  <Profiles />
+  <Settings>
+    <Setting Name="RecentOpenFiles" Type="PDFSettings.Settings.RecentOpenFiles" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
+  </Settings>
 </SettingsFile>

+ 4 - 4
PDF Office/Styles/ListViewStyle.xaml

@@ -66,7 +66,7 @@
 
     <Style x:Key="FilesListViewItemStyle" TargetType="{x:Type ListViewItem}">
         <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
-        <Setter Property="Control.Padding" Value="4,1" />
+        <!--<Setter Property="Control.Padding" Value="4,1" />
         <Setter Property="Control.HorizontalContentAlignment">
             <Setter.Value>
                 <Binding Path="HorizontalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
@@ -76,7 +76,7 @@
             <Setter.Value>
                 <Binding Path="VerticalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
             </Setter.Value>
-        </Setter>
+        </Setter>-->
         <Setter Property="Panel.Background" Value="#00FFFFFF" />
         <Setter Property="Border.BorderBrush" Value="#00FFFFFF" />
         <Setter Property="Border.BorderThickness" Value="1" />
@@ -186,7 +186,7 @@
 
     <Style x:Key="FilesGridItemStyle" TargetType="{x:Type ListViewItem}">
         <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
-        <Setter Property="Control.Padding" Value="4,1" />
+        <!--<Setter Property="Control.Padding" Value="4,1" />
         <Setter Property="Control.HorizontalContentAlignment">
             <Setter.Value>
                 <Binding Path="HorizontalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
@@ -196,7 +196,7 @@
             <Setter.Value>
                 <Binding Path="VerticalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
             </Setter.Value>
-        </Setter>
+        </Setter>-->
         <Setter Property="Panel.Background" Value="#00FFFFFF" />
         <Setter Property="Border.BorderBrush" Value="#00FFFFFF" />
         <Setter Property="Border.BorderThickness" Value="2" />

+ 20 - 0
PDF Office/Views/HomePanel/RecentFiles/RecentFilesView.xaml

@@ -36,6 +36,7 @@
             </ItemsPanelTemplate>
 
             <Style x:Key="SubFilesListViewItemStyle" BasedOn="{StaticResource FilesListViewItemStyle}" TargetType="{x:Type ListViewItem}">
+                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                 <Setter Property="Margin" Value="12,0,0,0"/>
                 <EventSetter Event="PreviewMouseRightButtonDown"
                              Handler="ListViewItem_PreviewMouseRightButtonDown"/>
@@ -44,6 +45,7 @@
             </Style>
 
             <Style x:Key="HomeGridViewItemStyle" BasedOn="{StaticResource FilesGridItemStyle}" TargetType="{x:Type ListViewItem}">
+                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                 <EventSetter Event="PreviewMouseRightButtonDown"
                              Handler="ListViewItem_PreviewMouseRightButtonDown"/>
                 <EventSetter Event="PreviewMouseDoubleClick"
@@ -110,6 +112,24 @@
                       Padding="0,0,0,0" MinHeight="216" MinWidth="380" 
                       SelectionMode="Multiple"
                       SelectionChanged="RecentFilesList_SelectionChanged"
+                      ItemContainerStyle="{StaticResource SubFilesListViewItemStyle}"
+                      Style="{StaticResource FilesListViewStyle}"
+                      ItemTemplate="{StaticResource listviewItem}"
+                     ItemsPanel="{StaticResource listPanel}"
+                     >
+                </ListView>
+                
+                 <ListView x:Name="GridRecentFilesList" Margin="32,0,0,0" Visibility="Collapsed"
+                      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"
+                      SelectionChanged="GridRecentFilesList_SelectionChanged"
                       ItemContainerStyle="{StaticResource FilesGridItemStyle}"
                       Style="{StaticResource FilesGridViewStyle}"
                       ItemTemplate="{StaticResource gridviewItem}"

+ 39 - 23
PDF Office/Views/HomePanel/RecentFiles/RecentFilesView.xaml.cs

@@ -1,6 +1,8 @@
 using ComPDFKitViewer.PdfViewer;
 using Microsoft.Win32;
 using PDF_Office.CustomControl;
+using PDF_Office.Properties;
+using PDFSettings.Settings;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
@@ -17,18 +19,18 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
     public partial class RecentFilesView : UserControl
     {
        
-        private ObservableCollection<string> RecentFilesGroup = new ObservableCollection<string>();
+        private ObservableCollection<OpenFileInfo> RecentFilesGroup = new ObservableCollection<OpenFileInfo>();
         public RecentFilesView()
         {
             InitializeComponent();
-            RecentFilesGroup.Add("");
-            RecentFilesGroup.Add("");
-            RecentFilesGroup.Add("");
-            RecentFilesGroup.Add("");
-            RecentFilesGroup.Add("");
+        }
 
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            RecentFilesGroup = new ObservableCollection<OpenFileInfo>(Settings.Default.RecentOpenFiles);
             RecentFilesList.ItemsSource = RecentFilesGroup;
- 
+            GridRecentFilesList.ItemsSource = RecentFilesGroup;
+            RecentFilesList.SelectedItem = null;
         }
 
         private void SetLangText()
@@ -46,10 +48,6 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
 
         }
 
-        private void UserControl_Loaded(object sender, RoutedEventArgs e)
-        {
-
-        }
 
         #region UI
         #region 列表和网格模式
@@ -77,25 +75,37 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
                 switch (btn.Tag.ToString())
                 {
                     case "ListMode":
-                        if (RecentFilesList.ItemTemplate == Resources["gridviewItem"] as DataTemplate)
+                        BtnGridMode.IsChecked = false;
+
+                        GridRecentFilesList.Visibility = Visibility.Collapsed;
+                        RecentFilesList.Visibility = Visibility.Visible;
+                        RecentFilesList.SelectedItems.Clear();
+                        if (GridRecentFilesList.SelectedItems.Count > 0)
                         {
-                            RecentFilesList.ItemsPanel = Resources["listPanel"] as ItemsPanelTemplate;
-                            RecentFilesList.ItemTemplate = Resources["listviewItem"] as DataTemplate;
-                            RecentFilesList.ItemContainerStyle = Resources["SubFilesListViewItemStyle"] as Style;
-                            RecentFilesList.Style = Resources["FilesListViewStyle"] as Style;
-                            BtnGridMode.IsChecked = false;
+                            for (int i = 0; i < GridRecentFilesList.SelectedItems.Count; i++)
+                            {
+                                RecentFilesList.SelectedItems.Add(GridRecentFilesList.SelectedItems[i]);
+                            }
+
                         }
+                        
                         break;
 
                     case "GridMode":
-                        if (RecentFilesList.ItemTemplate == Resources["listviewItem"] as DataTemplate)
+                        BtnListMode.IsChecked=false;
+
+                        GridRecentFilesList.Visibility = Visibility.Visible;
+                        RecentFilesList.Visibility = Visibility.Collapsed;
+                        GridRecentFilesList.SelectedItems.Clear();
+                        if (RecentFilesList.SelectedItems.Count > 0)
                         {
-                            RecentFilesList.ItemTemplate = Resources["gridviewItem"] as DataTemplate;
-                            RecentFilesList.ItemsPanel = Resources["gridPanel"] as ItemsPanelTemplate;
-                            RecentFilesList.ItemContainerStyle = Resources["HomeGridViewItemStyle"] as Style;
-                            RecentFilesList.Style = Resources["FilesGridViewStyle"] as Style;
-                            BtnListMode.IsChecked = false;
+                            for (int i = 0; i < RecentFilesList.SelectedItems.Count; i++)
+                            {
+                                GridRecentFilesList.SelectedItems.Add(RecentFilesList.SelectedItems[i]);
+                            }
+
                         }
+                        
                         break;
                 }
               
@@ -131,6 +141,11 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
            
         }
 
+        private void GridRecentFilesList_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+        
+        }
+
         private void ContextMenu_Opened(object sender, RoutedEventArgs e)
         {
            
@@ -225,5 +240,6 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
 
         }
 
+      
     }
 }

+ 104 - 0
PDFSettings/APPSettingProperties.cs

@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Drawing;
+using ComPDFKitViewer.PdfViewer;
+using ComPDFKitViewer;
+
+namespace PDFSettings
+{
+    public class APPSettingProperties
+    {
+        public DescriptionPropertyClass Description = new DescriptionPropertyClass();
+        public InitialVIewPropertyClass InitialVIew = new InitialVIewPropertyClass();
+        public AnnotatePropertyClass Annotate = new AnnotatePropertyClass();
+        //自定义主题色保存
+        public List<System.Windows.Media.Color> CustomColorList = new List<System.Windows.Media.Color>();
+        //动态图章日期格式   下拉列表索引
+        public int DateMode = 0;
+
+        public string CustomAuthor = "PDF Reader Pro";
+        //ToolTabControl 选中项
+        public int TabSelectedIndex = 0;
+        //是否固定
+        public bool IsFixed = true;
+
+        //需要重启后删除的临时文件
+        public List<string> NeedToDeletePath = new List<string>();
+
+        //文件源路径集合
+        public List<string> CustomStampFilePathLists = new List<string>();
+        public List<string> SignatureFilePathLists = new List<string>();
+
+        public string culture = System.Globalization.CultureInfo.CurrentUICulture.ToString();
+
+        /// <summary>
+        /// 0 - listView   1-GridView
+        /// </summary>
+        public int RecentFileListMode = 0;
+
+        /// <summary>
+        /// 切换语言时 重启时需要打开的文档列表
+        /// </summary>
+        public List<string> NeedToOpenFileList = new List<string>();
+    }
+
+    public class DescriptionPropertyClass
+    {
+        private string author = "PDF Reader Pro";
+        public string Author
+        {
+            get { return author; }
+            set { author = value; }
+        }
+
+        /// <summary>
+        /// 0-a new tab in the Same window 1- open in new window
+        /// </summary>
+        public int OpenDocumentMode = 1;
+        /// <summary>
+        /// 文件打开时是否显示选择在标签页打开方式
+        /// </summary>
+        public int HideOpenTabWindow = 0;
+
+        public ViewMode DefualtLayout = ViewMode.SingleContinuous;
+
+        public FitMode NewDocumentFitMode = FitMode.FitSize;
+
+        public ViewMode DefualtLayoutInFullScreen = ViewMode.SingleContinuous;
+
+        public bool IsOpenLastFilesAtStart = false;
+
+        public bool IsRememberLastPageViewed = true;
+
+        public bool IsOpenPanelOnlyforOutline = false;
+    }
+
+    public class InitialVIewPropertyClass
+    {
+        //字体属性 单独写在外面   层数太多绑定响应不到
+        public string Background = "#DBDDE5";
+    }
+
+    public class AnnotatePropertyClass
+    {
+        /// <summary>
+        /// 0-left 1-center 2-right
+        /// </summary>
+        public int TextAlign = 0;
+
+        /// <summary>
+        /// 文本注释 字体
+        /// </summary>
+        public string TextFontFamaily = "Helvetica";
+
+        /// <summary>
+        /// 标签Note 字体
+        /// </summary>
+        public string AnchoredFamaily = "Helvetica";
+    }
+
+}

+ 95 - 0
PDFSettings/BatesHeaderFooterList.cs

@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ComPDFKit.Import;
+
+namespace PDFSettings
+{
+    public class HeaderFooterList : List<BatesHeaderFooterItem>
+    {
+
+    }
+
+    public class BatesList : List<BatesHeaderFooterItem>
+    {
+
+    }
+
+    public class BatesHeaderFooterItem
+    {
+        /// <summary>
+        /// 模板名称
+        /// </summary>
+        public string FileName { get; set; } = "";
+        /// <summary>
+        /// 内容
+        /// </summary>
+        public contentItem[] TextData { get; set; }
+        /// <summary>
+        /// 间距
+        /// </summary>
+        public float[] margin { get; set; }
+        /// <summary>
+        /// 页面范围
+        /// </summary>
+        public string PageRange { get; set; } = "0";
+        /// <summary>
+        /// 起始页
+        /// </summary>
+        public int StarPagetNumber { get; set; } = 1;
+
+        /// <summary>
+        /// 贝茨码:前缀
+        /// </summary>
+        public string Prefix { get; set; } = "";
+
+        /// <summary>
+        /// 贝茨码:后缀
+        /// </summary>
+        public string Suffix { get; set; } = "";
+        ///// <summary>
+        ///// 贝茨码:起始页
+        ///// </summary>
+        //public int StartWithPageNum { get; set; }
+        /// <summary>
+        /// 贝茨码:位数
+        /// </summary>
+        public int DigitNumber { get; set; } = 1;
+        /// <summary>
+        /// 页眉页脚:页码格式
+        /// </summary>
+        public string PageNumberFormat { get; set; } = "1";
+        /// <summary>
+        /// 页眉页脚:日期格式
+        /// </summary>
+        public string DateTimeFormat { get; set; } = "m/d";
+
+        /// <summary>
+        /// 页面范围:显示标记
+        /// </summary>
+        public string PageRangeTag { get; set; } = "All";
+    }
+
+    public struct contentItem
+    {
+        public string text { get; set; }
+        public BateHeaderFooter_ContentType textTag { get; set; }
+        public string fontName;
+        public float fontSize;
+        public float fontColorR;
+        public float fontColorG;
+        public float fontColorB;
+    }
+
+    public enum BateHeaderFooter_ContentType
+    {
+        L_Header,
+        C_Header,
+        R_Header,
+        L_Footer,
+        C_Footer,
+        R_Footer
+    }
+}

+ 30 - 0
PDFSettings/CustomStampList.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ComPDFKitViewer.AnnotEvent;
+
+namespace PDFSettings
+{
+    public class CustomStampList:List<StampAnnote>
+    {
+       
+    }
+
+    public class StampAnnote
+    {
+        public string StampText;
+        public string StampTextDate;
+        public int ImageWidth;
+        public int ImageHeight;
+        public int StampWidth;
+        public int StampHeight;
+        public string ImagePath;
+        public string SourcePath;
+        public StampType Type;
+        public TextStampSharp TextSharp;
+        public TextStampColor TextColor;
+        public string ImageType;
+    }
+}

+ 69 - 0
PDFSettings/DefaultAnnotProperty.cs

@@ -0,0 +1,69 @@
+using ComPDFKitViewer.AnnotEvent;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+using System.Linq;
+using System.Windows;
+using ComPDFKit.PDFAnnotation;
+
+namespace PDFSettings
+{
+    public class DefaultAnnotProperty
+    {
+        public AnnotArgsType AnnotToolType;
+        public Color ForgoundColor;
+        public Color BackgroundColor;
+        public Color BorderColor;
+        public double Opacity;
+        public double Thickness;
+        public double FontSize;
+        public FontStyle FontStyle;
+        public FontWeight FontWeight;
+        public TextAlignment TextAlign;
+        public string FontFamily = string.Empty;
+        public string NoteText = string.Empty;
+        public string SaveKey;
+        public C_LINE_TYPE HeadLineType;
+        public C_LINE_TYPE TailLineType;
+        public List<double> DashArray;
+        public DefaultAnnotProperty()
+        {
+            AnnotToolType = AnnotArgsType.AnnotNone;
+        }
+    }
+
+    public class DefaultAnnotProperties : List<DefaultAnnotProperty>
+    {
+        public DefaultAnnotProperty GetAnnotProperty(AnnotArgsType annotToolType)
+        {
+            return this.AsEnumerable().Where(x => x.AnnotToolType == annotToolType).FirstOrDefault();
+        }
+
+        public DefaultAnnotProperty GetAnnotProperty(AnnotArgsType annotToolType,string saveKey)
+        {
+            return this.AsEnumerable().Where(x => x.AnnotToolType == annotToolType && x.SaveKey==saveKey).FirstOrDefault();
+        }
+        public void SetAnnotProperty(DefaultAnnotProperty annotProperty)
+        {
+            DefaultAnnotProperty[] deleteArray = new DefaultAnnotProperty[0];
+            if (annotProperty.SaveKey != null && annotProperty.SaveKey != string.Empty)
+            {
+                deleteArray = this.AsEnumerable().Where(x => x.AnnotToolType == annotProperty.AnnotToolType && x.SaveKey == annotProperty.SaveKey).ToArray();
+            }
+            else
+            {
+                deleteArray = this.AsEnumerable().Where(x => x.AnnotToolType == annotProperty.AnnotToolType).ToArray();
+            }
+            foreach (DefaultAnnotProperty deleteProperty in deleteArray)
+            {
+                this.Remove(deleteProperty);
+            }
+            this.Add(annotProperty);
+        }
+    }
+
+}

+ 47 - 0
PDFSettings/DialogCounter.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDFSettings
+{
+    //用于记录弹窗策略相关的参数
+    public class DialogCounter
+    {
+        /// <summary>
+        /// 是否已经点击RateUs弹窗的按钮
+        /// </summary>
+        public bool HasRateUs = false;
+
+        /// <summary>
+        /// 版本更新时间
+        /// </summary>
+        public System.DateTime UpdateTime = System.DateTime.Now;
+
+        /// <summary>
+        /// 弹窗显示的时间
+        /// </summary>
+        public System.DateTime ShowedDate = System.DateTime.Now;
+
+        /// <summary>
+        /// app的打开次数
+        /// </summary>
+        public int AppOpenedCount = 0;
+
+        /// <summary>
+        /// 弹窗显示次数
+        /// </summary>
+        public int DialogShowedCount = 0;
+
+        /// <summary>
+        /// 当前版本不再显示设置默认APP 弹窗
+        /// </summary>
+        public bool SetDefualtAppDontShow = false;
+
+        /// <summary>
+        /// 更新后已显示
+        /// </summary>
+        public bool HasShowedAfterUpdated = false;
+    }
+}

+ 146 - 0
PDFSettings/DpiHelpers.cs

@@ -0,0 +1,146 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+
+namespace PDFSettings
+{
+    internal class Helpers
+    {
+		/// <summary>
+		/// 当前系统DPI
+		/// </summary>
+        public static int Dpi { get; private set; }
+		/// <summary>
+		/// 当前DPI相对系统标准DPI(96)缩小比例
+		/// </summary>
+		public static float ScaleDpi { get { return (96F/Dpi); } }
+		/// <summary>
+		/// 系统DPI相对PDF文档DPI放大倍数
+		/// </summary>
+		public static double ScaleFactor { get { return (Dpi / 72D); } }
+		/// <summary>
+		/// PDF文档DPI相对系统标准DPI(96)缩小倍数
+		/// </summary>
+		public static double InvertScaleFactor { get { return (72D / Dpi); } }
+		static Helpers()
+        {
+            try
+            {
+				var flags = BindingFlags.NonPublic | BindingFlags.Static;
+				var dpiProperty = typeof(SystemParameters).GetProperty("Dpi", flags);
+				Dpi = (int)dpiProperty.GetValue(null, null);
+				
+			}
+			catch (Exception ex)
+            {
+			}
+        }
+	
+		/// <summary>
+		/// 从WPF获取的数值转换成标准DPI时的大小
+		/// 缩小
+		/// </summary>
+		/// <param name="oldValue">当前数值</param>
+		/// <returns></returns>
+		public static int GetDpiUnrelatedNum(int oldValue)
+		{
+			return (int)(oldValue * ScaleDpi);
+		}
+		/// <summary>
+		/// 从WPF获取的数值转换成标准DPI时的大小
+		/// 缩小
+		/// </summary>
+		/// <param name="oldValue">当前数值</param>
+		/// <returns></returns>
+		public static double GetDpiUnrelatedNum(double oldValue)
+		{
+			return (double)(oldValue * ScaleDpi);
+		}
+		/// <summary>
+		/// 标准DPI时的大小转换成当前DPI对应大小
+		/// 放大
+		/// </summary>
+		/// <param name="oldValue">当前数值</param>
+		/// <returns></returns>
+		public static double GetDpiRelatedNum(double oldValue)
+		{
+			return (oldValue / ScaleDpi);
+		}
+		/// <summary>
+		/// 当前矩形换成标准DPI时的大小
+		/// </summary>
+		/// <param name="oldValue"></param>
+		/// <returns></returns>
+		public static Rect GetDpiUnrelatedRect(Rect oldValue)
+        {
+			return new Rect(GetDpiUnrelatedNum(oldValue.Left), GetDpiUnrelatedNum(oldValue.Top), 
+				GetDpiUnrelatedNum(oldValue.Width), GetDpiUnrelatedNum(oldValue.Height));
+        }
+		/// <summary>
+		/// 转换到PDF矩形
+		/// </summary>
+		/// <param name="oldValue"></param>
+		/// <returns></returns>
+		public static Rect GetRawRect(Rect oldValue)
+        {
+			Rect standRect= new Rect(GetDpiUnrelatedNum(oldValue.Left), GetDpiUnrelatedNum(oldValue.Top),
+				GetDpiUnrelatedNum(oldValue.Width), GetDpiUnrelatedNum(oldValue.Height));
+			return new Rect(standRect.Left * 72D / 96D, standRect.Top * 72D / 96D, standRect.Width * 72D / 96D, standRect.Height * 72D / 96D);
+		}
+
+		/// <summary>
+		/// 当前矩形换成当前DPI时的矩形大小
+		/// </summary>
+		/// <param name="oldValue"></param>
+		/// <returns></returns>
+		public static Rect GetDpiRelatedRect(Rect oldValue)
+		{
+			return new Rect(GetDpiRelatedNum(oldValue.Left), GetDpiRelatedNum(oldValue.Top),
+				GetDpiRelatedNum(oldValue.Width), GetDpiRelatedNum(oldValue.Height));
+		}
+		/// <summary>
+		/// 当前点转换成标准DPI时的大小
+		/// </summary>
+		/// <param name="oldValue"></param>
+		/// <returns></returns>
+		public static Point GetDpiUnrelatedPoint(Point oldValue)
+		{
+			return new Point(GetDpiUnrelatedNum(oldValue.X), GetDpiUnrelatedNum(oldValue.Y));
+		}
+		/// <summary>
+		/// 点换成当前DPI时的大小
+		/// </summary>
+		/// <param name="oldValue"></param>
+		/// <returns></returns>
+		public static Point GetDpiRelatedPoint(Point oldValue)
+		{
+			return new Point(GetDpiRelatedNum(oldValue.X), GetDpiRelatedNum(oldValue.Y));
+		}
+		/// <summary>
+		/// 当前Size转换成标准DPI时的大小
+		/// </summary>
+		/// <param name="oldValue"></param>
+		/// <returns></returns>
+		public static Size GetDpiUnrelatedSize(Size oldValue)
+		{
+			return new Size(GetDpiUnrelatedNum(oldValue.Width), GetDpiUnrelatedNum(oldValue.Height));
+		}
+		/// <summary>
+		/// Size换成当前DPI时的大小
+		/// </summary>
+		/// <param name="oldValue"></param>
+		/// <returns></returns>
+		public static Size GetDpiRelatedSize(Size oldValue)
+		{
+			return new Size(GetDpiRelatedNum(oldValue.Width), GetDpiRelatedNum(oldValue.Height));
+		}
+	}
+}

+ 112 - 0
PDFSettings/PDFBackgroundList.cs

@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDFSettings
+{
+
+    public class PDFBackgroundList : List<PDFBackgroundItem>
+    {
+
+    }
+
+    public class PDFBackgroundItem : EventArgs
+    {
+        /// <summary>
+        /// 模板名称
+        /// </summary>
+        public string templeteName = "Background";
+
+        /// <summary>
+        /// 文档背景类型
+        /// </summary>
+        public ComPDFKit.PDFDocument.C_Background_Type type = ComPDFKit.PDFDocument.C_Background_Type.BG_TYPE_COLOR;
+
+        /// <summary>
+        /// 背景颜色
+        /// </summary>
+        public byte[] bgColor = new byte[] { 255, 0, 0 };
+
+        /// <summary>
+        /// 页码范围
+        /// </summary>
+        public string pageRange;
+
+        /// <summary>
+        /// 水平位置
+        /// </summary>
+        public ComPDFKit.PDFDocument.C_Background_Horizalign horizalign = ComPDFKit.PDFDocument.C_Background_Horizalign.BG_HORIZALIGN_CENTER;
+
+        /// <summary>
+        /// 水平偏移量
+        /// </summary>
+        public float horizOffset = 0;
+
+
+        public string previeImagePath = "";
+
+        /// <summary>
+        /// 图片数据缓存路径
+        /// </summary>
+        public string imagepath = "";
+
+        /// <summary>
+        /// 图片宽
+        /// </summary>
+        public int imageWidth;
+
+        /// <summary>
+        /// 图片高
+        /// </summary>
+        public int imageHeight;
+
+        /// <summary>
+        /// 透明度 0-255
+        /// </summary>
+        public byte opacity = 230;
+
+        /// <summary>
+        /// 旋转角度
+        /// </summary>
+        public float rotation = 0;
+
+        /// <summary>
+        /// 图片缩放比例
+        /// </summary>
+        public float scale = 1;
+
+
+        /// <summary>
+        /// 垂直位置    
+        /// </summary>
+        public ComPDFKit.PDFDocument.C_Background_Vertalign vertalign = ComPDFKit.PDFDocument.C_Background_Vertalign.BG_VERTALIGN_CENTER;
+
+        /// <summary>
+        /// 垂直偏移量
+        /// </summary>
+        public float vertOffset = 0;
+
+        /// <summary>
+        /// 水平间距
+        /// </summary>
+        public float horizontalSpacing = (float)(10 * Helpers.Dpi / 25.4);
+        /// <summary>
+        /// 垂直间距
+        /// </summary>
+        public float verticalSpacing = (float)(20 * Helpers.Dpi / 25.4);
+
+        /// <summary>
+        /// 能否打印
+        /// </summary>
+        public bool isCanPrint = true;
+        public bool isCanView = true;
+        
+
+        /// <summary>
+        /// 页面选择的范围 ALL ODD EVEN 1-5(传入用户输入的字符串)
+        /// </summary>
+        public string pageangeMode = "ALL";
+    }
+}

+ 72 - 0
PDFSettings/PDFSettings.csproj

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{BEE73AAE-9A2C-446B-B64D-3A8F042C985D}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>PDFSettings</RootNamespace>
+    <AssemblyName>PDFSettings</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <Deterministic>true</Deterministic>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ComPDFKit.Desk, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\PDFReader_WPF\ComPDFKit.Desk.dll</HintPath>
+    </Reference>
+    <Reference Include="ComPDFKit.Viewer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\PDFReader_WPF\ComPDFKit.Viewer.dll</HintPath>
+    </Reference>
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+    <Reference Include="WindowsBase" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="APPSettingProperties.cs" />
+    <Compile Include="BatesHeaderFooterList.cs" />
+    <Compile Include="CustomStampList.cs" />
+    <Compile Include="DefaultAnnotProperty.cs" />
+    <Compile Include="DialogCounter.cs" />
+    <Compile Include="DpiHelpers.cs" />
+    <Compile Include="PDFBackgroundList.cs" />
+    <Compile Include="ProductActiveInfo.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="RecentOpenFiles.cs" />
+    <Compile Include="RedactionSettings.cs" />
+    <Compile Include="SignatureList.cs" />
+    <Compile Include="WaterMarkTempleteList.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 6 - 0
PDFSettings/PDFSettings.csproj.user

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectView>ProjectFiles</ProjectView>
+  </PropertyGroup>
+</Project>

+ 55 - 0
PDFSettings/ProductActiveInfo.cs

@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDFSettings
+{
+    public class ProductActiveInfo
+    {
+        /// <summary>
+        /// 设备ID
+        /// </summary>
+        public string DeviceId { get; set; } = string.Empty;
+        /// <summary>
+        /// 版本号
+        /// </summary>
+        public string Version { get; set; } = string.Empty;
+        /// <summary>
+        /// 序列码
+        /// </summary>
+        public string SerialNumber { get; set; } = string.Empty;
+        /// <summary>
+        /// 激活状态
+        /// </summary>
+        public int ActiveStatue { get; set; }
+        /// <summary>
+        /// 试用开始时间
+        /// </summary>
+        public long TrailStart { get; set; }
+        /// <summary>
+        /// 试用结束时间
+        /// </summary>
+        public long TrailEnd { get; set; }
+        /// <summary>
+        /// 购买类型
+        /// </summary>
+        public string ProductCode { get; set; }=string.Empty;
+    }
+    public class ProductActiveStore
+    {
+        /// <summary>
+        /// 加密信息
+        /// </summary>
+        public string SignData { get; set; } = string.Empty;
+        /// <summary>
+        /// 验证信息
+        /// </summary>
+        public string CheckSum { get; set; } = string.Empty;
+        /// <summary>
+        /// 更新时间
+        /// </summary>
+        public DateTime UpdateTime { get; set; }
+    }
+}

+ 36 - 0
PDFSettings/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("PDFSettings")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PDFSettings")]
+[assembly: AssemblyCopyright("Copyright ©  2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("bee73aae-9a2c-446b-b64d-3a8f042c985d")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 36 - 0
PDFSettings/RecentOpenFiles.cs

@@ -0,0 +1,36 @@
+using ComPDFKitViewer;
+using System;
+using System.Collections.Generic;
+using System.Windows.Media;
+
+namespace PDFSettings.Settings
+{
+    public class RecentOpenFiles : List<OpenFileInfo>
+    {
+
+    }
+
+    public class OpenFileInfo
+    {
+        public string FileName { get; set; } = "";
+        public string FilePath { get; set; } = "";
+        public DateTime LastOpenTime { get; set; } = DateTime.Now;
+
+        public string ThumbImgPath = "";
+        public int LastPageIndex = 0;
+        public double LastZoom = 1;
+
+        public ViewMode LastViewMode = ViewMode.SingleContinuous;
+        public FitMode LastFitMode = FitMode.FitFree;
+        public SplitMode LastSplitMode = SplitMode.None;
+        public bool ShowHighLightLink = true;
+        public bool LastPageSpace = true;
+
+        public DrawModes LastDrawMode = DrawModes.Draw_Mode_Normal;
+
+        public uint LastFillColor = 0XFFFFFFFF;
+
+        //用于记录显示的Color
+        public Color LastFillBrushColor = Brushes.White.Color;
+    }
+}

+ 38 - 0
PDFSettings/RedactionSettings.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+
+namespace PDFSettings
+{
+
+    public class RedactionSettings
+    {
+
+        private string content = "";
+        public string Content { get { return content; } set { content = value; } }
+
+        private Color linecolor = Colors.Red;
+        public Color LineColor { get { return linecolor; } set { linecolor = value; } }
+
+        private Color bgcolor = Colors.Black;
+        public Color BgColor { get { return bgcolor; } set { bgcolor = value; } }
+
+        private Color fontcolor = Colors.Red;
+        public Color FontColor { get { return fontcolor; } set { fontcolor = value; } }
+
+        private int fontsize = 14;
+
+        public int FontSize { get { return fontsize; } set { fontsize = value; } }
+
+        private bool isusetext = false;
+        public bool isUseText { get { return isusetext; } set { isusetext = value; } }
+
+        private TextAlignment align = TextAlignment.Left;
+        public TextAlignment Align { get { return align; } set { align = value; } }
+
+    }
+}

+ 20 - 0
PDFSettings/SignatureList.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDFSettings
+{
+    public class SignatureList:List<ImageItem>
+    {
+
+    }
+
+    public class ImageItem
+    {
+        public string Filesdata { get; set; }
+        public string ImageFilePath { get; set; }
+        public bool IsImage { get; set; }
+    }
+}

+ 129 - 0
PDFSettings/WaterMarkTempleteList.cs

@@ -0,0 +1,129 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Permissions;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Input;
+
+namespace PDFSettings
+{
+    public class WaterMarkTempleteList:List<WaterMarkTemplete>
+    {
+
+    }
+
+    public class WaterMarkTemplete:EventArgs
+    {
+        /// <summary>
+        /// 模板名称
+        /// </summary>
+        public string templeteName = "Watermark";
+
+        /// <summary>
+        /// 水印类型
+        /// </summary>
+        public ComPDFKit.PDFWatermark.C_Watermark_Type type = ComPDFKit.PDFWatermark.C_Watermark_Type.WATERMARK_TYPE_TEXT;
+
+        /// <summary>
+        /// 字体名字
+        /// </summary>
+        public string fontName = "Helvetica";
+
+        /// <summary>
+        /// 字体大小
+        /// </summary>
+        public float fontSize = 48;
+
+        /// <summary>
+        /// 页码范围
+        /// </summary>
+        public string pageRange;
+
+        /// <summary>
+        /// 水平位置
+        /// </summary>
+        public ComPDFKit.PDFWatermark.C_Watermark_Horizalign horizalign = ComPDFKit.PDFWatermark.C_Watermark_Horizalign.WATERMARK_HORIZALIGN_CENTER;
+
+        /// <summary>
+        /// 水平偏移量
+        /// </summary>
+        public float horizOffset = 0 ;
+
+        public string previeImagePath = "";
+
+        /// <summary>
+        /// 图片数据缓存路径
+        /// </summary>
+        public string imagepath = "";
+
+        /// <summary>
+        /// 图片宽
+        /// </summary>
+        public int imageWidth;
+
+        /// <summary>
+        /// 图片高
+        /// </summary>
+        public int imageHeight;
+
+        /// <summary>
+        /// 透明度 0-255
+        /// </summary>
+        public byte opacity =230;
+
+        /// <summary>
+        /// 旋转角度
+        /// </summary>
+        public float rotation = 0;
+
+        /// <summary>
+        /// 图片缩放比例
+        /// </summary>
+        public float scale = 1;
+
+        /// <summary>
+        /// 水印内容
+        /// </summary>
+        public string text="Watermark";
+
+        /// <summary>
+        /// 本文颜色
+        /// </summary>
+        public byte[] textcolor  = new byte[] {255,0,0};
+
+        /// <summary>
+        /// 垂直位置    
+        /// </summary>
+        public ComPDFKit.PDFWatermark.C_Watermark_Vertalign vertalign = ComPDFKit.PDFWatermark.C_Watermark_Vertalign.WATERMARK_VERTALIGN_CENTER;
+
+        /// <summary>
+        /// 垂直偏移量
+        /// </summary>
+        public float vertOffset = 0;
+
+        /// <summary>
+        /// 是否平铺
+        /// </summary>
+        public bool isFullScreen = false;
+
+        /// <summary>
+        /// 水平间距
+        /// </summary>
+        public float horizontalSpacing = (float)(10*Helpers.Dpi/25.4);
+                /// <summary>
+        /// 垂直间距
+        /// </summary>
+        public float verticalSpacing =(float)(20 *Helpers.Dpi / 25.4);
+
+        /// <summary>
+        /// 水印是否在前
+        /// </summary>
+        public bool isfront =true;
+
+        /// <summary>
+        /// 页面选择的范围 ALL ODD EVEN 1-5(传入用户输入的字符串)
+        /// </summary>
+        public string pageangeMode = "ALL";
+    }
+}

BIN
PDFSettings/bin/Debug/ComPDFKit.Desk.dll


BIN
PDFSettings/bin/Debug/ComPDFKit.Viewer.dll


BIN
PDFSettings/bin/Debug/PDFSettings.dll


BIN
PDFSettings/bin/Debug/PDFSettings.pdb


BIN
PDFSettings/bin/Release/ComPDFKit.Desk.dll


BIN
PDFSettings/bin/Release/ComPDFKit.Viewer.dll


BIN
PDFSettings/bin/Release/PDFSettings.dll


BIN
PDFSettings/bin/Release/PDFSettings.pdb