liuaoran 2 years ago
parent
commit
8aeeb521d3
100 changed files with 7421 additions and 497 deletions
  1. 9 1
      PDF Office/App.config
  2. 208 188
      PDF Office/App.xaml.cs
  3. BIN
      PDF Office/ComPDFKit.Desk.dll
  4. BIN
      PDF Office/ComPDFKit.Viewer.dll
  5. BIN
      PDF Office/ComPDFKit_Conversion.dll
  6. 12 10
      PDF Office/CustomControl/PageTurningPreview.xaml
  7. 30 21
      PDF Office/CustomControl/PageTurningPreview.xaml.cs
  8. 2 2
      PDF Office/CustomControl/WritableComboBox.xaml
  9. 29 0
      PDF Office/DataConvert/UnVisivleConvert.cs
  10. 237 0
      PDF Office/Helper/ConverterHelper.cs
  11. 2 2
      PDF Office/Helper/HomePageEditHelper.cs
  12. 134 0
      PDF Office/Helper/PictureConverter.cs
  13. 48 0
      PDF Office/Helper/SDKLisenceHelper.cs
  14. 53 0
      PDF Office/Model/CloudDrive/CloudDriveItem.cs
  15. 94 0
      PDF Office/Model/CloudDrive/CloudFiles.cs
  16. 13 0
      PDF Office/Model/Dialog/ConverterDialogs/ConverterCSVDialogModel.cs
  17. 44 0
      PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs
  18. 22 0
      PDF Office/Model/Dialog/ConverterDialogs/ConverterExcelDialogModel.cs
  19. 12 0
      PDF Office/Model/Dialog/ConverterDialogs/ConverterHTMLDialogModel.cs
  20. 15 0
      PDF Office/Model/Dialog/ConverterDialogs/ConverterImgDialogModel.cs
  21. 12 0
      PDF Office/Model/Dialog/ConverterDialogs/ConverterPPTDialogModel.cs
  22. 12 0
      PDF Office/Model/Dialog/ConverterDialogs/ConverterRTFDialogModel.cs
  23. 12 0
      PDF Office/Model/Dialog/ConverterDialogs/ConverterTextDialogModel.cs
  24. 12 0
      PDF Office/Model/Dialog/ConverterDialogs/ConverterWordDialogModel.cs
  25. 18 0
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBatchProcessingDialogModel.cs
  26. 22 0
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageCompressDialogModel.cs
  27. 100 0
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageSetPasswordDialogModel.cs
  28. 58 0
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogModel.cs
  29. 26 0
      PDF Office/Model/DialogNames.cs
  30. 12 0
      PDF Office/Model/ParameterNames.cs
  31. 282 15
      PDF Office/PDF Office.csproj
  32. 13 1
      PDF Office/Properties/Resources.Designer.cs
  33. 4 0
      PDF Office/Properties/Resources.resx
  34. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Arrow.png
  35. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Bookmark.png
  36. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Circle.png
  37. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Freehande.png
  38. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Freehande2.png
  39. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Hand.png
  40. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Highlight.png
  41. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Hyperlink.png
  42. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Image.png
  43. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Line.png
  44. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Note.png
  45. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Point.png
  46. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Rectangle.png
  47. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Selecttool.png
  48. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Stamp.png
  49. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/Textbox.png
  50. BIN
      PDF Office/Resources/ToolBarIcon/MyTools/wavyline2.png
  51. 11 0
      PDF Office/SDKLisence.xml
  52. 36 1
      PDF Office/Styles/CustomBtnStyle.xaml
  53. 1 0
      PDF Office/Styles/WindowsStyle.xaml
  54. 77 3
      PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs
  55. 131 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterCSVDialogViewModel.cs
  56. 136 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterExcelDialogViewModel.cs
  57. 108 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterHTMLDialogViewModel.cs
  58. 131 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterImgDialogViewModel.cs
  59. 105 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterPPTDialogViewModel.cs
  60. 155 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterProgressBarDialogViewModel.cs
  61. 105 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterRTFDialogViewModel.cs
  62. 104 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterTextDialogViewModel.cs
  63. 125 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterWordDialogViewModel.cs
  64. 102 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBatchProcessingDialogViewModel.cs
  65. 349 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageCompressDialogViewModel.cs
  66. 468 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageSetPasswordDialogViewModel.cs
  67. 5 37
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageExtractDialogViewModel.cs
  68. 3 33
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageInsertDialogViewModel.cs
  69. 474 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogViewModel.cs
  70. 26 26
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContentViewModel.cs
  71. 15 95
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageSplitDialogViewModel.cs
  72. 23 4
      PDF Office/ViewModels/HomeContentViewModel.cs
  73. 52 0
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveContentViewModel.cs
  74. 107 0
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveManager.cs
  75. 92 0
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/DropbBoxManager.cs
  76. 274 0
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/DropbBoxUserItem.cs
  77. 102 0
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/GoogleDriveManager.cs
  78. 386 0
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/GoogleDriveUserItem.cs
  79. 136 0
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudFilesContentViewModel.cs
  80. 30 1
      PDF Office/ViewModels/HomePanel/HomeCloudContentViewModel.cs
  81. 31 10
      PDF Office/ViewModels/HomePanel/HomeGuidContentViewModel.cs
  82. 253 14
      PDF Office/ViewModels/MainContentViewModel.cs
  83. 92 0
      PDF Office/ViewModels/Tools/ConverterBarContentViewModel.cs
  84. 358 33
      PDF Office/ViewModels/ViewContentViewModel.cs
  85. 66 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterCSVDialog.xaml
  86. 111 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterCSVDialog.xaml.cs
  87. 87 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterExcelDialog.xaml
  88. 131 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterExcelDialog.xaml.cs
  89. 66 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterHTMLDialog.xaml
  90. 114 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterHTMLDialog.xaml.cs
  91. 63 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterImgDialog.xaml
  92. 174 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterImgDialog.xaml.cs
  93. 66 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterPPTDialog.xaml
  94. 114 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterPPTDialog.xaml.cs
  95. 19 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterProgressBarDialog.xaml
  96. 15 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterProgressBarDialog.xaml.cs
  97. 66 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterRTFDialog.xaml
  98. 113 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterRTFDialog.xaml.cs
  99. 66 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterTextDialog.xaml
  100. 0 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterTextDialog.xaml.cs

+ 9 - 1
PDF Office/App.config

@@ -1,8 +1,16 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
     <configSections>
     </configSections>
     <startup> 
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
     </startup>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
 </configuration>

+ 208 - 188
PDF Office/App.xaml.cs

@@ -1,201 +1,221 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using ComPDFKit.NativeMethod;
-using ComPDFKit_Conversion.Converter;
-using PDF_Office.CustomControl;
-using PDF_Office.CustomControl.SystemControl;
-using PDF_Office.ViewModels;
-using PDF_Office.Views;
-using PDF_Office.Views.BOTA;
-using PDF_Office.Views.Dialog;
-using PDF_Office.Views.HomePanel;
-using Prism.DryIoc;
-using Prism.Ioc;
-using Prism.Regions;
-using PDF_Office.Model;
-using PDF_Office.Views.PageEdit;
-using PDF_Office.Properties;
-using PDFSettings.Settings;
-using PDF_Office.Views.Tools; 
-using PDF_Office.Views.Dialog.ToolsDialogs.SaftyDialogs;
-using PDF_Office.Views.Dialog.ToolsDialogs.CompressDialogs;
-using PDF_Office.Views.Dialog.PageEditDialogs;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using ComPDFKit.NativeMethod;
+using ComPDFKit_Conversion.Converter;
+using PDF_Office.CustomControl;
+using PDF_Office.CustomControl.SystemControl;
+using PDF_Office.ViewModels;
+using PDF_Office.Views;
+using PDF_Office.Views.BOTA;
+using PDF_Office.Views.Dialog;
+using PDF_Office.Views.HomePanel;
+using Prism.DryIoc;
+using Prism.Ioc;
+using Prism.Regions;
+using PDF_Office.Model;
+using PDF_Office.Views.PageEdit;
+using PDF_Office.Properties;
+using PDFSettings.Settings;
+using PDF_Office.Views.Tools; 
+using PDF_Office.Views.Dialog.ToolsDialogs.SaftyDialogs;
+using PDF_Office.Views.Dialog.ToolsDialogs.CompressDialogs;
+using PDF_Office.Views.Dialog.PageEditDialogs;
 using PDF_Office.Views.Dialog.HomePageToolsDialogs ;
 using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter;
-
-
-namespace PDF_Office
-{
-    /// <summary>
-    /// App.xaml 的交互逻辑
-    /// </summary>
-    public partial class App : PrismApplication
-    {
-        public static string CurrentPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "PDF Office");
-
-        public static MainWindowViewModel mainWindowViewModel;
-
-        public static List<string> OpenedFileList = new List<string>();
-
-        public static bool IsFirstOpen = true;
-
-        public App()
-        {
-
-#if !DEBUG
-            //接入Appcenter后台数据检测
-            string appkey = "b099dccc-1ca5-4ea1-a2fa-afd4a6e1f8bb"
-            AppCenter.Start(appkey, typeof(Analytics), typeof(Crashes));
-            var countryCode = RegionInfo.CurrentRegion.TwoLetterISORegionName;//上传国家信息
-            AppCenter.SetCountryCode(countryCode);
-#endif
-            LicenseVerify();
-
-
-            if (Settings.Default.RecentOpenFiles == null)
-                Settings.Default.RecentOpenFiles = new RecentOpenFiles();
-
-            try
-            {
-                DirectoryInfo info = new DirectoryInfo(CurrentPath);
-                if (File.Exists(CurrentPath))
-                    File.Delete(CurrentPath);
-                if (!info.Exists)
-                {
-                    info.Create();
-                }
-            }
-            catch (Exception ex)
-            {
-
-            }
-        }
-
-        /// <summary>
-        /// 创建启动窗口
-        /// </summary>
-        /// <returns></returns>
-        protected override Window CreateShell()
-        {
- 
-            return Container.Resolve<MainWindow>();
-        }
-
-
-        protected override void RegisterTypes(IContainerRegistry containerRegistry)
-        {
-            //注册内容组件
-            containerRegistry.RegisterForNavigation<HomeContent>();
-            containerRegistry.RegisterForNavigation<ViewContent>();
-            containerRegistry.RegisterForNavigation<MainContent>();
-            containerRegistry.RegisterForNavigation<HomeCloudContent>("Cloud");
-            containerRegistry.RegisterForNavigation<HomeToolsContent>("Tools");
-            containerRegistry.RegisterForNavigation<HomeGuidContent>("Guid");
-            containerRegistry.RegisterForNavigation<BOTAContent>();
-            containerRegistry.RegisterForNavigation<PageEditContent>();
-            containerRegistry.RegisterForNavigation<ToolsBarContent>();
+using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
+using PDF_Office.Views.Dialog.ConverterDialogs;
+using PDF_Office.Helper;
+
+namespace PDF_Office
+{
+    /// <summary>
+    /// App.xaml 的交互逻辑
+    /// </summary>
+    public partial class App : PrismApplication
+    {
+        public static string CurrentPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "PDF Office");
+
+        public static MainWindowViewModel mainWindowViewModel;
+
+        public static List<string> OpenedFileList = new List<string>();
+
+        public static bool IsFirstOpen = true;
+
+        public App()
+        {
+
+#if !DEBUG
+            //接入Appcenter后台数据检测
+            string appkey = "b099dccc-1ca5-4ea1-a2fa-afd4a6e1f8bb"
+            AppCenter.Start(appkey, typeof(Analytics), typeof(Crashes));
+            var countryCode = RegionInfo.CurrentRegion.TwoLetterISORegionName;//上传国家信息
+            AppCenter.SetCountryCode(countryCode);
+#endif
+            LicenseVerify();
+
+
+            if (Settings.Default.RecentOpenFiles == null)
+                Settings.Default.RecentOpenFiles = new RecentOpenFiles();
+
+            try
+            {
+                DirectoryInfo info = new DirectoryInfo(CurrentPath);
+                if (File.Exists(CurrentPath))
+                    File.Delete(CurrentPath);
+                if (!info.Exists)
+                {
+                    info.Create();
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+        }
+
+        /// <summary>
+        /// 创建启动窗口
+        /// </summary>
+        /// <returns></returns>
+        protected override Window CreateShell()
+        {
+ 
+            return Container.Resolve<MainWindow>();
+        }
+
+
+        protected override void RegisterTypes(IContainerRegistry containerRegistry)
+        {
+            //注册内容组件
+            containerRegistry.RegisterForNavigation<HomeContent>();
+            containerRegistry.RegisterForNavigation<ViewContent>();
+            containerRegistry.RegisterForNavigation<MainContent>();
+            containerRegistry.RegisterForNavigation<HomeCloudContent>("Cloud");
+            containerRegistry.RegisterForNavigation<HomeToolsContent>("Tools");
+            containerRegistry.RegisterForNavigation<HomeGuidContent>("Guid");
+            containerRegistry.RegisterForNavigation<BOTAContent>();
+            containerRegistry.RegisterForNavigation<PageEditContent>();
+            containerRegistry.RegisterForNavigation<ToolsBarContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModSizeContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModPosterContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModMultipleContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModBookletContent>();
-            //注册弹窗
-            containerRegistry.RegisterDialog<VerifyPassWordDialog>(DialogNames.VerifyPassWordDialog);
-            containerRegistry.RegisterDialog<FullScreenWindow>(DialogNames.FullScreenDialog);
-            containerRegistry.RegisterDialog<CompressDialog>(DialogNames.CompressDialog);
-            containerRegistry.RegisterDialog<SetPasswordDialog>(DialogNames.SetPasswordDialog);
-            containerRegistry.RegisterDialog<CheckPasswordDialog>(DialogNames.CheckPasswordDialog);
-            containerRegistry.RegisterDialog<DeleteSafetySettingsDialog>(DialogNames.DeleteSafetySettingsDialog);
-            containerRegistry.RegisterDialog<CompressProgressBarDialog, PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs.CompresProgressBarDialogViewModel>(DialogNames.CompressProgressBarDialog);
-            containerRegistry.RegisterDialog<InsertDialog>(DialogNames.InsertDialog);
-            containerRegistry.RegisterDialog<SplitDialog>(DialogNames.SplitDialog);
-            containerRegistry.RegisterDialog<ExtractDialog>(DialogNames.ExtractDialog);
+            containerRegistry.RegisterForNavigation<HomePageCompressDialog>();
+            containerRegistry.RegisterForNavigation<HomePageSetPasswordDialog>();
+            containerRegistry.RegisterForNavigation<ConverterBarContent>();
+
+            //注册弹窗
+            containerRegistry.RegisterDialog<VerifyPassWordDialog>(DialogNames.VerifyPassWordDialog);
+            containerRegistry.RegisterDialog<FullScreenWindow>(DialogNames.FullScreenDialog);
+            containerRegistry.RegisterDialog<CompressDialog>(DialogNames.CompressDialog);
+            containerRegistry.RegisterDialog<SetPasswordDialog>(DialogNames.SetPasswordDialog);
+            containerRegistry.RegisterDialog<CheckPasswordDialog>(DialogNames.CheckPasswordDialog);
+            containerRegistry.RegisterDialog<DeleteSafetySettingsDialog>(DialogNames.DeleteSafetySettingsDialog);
+            containerRegistry.RegisterDialog<CompressProgressBarDialog, PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs.CompresProgressBarDialogViewModel>(DialogNames.CompressProgressBarDialog);
+            containerRegistry.RegisterDialog<InsertDialog>(DialogNames.InsertDialog);
+            containerRegistry.RegisterDialog<SplitDialog>(DialogNames.SplitDialog);
+            containerRegistry.RegisterDialog<ExtractDialog>(DialogNames.ExtractDialog);
             containerRegistry.RegisterDialog<HomePageExtractDialog>(DialogNames.HomePageExtractDialog);
             containerRegistry.RegisterDialog<HomePageInsertDialog>(DialogNames.HomePageInsertDialog);
             containerRegistry.RegisterDialog<HomePageSplitDialog>(DialogNames.HomePageSplitDialog);
             containerRegistry.RegisterDialog<HomePagePrinterDialog>(DialogNames.HomePagePrinterDialog);
             containerRegistry.RegisterDialog<HomePagePrinterPageSetDialog>(DialogNames.HomePagePrinterPageSetDialog);
-
-        }
-
-        protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)
-        {
-            var region = new SingleActiveRegion() { Name = RegionNames.MainRegion };
-
-            region.Behaviors.Add(DragablzWindowBehavior.BehaviorKey, new DragablzWindowBehavior());
-
-            Container.Resolve<IRegionManager>().Regions.Add(region);
-
-            base.ConfigureRegionAdapterMappings(regionAdapterMappings);
-        }
-
-        private static bool LicenseVerify()
-        {
-            bool result = false;
-            try
-            {
-                result = CPDFSDKVerifier.LoadNativeLibrary();
-                if (!result)
-                    return false;
-            }
-            catch{ }
-            string devKey = "";
-            string devSecret = "";
-#if DEBUG
+            containerRegistry.RegisterDialog<HomePagePictureToPDFDialog>(DialogNames.HomePagePictureToPDFDialog);
+            containerRegistry.RegisterDialog<HomePageBatchProcessingDialog>(DialogNames.HomePageBatchProcessingDialog);
+            containerRegistry.RegisterDialog<ConverterCSVDialog>(DialogNames.ConverterCSVDialog);
+            containerRegistry.RegisterDialog<ConverterPPTDialog>(DialogNames.ConverterPPTDialog);
+            containerRegistry.RegisterDialog<ConverterTextDialog>(DialogNames.ConverterTextDialog);
+            containerRegistry.RegisterDialog<ConverterWordDialog>(DialogNames.ConverterWordDialog);
+            containerRegistry.RegisterDialog<ConverterHTMLDialog>(DialogNames.ConverterHTMLDialog);
+            containerRegistry.RegisterDialog<ConverterImgDialog>(DialogNames.ConverterImgDialog);
+            containerRegistry.RegisterDialog<ConverterRTFDialog>(DialogNames.ConverterRTFDialog);
+            containerRegistry.RegisterDialog<ConverterExcelDialog>(DialogNames.ConverterExcelDialog);
+            containerRegistry.RegisterDialog<ConverterProgressBarDialog>(DialogNames.ConverterProgressBarDialog);
+
+
+        }
+
+        protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)
+        {
+            var region = new SingleActiveRegion() { Name = RegionNames.MainRegion };
+
+            region.Behaviors.Add(DragablzWindowBehavior.BehaviorKey, new DragablzWindowBehavior());
+
+            Container.Resolve<IRegionManager>().Regions.Add(region);
+
+            base.ConfigureRegionAdapterMappings(regionAdapterMappings);
+        }
+
+        /// <summary>
+        /// 验证SDK和转档库密钥
+        /// </summary>
+        /// <returns></returns>
+        private static bool LicenseVerify()
+        {
+            bool result = false;
+            try
+            {
+                result = CPDFSDKVerifier.LoadNativeLibrary();
+                if (!result)
+                    return false;
+            }
+            catch{ }
+            SDKLisenceHelper sdkhelper = new SDKLisenceHelper();
+            string devKey = "";
+            string devSecret = "";
+#if DEBUG
             devKey = "ehrnKqkWc1XSEAWyPUt6+95GzCoLEyoKrCbsUuJkCqGmxmP5ozX4bS0R6crHItQVNTFvC5mBZ1M7QjJ6Ekdu4Daj7PM+EDLTBKbFJinK4Ri9E5E2X+a9vF5zSj0TkIscQPVnwj9ikxAFOWGIyybMwQQzwc8a4j1cGOqGXQRDMMY=";
             devSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4gQurxTxGuBlGAhs0P1mD3X3bHT+AHfcLiymaqE4DY7kTFHoPs9I3tl5ErS+BHdzHRhrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1367/WkJ00tM7U7tttD6ccHhEu996bvBgqf8Sw8OekQKQq13VBewK5AckaDux4W7SGRhCUNWC4MItkr36JnXMD2tiFQYzMG8C66HYmRGSLh";
-#endif
-
-            string userKey = "iBPRM/Tz8b6Z1G2GQt52X7hiNCGfVYXztnPjalgrgARvqfKV6lFNH8QeScTzBRYI8GGFpwelfgh790Kd9JmL7V4adI1jCiFHUT2DLT7QucxY5Nkgys2aJItQS482Ck2G2Xf8gNgojxYxRt65o/MEzkj93foj8qIdfHagXsSorSs=";
-            string userSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4ivEHOmPIqbfhpDnKKj+7Ymj2rXQvfZRmke06HMV+3tt064G64WjPW8+EbGCNZaAh1hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1FKJi6HYB+DuugQyaqI2prfej861QnJrU4s2T/npZK/";
-
-            try
-            {
-                CPDFSDKVerifier.LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(devKey, devSecret, userKey, userSecret);
-                if (verifyResult != CPDFSDKVerifier.LicenseErrorCode.LICENSE_ERR_SUCCESS)
-                    return false;
-            }
-            catch{ }
-
-
-
-            string ConverterDevKey = "mDDCTNY5rV2+FUj2JESUBruJ0643Tv7rNuxACu6g3L/0guIw1r8zZB+o3aw3rs4rrOThmxBXpEDcItvyGx096mF/3Ixg7aD6QZk5HvBEScIPerdM3KnhgwMwCjE0DYOSMCRwAhbA2xjXfXgT5VVo7JZroKOGQB5Qmf2kLl5nQuU=";
-            string ConverterDevSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4g3S5AixMY+3TX1FpQaugG9sTsnCq4QxIEDzyAI3s3dWjNe3wDsMrmFq51HtjPa2tSFAoV6NtcUJC8skonXVk7kMv7C2jvq4o0q6sQtN3jR42k0n/LkN5UfbQ5Lfel4OfZrk7dh2/DUR87Ps4vBX1hrYkwcNWVMyYvggPV2rTFvfawopGIC034QzjthmhwwX90=";
-            string ConverterUserkey = "WLUHzXhndQKyrTJVzvZ+dvPXDQDZeJpcSvklX3GJwRX4+urd8eQskYgbeCf0NXLZ/qJkS/k10x+qGad34i4v5rI/ASFIx901c/Nw5C0YJMH7X87dib141tdAmSmQhnKLO5TBi4FiAidboyvnLFLrYGMmS2kLQOXFPwPj5zQUv5A=";
-            string ConverterUserSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iK16EcneqBPRe2eKQLuJXpA79IONX9GVI/Ap3uWzMcNWaitc2UB6gDeexJXFPVaXOFAoV6NtcUJC8skonXVk7k/oKTJGcYKLPGdXenrzHolQ==";
-
-            try
-            {
-                /*LicenseError licenseerror = CPDFConverter.SDKLicenseVerify(ConverterDevKey, ConverterDevSecret, ConverterUserkey, ConverterUserSecret);
-            string resPath = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location) + "\\";
-            if (licenseerror != LicenseError.ERR_SUCCESS)
-            {
-                return false;
-            }
-                CPDFConverter.Init(resPath);*/
-                string resPath = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location) + "\\";
-                LicenseError licenseerror = CPDFConverter.LicenseVerify(ConverterDevKey, ConverterDevSecret, ConverterUserkey, ConverterUserSecret);
-                if (licenseerror != LicenseError.ERR_SUCCESS)
-                {
-                    //MessageBox.Show("ComPDFKit Conversion SDK Load Failed!");
-                    return false;
-                }
-                CPDFConverter.Init(resPath);
-            }
-            catch{ }
-            return result;
-        }
-
-        protected override void OnExit(ExitEventArgs e)
-        {
-            Environment.Exit(1);
-            base.OnExit(e);
-        }
-    }
-}
+#endif
+            string userKey = sdkhelper.UserKey; 
+            string userSecret = sdkhelper.UserSecret; 
+
+            try
+            {
+                CPDFSDKVerifier.LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(devKey, devSecret);
+                if (verifyResult != CPDFSDKVerifier.LicenseErrorCode.LICENSE_ERR_SUCCESS)
+                    return false;
+            }
+            catch{ }
+
+            string ConverterDevKey = sdkhelper.ConverterDevKey;
+            string ConverterDevSecret = sdkhelper.ConverterDevSecret; 
+            string ConverterUserkey = sdkhelper.ConverterUserkey; 
+            string ConverterUserSecret = sdkhelper.ConverterUserSecret;
+
+            try
+            {
+                /*LicenseError licenseerror = CPDFConverter.SDKLicenseVerify(ConverterDevKey, ConverterDevSecret, ConverterUserkey, ConverterUserSecret);
+            string resPath = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location) + "\\";
+            if (licenseerror != LicenseError.ERR_SUCCESS)
+            {
+                return false;
+            }
+                CPDFConverter.Init(resPath);*/
+                string resPath = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location) + "\\";
+                LicenseError licenseerror = CPDFConverter.LicenseVerify(ConverterDevKey, ConverterDevSecret);
+                if (licenseerror != LicenseError.ERR_SUCCESS)
+                {
+                    //MessageBox.Show("ComPDFKit Conversion SDK Load Failed!");
+                    return false;
+                }
+                CPDFConverter.Init(resPath);
+            }
+            catch{ }
+            return result;
+        }
+
+        protected override void OnExit(ExitEventArgs e)
+        {
+            Environment.Exit(1);
+            base.OnExit(e);
+        }
+    }
+}

BIN
PDF Office/ComPDFKit.Desk.dll


BIN
PDF Office/ComPDFKit.Viewer.dll


BIN
PDF Office/ComPDFKit_Conversion.dll


+ 12 - 10
PDF Office/CustomControl/PageTurningPreview.xaml

@@ -5,23 +5,25 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.CustomControl"
              mc:Ignorable="d" 
-             d:DesignHeight="350" d:DesignWidth="300">
-    <Grid>
-        <Border  Margin="10,40,10,40" Background="LightGray"  Height="218" Width="176">
+             Height="280" Width="200">
+    <Grid Width="200" Height="280">
+        <StackPanel Orientation="Vertical" Height="280">
+        <Border  Margin="0,16,0,0" HorizontalAlignment="Center" VerticalAlignment="Top" Background="LightGray"  Height="218" Width="176">
             <Viewbox>
-                <Image Name="Image"></Image>
+                    <Image Name="Image" Height="218" Width="176"></Image>
             </Viewbox>
         </Border>
-        <StackPanel Orientation="Horizontal"  Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom">
-            <Button Name="PrePage" Width="20" Click="PrePage_Click" Height="20" HorizontalAlignment="Left" FontSize="16" Background="WhiteSmoke" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
+        <StackPanel Orientation="Horizontal"  Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,16,0,0">
+            <Button Name="PrePage" Width="24" Click="PrePage_Click" Height="24" HorizontalAlignment="Left" FontSize="16" Background="WhiteSmoke" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
                 <TextBlock Text="&lt;" VerticalAlignment="Center" ></TextBlock>
             </Button>
-            <TextBox x:Name="CurrentPage" Width="30" Height="25" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10,0,5,0" Text="1" InputMethod.IsInputMethodEnabled="False"   PreviewTextInput="CountTextBox_PreviewTextInput" KeyDown="CurrentPage_KeyDown"></TextBox>
-            <TextBlock  Text="of"  HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0"></TextBlock>
-            <TextBlock x:Name="PageIndex"  HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
-            <Button Name="NextPage" Click="NextPage_Click" Width="20" Height="20" HorizontalAlignment="Left" FontSize="16"  Background="WhiteSmoke"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
+            <TextBox x:Name="CurrentPage" Width="48" Height="24" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="11,0,2,0" Text="1" InputMethod.IsInputMethodEnabled="False"   PreviewTextInput="CountTextBox_PreviewTextInput" KeyDown="CurrentPage_KeyDown"></TextBox>
+            <TextBlock  Text="of" Margin="0,0,2,0"  HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
+                <TextBlock  x:Name="PageIndex" VerticalAlignment="Center" Block.TextAlignment="Center"  Width="23"/>
+                <Button Name="NextPage" Click="NextPage_Click" Width="24" Height="24" HorizontalAlignment="Left" FontSize="16"  Background="WhiteSmoke"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="17,0,0,0">
                 <TextBlock Text=">" VerticalAlignment="Center"></TextBlock>
             </Button>
         </StackPanel>
+        </StackPanel>
     </Grid>
 </UserControl>

+ 30 - 21
PDF Office/CustomControl/PageTurningPreview.xaml.cs

@@ -1,7 +1,9 @@
 using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFPage;
+using PDF_Office.Helper;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Text.RegularExpressions;
@@ -25,14 +27,17 @@ namespace PDF_Office.CustomControl
     public partial class PageTurningPreview : UserControl
     {
         public CPDFDocument document;
+        public List<int> PageIndexLists = new List<int>();
+        public int CurrentIndex=0;
         public PageTurningPreview()
-        {
+        {   
             InitializeComponent();
+         
         }
 
         public async Task RenderBitmap(CPDFDocument doc)
         {
-            CPDFPage page = new CPDFPage(doc, int.Parse(this.CurrentPage.Text) - 1, true);
+            CPDFPage page = doc.PageAtIndex(PageIndexLists[CurrentIndex]);
             byte[] bmp_data = new byte[(int)page.PageSize.Width * (int)page.PageSize.Height * 4];
             await Task.Run(delegate
             {
@@ -49,10 +54,11 @@ namespace PDF_Office.CustomControl
 
         private void PrePage_Click(object sender, RoutedEventArgs e)
         {
-            if (int.Parse(this.CurrentPage.Text) > 1)
+
+            if (CurrentIndex > 0)
             {
-                int Page = int.Parse(this.CurrentPage.Text);
-                this.CurrentPage.Text = (--Page).ToString();
+                CurrentIndex--;
+                this.CurrentPage.Text = (PageIndexLists[CurrentIndex] + 1).ToString();
                 if (document != null)
                 {
                     AwaitRenderBitmap(document);
@@ -62,40 +68,43 @@ namespace PDF_Office.CustomControl
 
         private void NextPage_Click(object sender, RoutedEventArgs e)
         {
-            if (int.Parse(this.CurrentPage.Text) < document.PageCount)
+            if (CurrentIndex < PageIndexLists.Count()-1 && PageIndexLists.Count() > 0)
             {
-                int Page = int.Parse(this.CurrentPage.Text);
-                this.CurrentPage.Text = (++Page).ToString();
-                if (document != null)
+                CurrentIndex++;
+                this.CurrentPage.Text = (PageIndexLists[CurrentIndex]+1).ToString();
+                    if (document != null)
                 {
                     AwaitRenderBitmap(document);
                 }
             }
+           
+            
         }
 
         private void CurrentPage_KeyDown(object sender, KeyEventArgs e)
         {
+            
             if (e.Key == Key.Enter)
             {
-                if (this.CurrentPage.Text == "" || int.Parse(this.CurrentPage.Text) < 1)
+                if (this.CurrentPage.Text == "" || !int.TryParse(this.CurrentPage.Text, out int _))
                 {
-                    this.CurrentPage.Text = "1";
+                    this.CurrentPage.Text = (PageIndexLists[0] + 1).ToString();
                 }
                 if (this.PageIndex != null)
                 {
-                    if (int.Parse(this.CurrentPage.Text) > int.Parse(this.PageIndex.Text))
+                    if (PageIndexLists.Contains( int.Parse(this.CurrentPage.Text)-1))
                     {
-                        this.CurrentPage.Text = this.PageIndex.Text;
+                        CurrentIndex=PageIndexLists.IndexOf(int.Parse(this.CurrentPage.Text)-1);
+                        this.CurrentPage.Text = (PageIndexLists[CurrentIndex]+1).ToString();
+                        AwaitRenderBitmap(document);
+                    }
+                    else
+                    {
+                        this.CurrentPage.Text = (PageIndexLists[CurrentIndex] + 1).ToString();
+                        MessageBox.Show("超出页面范围");
                     }
                 }
-                if (int.Parse(this.CurrentPage.Text) <= document.PageCount && int.Parse(this.CurrentPage.Text) > 0)
-                {
-                    AwaitRenderBitmap(document);
-                }
-                else
-                {
-                    MessageBox.Show("超出页面范围");
-                }
+                
             }
         }
 

+ 2 - 2
PDF Office/CustomControl/WritableComboBox.xaml

@@ -5,11 +5,11 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.CustomControl"
              mc:Ignorable="d" 
-             d:DesignHeight="32" d:DesignWidth="200">
+             d:DesignHeight="28" d:DesignWidth="200">
     <Grid>
 
 
-        <ComboBox x:Name="writableComboBox" Grid.Column="1"  Visibility="Visible" MinHeight="32"  MinWidth="58"
+        <ComboBox x:Name="writableComboBox" Grid.Column="1"  Visibility="Visible" MinHeight="28"  MinWidth="58"
                                       SelectionChanged="writableComboBox_SelectionChanged" SelectedIndex="0">
             <ComboBoxItem >全部页面</ComboBoxItem>
             <ComboBoxItem >奇数页</ComboBoxItem>

+ 29 - 0
PDF Office/DataConvert/UnVisivleConvert.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows;
+
+namespace PDF_Office.DataConvert
+{
+    public class UnVisivleConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if ((Visibility)value == Visibility.Visible)
+            {
+                return Visibility.Collapsed;
+            }
+            else
+                return Visibility.Visible;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 237 - 0
PDF Office/Helper/ConverterHelper.cs

@@ -0,0 +1,237 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ComPDFKit_Conversion.Converter;
+using System.Diagnostics;
+using System.IO;
+using Microsoft.AppCenter.Crashes.Ingestion.Models;
+using static Dropbox.Api.Sharing.ListFileMembersIndividualResult;
+using ComPDFKit_Conversion.Options;
+using PDF_Office.CustomControl;
+using Exception = System.Exception;
+
+namespace PDF_Office.Helper
+{
+    public static class ConverterHelper
+    {
+        public static CPDFConverterWord wordConverter = null;
+        public static CPDFConverterExcel excelConverter = null;
+        public static CPDFConverterPPT pptConverter = null;
+        public static CPDFConverterTxt txtConverter = null;
+        public static CPDFConverterCsv csvConverter = null;
+        public static CPDFConverterImg imgConverter = null;
+        public static async Task<bool> WordConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword)
+        {
+            bool result = false;
+            try
+            {
+                int[] pageArray = pageIndexLists.ToArray();
+                wordConverter = new CPDFConverterWord(inputpath, pawssword);
+                string outputFolder = outputpath;
+                string outputFileName = Path.GetFileNameWithoutExtension(inputpath);
+                ConvertError error = ConvertError.ERR_UNKNOWN;
+                string filename = GetFileNameAddSuffix(outputFolder, outputFileName, ".docx");
+                result = await Task.Run(() => wordConverter.Convert(outputFolder, ref outputFileName, pageArray, ref error, getProgress));
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return result;
+        }
+
+        public static async Task<bool> PPTConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword)
+        {
+            bool result = false;
+            try
+            {
+                int[] pageArray = pageIndexLists.ToArray();
+
+                pptConverter = new CPDFConverterPPT(inputpath, pawssword);
+                string outputFolder = outputpath;
+                string outputFileName = Path.GetFileNameWithoutExtension(inputpath);
+                ConvertError error = ConvertError.ERR_UNKNOWN;
+
+                string filename = GetFileNameAddSuffix(outputFolder, outputFileName, ".ppt");
+
+                result = await Task.Run(() => pptConverter.Convert(outputFolder, ref outputFileName, pageArray, ref error, getProgress));
+                if (result)
+                {
+                    if (File.Exists(outputFileName))
+                        Process.Start(outputFileName);
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return result;
+        }
+
+        public static async Task<bool> ExcelConvert(string inputpath, string outputpath,OnProgress getProgress , List<int> pageIndexLists, string pawssword,CPDFConvertExcelOptions ExcelOption)
+        {
+            bool result = false;
+            try
+            {
+                excelConverter = new CPDFConverterExcel(inputpath,pawssword);
+                int[] pageArray = pageIndexLists.ToArray();
+
+                string outputFolder = outputpath;
+                string outputFileName = Path.GetFileNameWithoutExtension(inputpath);
+                ConvertError error = ConvertError.ERR_UNKNOWN;
+                 result = await Task.Run(() => excelConverter.Convert(outputFolder, ref outputFileName, ExcelOption, pageArray, ref error, getProgress));
+                if (result)
+                {
+                    if (File.Exists(outputFileName))
+                        Process.Start(outputFileName);
+                    else if (outputFileName == "NoTable")
+                        MessageBoxEx.Show("No Table");
+                }
+               
+                   
+            }
+            catch (Exception ex)
+           {
+
+               }
+            return result;
+        }
+
+        //public static async Task<bool> TableConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword)
+        //{
+        //    bool result = false;
+        //    try
+        //    {
+        //        int[] pageArray = pageIndexLists.ToArray();
+        //        tableConverter = new CPDFConverterTable(inputpath, pawssword);
+        //        string outputFolder = outputpath;
+        //        string outputFileName = Path.GetFileNameWithoutExtension(inputpath);
+        //        ConvertError error = ConvertError.ERR_UNKNOWN;
+        //        string filename = GetFileNameAddSuffix(outputFolder, outputFileName, ".xlsx");
+        //        result = await Task.Run(() => tableConverter.Convert(outputFolder, ref outputFileName, pageArray, ref error, getProgress));
+
+        //    }
+        //    catch (Exception ex)
+        //    {
+
+        //    }
+        //    return result;
+        //}
+
+        public static async Task<bool> CSVConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword)
+        {
+            bool result = false;
+            try
+            {
+                int[] pageArray = pageIndexLists.ToArray();
+
+                csvConverter = new CPDFConverterCsv(inputpath, pawssword);
+                string outputFolder = outputpath;
+                string outputFileName = Path.GetFileNameWithoutExtension(inputpath);
+                ConvertError error = ConvertError.ERR_UNKNOWN;
+                string filename = GetFileNameAddSuffix(outputFolder, outputFileName, ".csv");
+                result = await Task.Run(() => csvConverter.Convert(outputFolder, ref outputFileName, pageArray, ref error, getProgress));
+
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return result;
+        }
+
+        public static async Task<bool> TxtConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword)
+        {
+            bool result = false;
+            try
+            {
+                int[] pageArray = pageIndexLists.ToArray();
+
+                txtConverter = new CPDFConverterTxt(inputpath, pawssword);
+                string outputFolder = outputpath;
+                string outputFileName = Path.GetFileNameWithoutExtension(inputpath);
+                ConvertError error = ConvertError.ERR_UNKNOWN;
+                string filename = GetFileNameAddSuffix(outputFolder, outputFileName, ".txt");
+                result = await Task.Run(() => txtConverter.Convert(outputFolder, ref outputFileName, pageArray, ref error, getProgress));
+
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return result;
+        }
+
+        public static async Task<bool> ImgConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists,string pawssword, ImgType type)
+        {
+            bool result = false;
+            try
+            {
+                int[] pageArray = pageIndexLists.ToArray();
+
+                imgConverter = new CPDFConverterImg(inputpath, pawssword);
+                string outputFolder = outputpath;
+                string outputFileName = Path.GetFileNameWithoutExtension(inputpath);
+                ConvertError error = ConvertError.ERR_UNKNOWN;
+                result = await Task.Run(() => imgConverter.Convert(outputFolder, ref outputFileName, pageArray, type, ref error, getProgress));
+                if (result)
+                {
+                    if (File.Exists(outputFileName))
+                        Process.Start(outputFileName);
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return result;
+        }
+
+        public static void Clear()
+        {
+            if (wordConverter != null)
+            {
+                wordConverter.Cancel();
+            }
+            if (excelConverter != null)
+            {
+                excelConverter.Cancel();
+            }
+            if (pptConverter != null)
+            {
+                pptConverter.Cancel();
+            }
+            if (txtConverter != null)
+            {
+                txtConverter.Cancel();
+            }
+            //if (tableConverter != null)
+            //{
+            //    tableConverter.Cancel();
+            //}
+            if (csvConverter != null)
+            {
+                csvConverter.Cancel();
+            }
+            Console.WriteLine("killed");
+        }
+        private static void StartFile(string path)
+        {
+            //Process.Start(path);
+        }
+        public static string GetFileNameAddSuffix(string path, string filename, string suffix)
+        {
+            int i = 1;
+            string outname = filename;
+            while (File.Exists(path + @"\" + outname + suffix))
+            {
+                outname = filename + $"({i.ToString()})";
+                i++;
+            }
+            return outname;
+        }
+
+    }
+}

+ 2 - 2
PDF Office/Helper/HomePageEditHelper.cs

@@ -75,7 +75,7 @@ namespace PDF_Office.Helper
 
         }
 
-        public static void GetPagerange(string PageRangeSelectIndex, CPDFViewer currentViewer, ref string pageRange, string pageRangeText, bool currentpage = false)
+        public static void GetPagerange(string PageRangeSelectIndex, CPDFViewer currentViewer, ref string pageRange, string pageRangeText, bool currentpage = false, string currentPageRange="1")
         {
             if (!currentpage)
             {
@@ -118,7 +118,7 @@ namespace PDF_Office.Helper
                 }
                 if (PageRangeSelectIndex == "1")
                 {
-                    //pageRange = pageRange;
+                    pageRange = currentPageRange;
                     Trace.WriteLine(" extractModel.PageRange" + pageRange);
                 }
                 else if (PageRangeSelectIndex == "2")

+ 134 - 0
PDF Office/Helper/PictureConverter.cs

@@ -0,0 +1,134 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Helper
+{
+    public class PictureConverter
+    {
+        /// <summary>
+        /// 图片转PNG(其他图片先转为PNG在转JPG)
+        /// picturefile 图片文件名
+        /// filePath 保存路径例如//filePath.png
+        /// </summary>
+        public static bool  SavePng(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 图片转PNG(其他图片先转为PNG在转JPG)
+        /// picturefile 图片image
+        /// filePath 保存路径例如//filePath.png
+        /// </summary>
+        public static bool SavePng(Image img, string filePath)
+        {
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 图片转JPeG
+        /// picturefile 图片文件名
+        /// filePath 保存路径例如//filePath.jpg
+        /// </summary>
+        public static bool SaveJpeg(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    //存储各种格式
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 图片转JPeG
+        /// img 图片Image
+        /// filePath 保存路径例如//filePath.jpg
+        /// </summary>
+        public static bool SaveJpeg(Image img, string filePath)
+        {
+            
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    //存储各种格式
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+    }
+}

+ 48 - 0
PDF Office/Helper/SDKLisenceHelper.cs

@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace PDF_Office.Helper
+{
+    public  class SDKLisenceHelper
+    {
+        /// <summary>
+        /// 从XML文件读取sdk密钥信息
+        /// </summary>
+        public SDKLisenceHelper()
+        {
+            string xmlPath = "SDKLisence";
+            Assembly assembly = Assembly.GetExecutingAssembly();
+            var stream =  (string)Properties.Resources.ResourceManager.GetObject(xmlPath);
+            XmlDocument xmlDoc = new XmlDocument();
+            xmlDoc.LoadXml(stream);
+            var node = xmlDoc.SelectSingleNode("Lisences");
+            if (node != null)
+            {
+                DevKey = node.Attributes["devKey"].Value.ToString();
+                DevSecret = node.Attributes["devSecret"].Value.ToString();
+                UserKey = node.Attributes["userKey"].Value.ToString();
+                UserSecret = node.Attributes["userSecret"].Value.ToString();
+                ConverterDevKey = node.Attributes["ConverterDevKey"].Value.ToString();
+                ConverterDevSecret = node.Attributes["ConverterDevSecret"].Value.ToString();
+                ConverterUserkey = node.Attributes["ConverterUserkey"].Value.ToString();
+                ConverterUserSecret = node.Attributes["ConverterUserSecret"].Value.ToString();
+            }
+        }
+
+        public string DevKey{ get; set; }
+
+        public string DevSecret { get; set; }
+        public string UserKey { get; set; }
+        public string UserSecret { get; set; }
+        public string ConverterDevKey { get; set; }
+        public string ConverterDevSecret { get; set; }
+        public string ConverterUserkey { get; set; }
+        public string ConverterUserSecret{ get; set; }
+    }
+}

+ 53 - 0
PDF Office/Model/CloudDrive/CloudDriveItem.cs

@@ -0,0 +1,53 @@
+using Google.Apis.Auth.OAuth2;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.CloudDrive
+{
+    //云盘信息
+    public enum CloudType
+    {
+        Box,
+        DropBox,
+        GoogleDrive,
+        OneDrive
+    }
+
+
+    public class CloudBoxItem
+    {
+        public CloudType CloudDiskType { get; set; }
+        public List<UserCredential> UserCredentials { get; set; }
+        public string UsersInfoPath { get; set; }
+        public int Id { get; set; }
+        public string DriveName { get; private set; }
+        public CloudBoxItem(CloudType cloudDiskType)
+        {
+            CloudDiskType = cloudDiskType;
+            GetName(CloudDiskType);
+        }
+
+        private void GetName(CloudType cloudDiskType)
+        {
+            switch (cloudDiskType)
+            {
+                case CloudType.Box:
+                    DriveName = "Box";
+                    break;
+                case CloudType.DropBox:
+                    DriveName = "DropBox";
+                    break;
+                case CloudType.GoogleDrive:
+                    DriveName = "Google Drive";
+                    break;
+                case CloudType.OneDrive:
+                    DriveName = "OneDrive";
+                    break;
+
+            }
+        }
+    }
+}

+ 94 - 0
PDF Office/Model/CloudDrive/CloudFiles.cs

@@ -0,0 +1,94 @@
+using Google.Apis.Auth.OAuth2;
+using Google.Apis.Drive.v3;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.CloudDrive
+{
+    public class Cloud
+    {
+        public static ObservableCollection<UserBaseItem> CloudLists = new ObservableCollection<UserBaseItem>();
+
+        public static List<CloudBoxItem> InitCloudBoxs()
+        {
+            List<CloudBoxItem> CloudeDrives = new List<CloudBoxItem>();
+
+            var cloudDriveItem = new CloudBoxItem(CloudType.Box);
+            CloudeDrives.Add(cloudDriveItem);
+
+            cloudDriveItem = new CloudBoxItem(CloudType.DropBox);
+            CloudeDrives.Add(cloudDriveItem);
+
+            cloudDriveItem = new CloudBoxItem(CloudType.GoogleDrive);
+            CloudeDrives.Add(cloudDriveItem);
+
+            cloudDriveItem = new CloudBoxItem(CloudType.OneDrive);
+            CloudeDrives.Add(cloudDriveItem);
+
+            return CloudeDrives;
+        }
+    }
+
+    #region 公有云盘
+
+    /// <summary>
+    /// 用户信息
+    /// </summary>
+    public class UserInfo
+    {
+
+        public string Name { get; set; }
+        public int Id { get; set; }
+
+        public string UserAccount { get; set; }
+    }
+
+    /// <summary>
+    /// 用户云盘
+    /// </summary>
+    public class UserBaseItem
+    {
+        public UserInfo userInfo { get; set; }
+        public CloudType cloudType { get; set; }
+    }
+
+    #endregion
+
+    #region GooglrDrive
+
+    /// <summary>
+    /// 谷歌云盘的文件
+    /// </summary>
+    public class GoogleDriveFiles
+    {
+        public string Id { get; set; }
+        public string Name { get; set; }
+        public long? Size { get; set; }
+        public long? Version { get; set; }
+        public DateTime? CreatedTime { get; set; }
+    }
+
+    #endregion
+
+
+    #region GooglrDrive
+
+    /// <summary>
+    /// 谷歌云盘的文件
+    /// </summary>
+    public class DropbBoxFiles
+    {
+        public string Id { get; set; }
+        public string Name { get; set; }
+        public long? Size { get; set; }
+        public DateTime? CreatedTime { get; set; }
+    }
+
+    #endregion
+
+
+}

+ 13 - 0
PDF Office/Model/Dialog/ConverterDialogs/ConverterCSVDialogModel.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.ConverterDialogs
+{
+    public class ConverterCSVDialogModel : ConverterDialogsModel
+    {
+
+    }
+}

+ 44 - 0
PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using ComPDFKit_Conversion.Converter;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.ConverterDialogs
+{
+    public class ConverterDialogsModel
+    {
+
+        /// <summary>
+        /// 文档地址;
+        /// </summary>
+        public string InputPath="";
+
+        /// <summary>
+        /// 输出地址;
+        /// </summary>
+        public string OutputPath="";
+
+        /// <summary>
+        /// 进度;
+        /// </summary>
+        public OnProgress GetProgress=null;
+
+        /// <summary>
+        /// 页码 页码范围;
+        /// </summary>
+        public List<int> PageIndexLists= new List<int> { };
+
+        /// <summary>
+        /// 页面信息
+        /// </summary>
+        public string PageRange = "1,3-4,10";
+
+        /// <summary>
+        /// 文档密码;
+        /// </summary>
+        public string Pawssword="";
+
+    }
+}

+ 22 - 0
PDF Office/Model/Dialog/ConverterDialogs/ConverterExcelDialogModel.cs

@@ -0,0 +1,22 @@
+using ComPDFKit_Conversion.Options;
+using Microsoft.AppCenter.Crashes.Ingestion.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.ConverterDialogs
+{
+    public class ConverterExcelDialogModel : ConverterDialogsModel
+    {
+        public CPDFConvertExcelOptions excelOption=new CPDFConvertExcelOptions();
+
+        public CPDFConvertExcelOptions ExcelOptions(WorksheetOptions worksheetOptions = WorksheetOptions.ForEachPage,ContentOptions contentOptions = ContentOptions.AllContent) {
+
+            excelOption.ContentOpts= contentOptions;
+            excelOption.WorksheetOpts= worksheetOptions;
+            return excelOption;
+        }
+    }
+}

+ 12 - 0
PDF Office/Model/Dialog/ConverterDialogs/ConverterHTMLDialogModel.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.ConverterDialogs
+{
+    public class ConverterHTMLDialogModel : ConverterDialogsModel
+    {
+    }
+}

+ 15 - 0
PDF Office/Model/Dialog/ConverterDialogs/ConverterImgDialogModel.cs

@@ -0,0 +1,15 @@
+using ComPDFKit_Conversion.Converter;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.ConverterDialogs
+{
+    public class ConverterImgDialogModel : ConverterDialogsModel
+    {
+        public ImgType Type =ImgType.JPEG;
+        public string DPI = "50";
+    }
+}

+ 12 - 0
PDF Office/Model/Dialog/ConverterDialogs/ConverterPPTDialogModel.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.ConverterDialogs
+{
+    public class ConverterPPTDialogModel : ConverterDialogsModel
+    {
+    }
+}

+ 12 - 0
PDF Office/Model/Dialog/ConverterDialogs/ConverterRTFDialogModel.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.ConverterDialogs
+{
+    public class ConverterRTFDialogModel : ConverterDialogsModel
+    {
+    }
+}

+ 12 - 0
PDF Office/Model/Dialog/ConverterDialogs/ConverterTextDialogModel.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.ConverterDialogs
+{
+    public class ConverterTextDialogModel : ConverterDialogsModel
+    {
+    }
+}

+ 12 - 0
PDF Office/Model/Dialog/ConverterDialogs/ConverterWordDialogModel.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.ConverterDialogs
+{
+    public class ConverterWordDialogModel : ConverterDialogsModel
+    {
+    }
+}

+ 18 - 0
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBatchProcessingDialogModel.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing
+{
+    public class HomePageBatchProcessingDialogModel
+    {
+        public static int BatchProcessingIndex = 0;
+
+        public static List<string> FilePaths=new List<string>();
+        // "HomePageShiftingDialog","HomePageCompressDialog" , "HomePageSetPasswordDialog", "HomePageWatermarkDialog", "HomePageBackgroundDialog", "HomePageHeaderFooterDialog", "HomePageBatesDialog", "HomePageDeleteSafetySettintgsDialog"
+        public static List<string> GetBatchProcessing = new List<string> { "HomePageShiftingDialog", "HomePageCompressDialog", "HomePageSetPasswordDialog", "HomePageWatermarkDialog", "HomePageBackgroundDialog", "HomePageHeaderFooterDialog", "HomePageBatesDialog", "HomePageDeleteSafetySettintgsDialog" };
+
+    }
+}

+ 22 - 0
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageCompressDialogModel.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing
+{
+    public class HomePageCompressDialogModel
+    {
+        public enum EnumQualityLevel
+        {
+            StatusLarge = 100,
+            StatusStandard = 80,
+            StatusDefault = 45,
+            StatusLittle = 40,
+            StatusMicro = 10
+        }
+
+        public EnumQualityLevel CompressQuality { get; set; } = EnumQualityLevel.StatusLittle;
+    }
+}

+ 100 - 0
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageSetPasswordDialogModel.cs

@@ -0,0 +1,100 @@
+using ComPDFKit.PDFDocument;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing
+{
+    public class HomePageSetPasswordDialogModel
+    {
+        public bool CanOpen { get; set; }
+
+        public bool CanEdit { get; set; }
+
+        public static string PasswordForOpen { get; set; }
+
+        public static string PasswordForEdit { get; set; }
+
+        public enum PrintMod
+        {
+            None,
+            LowDpi,
+            HighDpi
+        }
+
+        public enum ChangeMod
+        {
+            None,
+            ChangePage,
+            FormAndSignature,
+            AnnotAndFormAndSignature,
+            ExceptAbstrat
+        }
+
+        ///<returns>
+        ///生成带有指定权限的CPDFPermissionsInfo对象
+        ///</returns>
+        public CPDFPermissionsInfo CreatePermissionsInfo(PrintMod printMod, ChangeMod changeMod)
+        {
+            CPDFPermissionsInfo permissionsInfo = new CPDFPermissionsInfo();
+            switch (printMod)
+            {
+                case PrintMod.None:
+                    permissionsInfo.AllowsPrinting = false;
+                    permissionsInfo.AllowsHighQualityPrinting = false;
+                    break;
+                case PrintMod.LowDpi:
+                    permissionsInfo.AllowsPrinting = true;
+                    permissionsInfo.AllowsHighQualityPrinting = false;
+                    break;
+                case PrintMod.HighDpi:
+                    permissionsInfo.AllowsHighQualityPrinting = true;
+                    permissionsInfo.AllowsPrinting = true;
+                    break;
+                default:
+                    break;
+            }
+            switch (changeMod)
+            {
+                case ChangeMod.None:
+                    permissionsInfo.AllowsCopying = false;
+                    permissionsInfo.AllowsDocumentAssembly = false;
+                    permissionsInfo.AllowsCommenting = false;
+                    permissionsInfo.AllowsDocumentChanges = false;
+                    permissionsInfo.AllowsFormFieldEntry = false;
+                    break;
+                case ChangeMod.ChangePage:
+                    permissionsInfo.AllowsCopying = false;
+                    permissionsInfo.AllowsDocumentAssembly = true;
+                    permissionsInfo.AllowsCommenting = false;
+                    permissionsInfo.AllowsDocumentChanges = false;
+                    permissionsInfo.AllowsFormFieldEntry = false;
+                    break;
+                case ChangeMod.FormAndSignature:
+                    permissionsInfo.AllowsCopying = false;
+                    permissionsInfo.AllowsDocumentAssembly = false;
+                    permissionsInfo.AllowsCommenting = false;
+                    permissionsInfo.AllowsDocumentChanges = false;
+                    permissionsInfo.AllowsFormFieldEntry = true;
+                    break;
+                case ChangeMod.AnnotAndFormAndSignature:
+                    permissionsInfo.AllowsCopying = false;
+                    permissionsInfo.AllowsDocumentAssembly = false;
+                    permissionsInfo.AllowsCommenting = true;
+                    permissionsInfo.AllowsDocumentChanges = false;
+                    permissionsInfo.AllowsFormFieldEntry = true;
+                    break;
+                case ChangeMod.ExceptAbstrat:
+                    permissionsInfo.AllowsCopying = true;
+                    permissionsInfo.AllowsDocumentAssembly = true;
+                    permissionsInfo.AllowsCommenting = true;
+                    permissionsInfo.AllowsDocumentChanges = false;
+                    permissionsInfo.AllowsFormFieldEntry = true;
+                    break;
+            }
+            return permissionsInfo;
+        }
+    }
+}

+ 58 - 0
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogModel.cs

@@ -0,0 +1,58 @@
+using ComPDFKit.PDFDocument;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.HomePageToolsDialogs
+{
+    public class HomePagePictureToPDFDialogModel
+    {
+
+        /// <summary>
+        /// 拆分模式
+        /// </summary>
+        public ToPDFFileMode Mode = ToPDFFileMode.NewFiles;
+
+        /// <summary>
+        /// 文件名标签
+        /// </summary>
+        public string RearFileNameLabel = "down";
+
+        /// <summary>
+        /// 文件名标签
+        /// </summary>
+        public string FrontFileNameLabel = "part";
+
+        /// <summary>
+        /// 当前文件路径
+        /// </summary>
+        public string FilePath = "";
+
+        /// <summary>
+        /// 文件密码
+        /// </summary>
+        public string Password = "";
+
+        /// <summary>
+        /// 保存逻辑
+        /// </summary>
+        public enum ToPDFFileMode
+        {
+            /// <summary>
+            /// 单独为一个文档
+            /// </summary>
+            NewFiles,
+            /// <summary>
+            /// 保存为一个文档
+            /// </summary>
+            OneNewFile,
+            /// <summary>
+            /// 当前文档
+            /// </summary>
+            SelectFileName
+
+        }
+    }
+}

+ 26 - 0
PDF Office/Model/DialogNames.cs

@@ -84,5 +84,31 @@ namespace PDF_Office.Model
         ///打印弹窗-打印页面设置
         /// </summary>
         public static string HomePagePrinterPageSetDialog = "HomePagePrinterPageSetDialog";
+
+        ///<summary>
+        ///主页工具-图片转PDF弹窗
+        /// </summary>
+        public static string HomePagePictureToPDFDialog = "HomePagePictureToPDFDialog";
+
+        ///<summary>
+        ///主页工具-PDF批量工具
+        /// </summary>
+        public static string HomePageBatchProcessingDialog ="HomePageBatchProcessingDialog";
+
+        ///<summary>
+        ///转档-CSVD,PPT,Text,Word,HTML,Img,RTF,Excel弹窗
+        /// </summary>
+        public static string ConverterCSVDialog = "ConverterCSVDialog";
+        public static string ConverterPPTDialog = "ConverterPPTDialog";
+        public static string ConverterTextDialog = "ConverterTextDialog";
+        public static string ConverterWordDialog = "ConverterWordDialog";
+        public static string ConverterHTMLDialog = "ConverterHTMLDialog";
+        public static string ConverterImgDialog = "ConverterImgDialog";
+        public static string ConverterRTFDialog = "ConverterRTFDialog";
+        public static string ConverterExcelDialog = "ConverterExcelDialog";
+        ///<summary>
+        ///转档进度条弹窗
+        /// </summary>
+        public static string ConverterProgressBarDialog = "ConverterProgressBarDialog";
     }
 }

+ 12 - 0
PDF Office/Model/ParameterNames.cs

@@ -32,9 +32,21 @@ namespace PDF_Office.Model
 
         public static string InsertType_Custom = "Insert_Custom";
 
+        public static string BatchProcessing_Name = "BatchProcessing_Name";
+
         /// <summary>
         /// 用于弹窗传参的数据模型
         /// </summary>
         public static string DataModel = "Model";
+
+        /// <summary>
+        /// 转换类型
+        /// </summary>
+        public static string ConverterType = "ConverterType";
+
+        /// <summary>
+        /// 用于转换数据模型
+        /// </summary>
+        public static string ConverterTypeModel = "ConverterTypeModel";
     }
 }

+ 282 - 15
PDF Office/PDF Office.csproj

@@ -66,9 +66,30 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>.\Dragablz.dll</HintPath>
     </Reference>
+    <Reference Include="Dropbox.Api, Version=6.33.0.0, Culture=neutral, PublicKeyToken=310f0e82fbb45d01, processorArchitecture=MSIL">
+      <HintPath>packages\Dropbox.Api.6.33.0\lib\netstandard2.0\Dropbox.Api.dll</HintPath>
+    </Reference>
     <Reference Include="DryIoc, Version=4.7.7.0, Culture=neutral, PublicKeyToken=dfbf2bd50fcf7768, processorArchitecture=MSIL">
       <HintPath>packages\DryIoc.dll.4.7.7\lib\net45\DryIoc.dll</HintPath>
     </Reference>
+    <Reference Include="Google.Apis, Version=1.57.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
+      <HintPath>packages\Google.Apis.1.57.0\lib\net45\Google.Apis.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Apis.Auth, Version=1.57.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
+      <HintPath>packages\Google.Apis.Auth.1.57.0\lib\net461\Google.Apis.Auth.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Apis.Auth.PlatformServices, Version=1.57.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
+      <HintPath>packages\Google.Apis.Auth.1.57.0\lib\net461\Google.Apis.Auth.PlatformServices.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Apis.Core, Version=1.57.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
+      <HintPath>packages\Google.Apis.Core.1.57.0\lib\net45\Google.Apis.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Apis.Drive.v3, Version=1.57.0.2859, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
+      <HintPath>packages\Google.Apis.Drive.v3.1.57.0.2859\lib\net45\Google.Apis.Drive.v3.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Apis.PlatformServices, Version=1.57.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
+      <HintPath>packages\Google.Apis.1.57.0\lib\net45\Google.Apis.PlatformServices.dll</HintPath>
+    </Reference>
     <Reference Include="Microsoft.AppCenter, Version=0.0.0.0, Culture=neutral, PublicKeyToken=8a600e2fee7ba272, processorArchitecture=MSIL">
       <HintPath>packages\Microsoft.AppCenter.4.5.0\lib\net461\Microsoft.AppCenter.dll</HintPath>
     </Reference>
@@ -78,12 +99,27 @@
     <Reference Include="Microsoft.AppCenter.Crashes, Version=0.0.0.0, Culture=neutral, PublicKeyToken=8a600e2fee7ba272, processorArchitecture=MSIL">
       <HintPath>packages\Microsoft.AppCenter.Crashes.4.5.0\lib\net461\Microsoft.AppCenter.Crashes.dll</HintPath>
     </Reference>
+    <Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
+      <HintPath>packages\Microsoft.Office.Interop.Excel.15.0.4795.1001\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </Reference>
+    <Reference Include="Microsoft.Office.Interop.PowerPoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
+      <HintPath>packages\Microsoft.Office.Interop.PowerPoint.15.0.4420.1018\lib\net20\Microsoft.Office.Interop.PowerPoint.dll</HintPath>
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </Reference>
+    <Reference Include="Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
+      <HintPath>packages\Microsoft.Office.Interop.Word.15.0.4797.1004\lib\net20\Microsoft.Office.Interop.Word.dll</HintPath>
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </Reference>
     <Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>packages\Microsoft.Xaml.Behaviors.Wpf.1.1.31\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
+    <Reference Include="office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </Reference>
     <Reference Include="Prism, Version=8.1.97.5141, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
       <HintPath>packages\Prism.Core.8.1.97\lib\net461\Prism.dll</HintPath>
     </Reference>
@@ -173,17 +209,36 @@
       <DependentUpon>WritableComboBox.xaml</DependentUpon>
     </Compile>
     <Compile Include="DataConvert\FileFormatToIconConvert.cs" />
+    <Compile Include="DataConvert\UnVisivleConvert.cs" />
     <Compile Include="EventAggregators\PageEditNotifyEvent.cs" />
     <Compile Include="EventAggregators\PageEditRefreshEvent.cs" />
+    <Compile Include="Helper\ConverterHelper.cs" />
     <Compile Include="Helper\HomePageEditHelper.cs" />
     <Compile Include="Helper\PasswordBoxHelper.cs" />
+    <Compile Include="Helper\PictureConverter.cs" />
+    <Compile Include="Helper\SDKLisenceHelper.cs" />
     <Compile Include="Helper\SettingHelper.cs" />
     <Compile Include="Helper\ToolMethod.cs" />
+    <Compile Include="Model\CloudDrive\CloudDriveItem.cs" />
+    <Compile Include="Model\CloudDrive\CloudFiles.cs" />
     <Compile Include="Model\DialogNames.cs" />
     <Compile Include="CustomControl\SystemControl\InterTabClient.cs" />
     <Compile Include="CustomControl\LoadingControl.xaml.cs">
       <DependentUpon>LoadingControl.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Model\Dialog\ConverterDialogs\ConverterCSVDialogModel.cs" />
+    <Compile Include="Model\Dialog\ConverterDialogs\ConverterDialogsModel.cs" />
+    <Compile Include="Model\Dialog\ConverterDialogs\ConverterExcelDialogModel.cs" />
+    <Compile Include="Model\Dialog\ConverterDialogs\ConverterHTMLDialogModel.cs" />
+    <Compile Include="Model\Dialog\ConverterDialogs\ConverterImgDialogModel.cs" />
+    <Compile Include="Model\Dialog\ConverterDialogs\ConverterPPTDialogModel.cs" />
+    <Compile Include="Model\Dialog\ConverterDialogs\ConverterRTFDialogModel.cs" />
+    <Compile Include="Model\Dialog\ConverterDialogs\ConverterTextDialogModel.cs" />
+    <Compile Include="Model\Dialog\ConverterDialogs\ConverterWordDialogModel.cs" />
+    <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBatchProcessingDialogModel.cs" />
+    <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageCompressDialogModel.cs" />
+    <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageSetPasswordDialogModel.cs" />
+    <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialogModel.cs" />
     <Compile Include="Model\Dialog\ToolsDialogs\CompressDialogModel\CompressDialogModel.cs" />
     <Compile Include="Model\Dialog\ToolsDialogs\SaftyDialogs\CheckPasswordDialogModel.cs" />
     <Compile Include="Model\Dialog\ToolsDialogs\SaftyDialogs\DeleteSafetySettintgsModel.cs" />
@@ -204,10 +259,28 @@
     <Compile Include="EventAggregators\OpenFileEvent.cs" />
     <Compile Include="Helper\CommomEvent.cs" />
     <Compile Include="Helper\CommonHelper.cs" />
+    <Compile Include="Properties\Resources.Designer.cs">
+      <DependentUpon>Resources.resx</DependentUpon>
+      <DesignTime>True</DesignTime>
+      <AutoGen>True</AutoGen>
+    </Compile>
     <Compile Include="ViewModels\BOTA\BOTAContentViewModel.cs" />
     <Compile Include="ViewModels\BottomToolContentViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\ConverterDialogs\ConverterProgressBarDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\ConverterDialogs\ConverterCSVDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\ConverterDialogs\ConverterExcelDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\ConverterDialogs\ConverterHTMLDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\ConverterDialogs\ConverterImgDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\ConverterDialogs\ConverterPPTDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\ConverterDialogs\ConverterRTFDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\ConverterDialogs\ConverterTextDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\ConverterDialogs\ConverterWordDialogViewModel.cs" />
+    <Compile Include="ViewModels\Tools\ConverterBarContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ExtractDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\FullScreenWindowViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBatchProcessingDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageCompressDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageSetPasswordDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModBookletContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModMultipleContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModPosterContentViewModel.cs" />
@@ -225,6 +298,14 @@
     <Compile Include="ViewModels\Dialog\ToolsDialogs\SaftyDialogs\CheckPasswordDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ToolsDialogs\SaftyDialogs\SetPasswordDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\VerifyPassWordDialogViewModel.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveContentViewModel.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveManager.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudFilesContentViewModel.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveType\DropbBoxManager.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveType\DropbBoxUserItem.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveType\GoogleDriveManager.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveType\GoogleDriveUserItem.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialogViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeCloudContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeGuidContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeToolsContentViewModel.cs" />
@@ -239,15 +320,54 @@
     <Compile Include="Views\BottomToolContent.xaml.cs">
       <DependentUpon>BottomToolContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Dialog\ConverterDialogs\ConverterCSVDialog.xaml.cs">
+      <DependentUpon>ConverterCSVDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\ConverterDialogs\ConverterExcelDialog.xaml.cs">
+      <DependentUpon>ConverterExcelDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\ConverterDialogs\ConverterHTMLDialog.xaml.cs">
+      <DependentUpon>ConverterHTMLDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\ConverterDialogs\ConverterImgDialog.xaml.cs">
+      <DependentUpon>ConverterImgDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\ConverterDialogs\ConverterPPTDialog.xaml.cs">
+      <DependentUpon>ConverterPPTDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\ConverterDialogs\ConverterProgressBarDialog.xaml.cs">
+      <DependentUpon>ConverterProgressBarDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\ConverterDialogs\ConverterRTFDialog.xaml.cs">
+      <DependentUpon>ConverterRTFDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\ConverterDialogs\ConverterTextDialog.xaml.cs">
+      <DependentUpon>ConverterTextDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\ConverterDialogs\ConverterWordDialog.xaml.cs">
+      <DependentUpon>ConverterWordDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Dialog\FullScreenWindow.xaml.cs">
       <DependentUpon>FullScreenWindow.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBatchProcessingDialog.xaml.cs">
+      <DependentUpon>HomePageBatchProcessingDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageCompressDialog.xaml.cs">
+      <DependentUpon>HomePageCompressDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageSetPasswordDialog.xaml.cs">
+      <DependentUpon>HomePageSetPasswordDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageExtractDialog.xaml.cs">
       <DependentUpon>HomePageExtractDialog.xaml</DependentUpon>
     </Compile>
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageInsertDialog.xaml.cs">
       <DependentUpon>HomePageInsertDialog.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialog.xaml.cs">
+      <DependentUpon>HomePagePictureToPDFDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModBookletContent.xaml.cs">
       <DependentUpon>HomePagePrinterModBookletContent.xaml</DependentUpon>
     </Compile>
@@ -296,10 +416,10 @@
     <Compile Include="Views\Dialog\VerifyPassWordDialog.xaml.cs">
       <DependentUpon>VerifyPassWordDialog.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\HomePanel\CloudDocs\CloudDiskContent.xaml.cs">
-      <DependentUpon>CloudDiskContent.xaml</DependentUpon>
+    <Compile Include="Views\HomePanel\CloudDrive\CloudDriveContent.xaml.cs">
+      <DependentUpon>CloudDriveContent.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\HomePanel\CloudDocs\CloudFilesContent.xaml.cs">
+    <Compile Include="Views\HomePanel\CloudDrive\CloudFilesContent.xaml.cs">
       <DependentUpon>CloudFilesContent.xaml</DependentUpon>
     </Compile>
     <Compile Include="Views\HomePanel\HomeCloudContent.xaml.cs">
@@ -339,6 +459,12 @@
     <Compile Include="Views\PageEdit\PageEditContent.xaml.cs">
       <DependentUpon>PageEditContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Tools\AnnotToolContent.xaml.cs">
+      <DependentUpon>AnnotToolContent.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Tools\ConverterBarContent.xaml.cs">
+      <DependentUpon>ConverterBarContent.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Tools\ToolsBarContent.xaml.cs">
       <DependentUpon>ToolsBarContent.xaml</DependentUpon>
     </Compile>
@@ -417,10 +543,58 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Dialog\ConverterDialogs\ConverterCSVDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\ConverterDialogs\ConverterExcelDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\ConverterDialogs\ConverterHTMLDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\ConverterDialogs\ConverterImgDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\ConverterDialogs\ConverterPPTDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\ConverterDialogs\ConverterProgressBarDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\ConverterDialogs\ConverterRTFDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\ConverterDialogs\ConverterTextDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\ConverterDialogs\ConverterWordDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Dialog\FullScreenWindow.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBatchProcessingDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageCompressDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageSetPasswordDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageExtractDialog.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -429,6 +603,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModBookletContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -497,11 +675,11 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="Views\HomePanel\CloudDocs\CloudDiskContent.xaml">
+    <Page Include="Views\HomePanel\CloudDrive\CloudDriveContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Views\HomePanel\CloudDocs\CloudFilesContent.xaml">
+    <Page Include="Views\HomePanel\CloudDrive\CloudFilesContent.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
@@ -571,6 +749,14 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Views\Tools\AnnotToolContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Tools\ConverterBarContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Tools\ToolsBarContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -584,31 +770,28 @@
     <Compile Include="Properties\AssemblyInfo.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Properties\Resources.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DesignTime>True</DesignTime>
-      <DependentUpon>Resources.resx</DependentUpon>
-    </Compile>
     <Compile Include="Properties\Settings.Designer.cs">
       <AutoGen>True</AutoGen>
       <DependentUpon>Settings.settings</DependentUpon>
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
     </Compile>
-    <EmbeddedResource Include="Properties\Resources.resx">
-      <Generator>ResXFileCodeGenerator</Generator>
-      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
-    </EmbeddedResource>
+    <None Include="credentials.json">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Include="packages.config" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
     </None>
+    <None Include="source\AnalysisWord\Res\word\_rels\document.xml.rels" />
+    <Content Include="source\AnalysisWord\Res\_rels\.rels">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
   </ItemGroup>
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Views\Dialog\Convertor\" />
     <Folder Include="Views\Edit\" />
     <Folder Include="Views\FillAndSign\" />
     <Folder Include="Views\Forms\" />
@@ -648,6 +831,84 @@
     <Resource Include="Resources\PromotionIcon\Windows.png" />
     <Resource Include="Resources\FilesType\ic_propertybar_file_pdf_lock.png" />
     <Resource Include="Resources\FilesType\ic_propertybar_file_png_Large.png" />
+    <Resource Include="SDKLisence.xml" />
+    <Content Include="index.html">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Resource Include="Resources\ToolBarIcon\MyTools\Arrow.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Bookmark.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Circle.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Freehande.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Freehande2.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Hand.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Highlight.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Hyperlink.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Image.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Line.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Note.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Point.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Rectangle.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Selecttool.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Stamp.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\Textbox.png" />
+    <Resource Include="Resources\ToolBarIcon\MyTools\wavyline2.png" />
+    <Content Include="source\AnalysisPPT\Res\slideLayouts\slideLayout1.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\slideLayouts\slideLayout10.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\slideLayouts\slideLayout11.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\slideLayouts\slideLayout2.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\slideLayouts\slideLayout3.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\slideLayouts\slideLayout4.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\slideLayouts\slideLayout5.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\slideLayouts\slideLayout6.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\slideLayouts\slideLayout7.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\slideLayouts\slideLayout8.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\slideLayouts\slideLayout9.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\slideMaster1.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\theme1.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisPPT\Res\thumbnail.jpeg">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisWord\Res\docProps\app.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="source\AnalysisWord\Res\docProps\core.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Resource Include="source\AnalysisWord\Res\word\document.xml" />
+    <Resource Include="source\AnalysisWord\Res\word\document0.xml" />
+    <Resource Include="source\AnalysisWord\Res\word\endnotes.xml" />
+    <Resource Include="source\AnalysisWord\Res\word\footnotes.xml" />
+    <Resource Include="source\AnalysisWord\Res\word\settings.xml" />
+    <Resource Include="source\AnalysisWord\Res\word\theme\theme1.xml" />
+    <Content Include="source\AnalysisWord\Res\[Content_Types].xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
     <Content Include="SystemService\PreviewHandler.dll">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
@@ -718,6 +979,12 @@
       <Name>PDFSettings</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>

+ 13 - 1
PDF Office/Properties/Resources.Designer.cs

@@ -19,7 +19,7 @@ namespace PDF_Office.Properties {
     // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
     // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
     // (以 /str 作为命令选项),或重新生成 VS 项目。
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     internal class Resources {
@@ -68,5 +68,17 @@ namespace PDF_Office.Properties {
                 return ResourceManager.GetString("OpenDialogFilter", resourceCulture);
             }
         }
+        
+        /// <summary>
+        ///   查找类似 &lt;xml version=&quot;1.0&quot; encoding = &quot;UTF-8&quot; stantdalone=&quot;yes&quot;&gt;
+        ///	&lt;Lisences
+        ///		devKey = &quot;tmqcblSkvVZeNj9k4nMA88G6g1kw4yYH+tPiqK+T91CaGM9urgNlT1+kXiTyv0W1bTQNObS51WgQpfJNl1inRVDKBB3wznw2o7vtKjOKKDNbV7R1ply0PhDKVkKYV040vpAdaT8GZEfllftNlts99uGhscqGvmCLBKmgTsq0HFo=&quot;
+        ///		devSecret=&quot;mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iccr16WMBclnQACarlyblNMFa171moVHNuaoPG9eUt/RDYPB4dH12/mo6Nb7CMnoDUShGRobCLus9Vl3Sb80EZvGI/sVnm7Ju0Mhj+L/faMDDsKeheIw8v1IwmcZT3yU2l9MwkobWvR2DRybgSkLGYbFAv+VbVAICHE/17JjUpTkFo+FpaETldwAVsTVNm77oq2xRRte [字符串的其余部分被截断]&quot;; 的本地化字符串。
+        /// </summary>
+        internal static string SDKLisence {
+            get {
+                return ResourceManager.GetString("SDKLisence", resourceCulture);
+            }
+        }
     }
 }

+ 4 - 0
PDF Office/Properties/Resources.resx

@@ -120,4 +120,8 @@
   <data name="OpenDialogFilter" xml:space="preserve">
     <value>PDF Files (*.pdf)|*.pdf</value>
   </data>
+  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <data name="SDKLisence" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\SDKLisence.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312</value>
+  </data>
 </root>

BIN
PDF Office/Resources/ToolBarIcon/MyTools/Arrow.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Bookmark.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Circle.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Freehande.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Freehande2.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Hand.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Highlight.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Hyperlink.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Image.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Line.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Note.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Point.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Rectangle.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Selecttool.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Stamp.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/Textbox.png


BIN
PDF Office/Resources/ToolBarIcon/MyTools/wavyline2.png


+ 11 - 0
PDF Office/SDKLisence.xml

@@ -0,0 +1,11 @@
+<Lisences
+	devKey = "sTHSivIW4YnZQavIYDLVw4vaFcN5DQTUtRGrVyv5p9aeaHX3GirG/MBxl6Wy9TJbNOwR4CU6LPjHmGe3Po3OtBCPqIRheam9+LomScw3AvoUTHFlG1134e2J4enF43WJQ6PyOnjwZqsG1kUdlBPNztkoPzDAE2pQKgZWf6V2i34="
+    devSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4gQurxTxGuBlGAhs0P1mD3X3bHT+AHfcLiymaqE4DY7kTFHoPs9I3tl5ErS+BHdzHRhrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1367/WkJ00tM7U7tttD6cfaiHpW8pgW2aur3AxuQIBBLuJD5gcmNxTYW3KA32JLG8alfyXjKFVS3gka9bngvwfZ7GuNXybjKlmz1tnN6iVHpnbSj+xOHhWEperY4HHrSg=="
+	userKey = "iBPRM/Tz8b6Z1G2GQt52X7hiNCGfVYXztnPjalgrgARvqfKV6lFNH8QeScTzBRYI8GGFpwelfgh790Kd9JmL7V4adI1jCiFHUT2DLT7QucxY5Nkgys2aJItQS482Ck2G2Xf8gNgojxYxRt65o/MEzkj93foj8qIdfHagXsSorSs="
+	userSecret="mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4ivEHOmPIqbfhpDnKKj+7Ymj2rXQvfZRmke06HMV+3tt064G64WjPW8+EbGCNZaAh1hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1FKJi6HYB+DuugQyaqI2prfej861QnJrU4s2T/npZK/"
+	ConverterDevKey="Eahwo7OZAYHJaCF7TJQYKSVqC62MzfBdllVXnC5BRR5BQFDKnQ1FJtCRVdug+VNg/ti+/DeA5Sq4IH2CBpQjAZst5705uk5Sz0ZwRu8Qdn9HFGwh2pG6dJEIrl7lOccoZS6+1IxgOTcTeHqYpym3NsmtbhBWE848Pvme3scpW28="
+	ConverterDevSecret="mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iccr16WMBclnQACarlyblNUvAm/S8uFbhXMvxwgBSgULSsrbuyF/SIZ3I+dl0qU8EiR4IKrcJxus3VRNu+jx8P7CGq2BlSjPVXRHBI1lV8ukpCIUGmcK+P+Z0QbYdkAHAm6NPgs2c4tp1jOFPPbnUkTtX7riDb9xRCx1YNm3/+xd96PzrVCcmtTizZP+elkr8="
+	ConverterUserkey=" WLUHzXhndQKyrTJVzvZ+dvPXDQDZeJpcSvklX3GJwRX4+urd8eQskYgbeCf0NXLZ/qJkS/k10x+qGad34i4v5rI/ASFIx901c/Nw5C0YJMH7X87dib141tdAmSmQhnKLO5TBi4FiAidboyvnLFLrYGMmS2kLQOXFPwPj5zQUv5A="
+	ConverterUserSecret="mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iK16EcneqBPRe2eKQLuJXpA79IONX9GVI/Ap3uWzMcNWaitc2UB6gDeexJXFPVaXOFAoV6NtcUJC8skonXVk7k/oKTJGcYKLPGdXenrzHolQ=="
+	>
+</Lisences>

+ 36 - 1
PDF Office/Styles/CustomBtnStyle.xaml

@@ -221,4 +221,39 @@
             </Setter.Value>
         </Setter>
     </Style>
-</ResourceDictionary>
+
+
+    <Style x:Key="HomePageCompressBtn" TargetType="Button">
+        <Setter Property="Background" Value="White"/>
+        <Setter Property="BorderBrush" Value="White"/>
+        <Setter Property="HorizontalAlignment" Value="Center"/>
+
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type Button}">
+                    <Border x:Name="border" BorderBrush="White" BorderThickness="1,1,1,1" Background="{TemplateBinding Background}" SnapsToDevicePixels="true" >
+                        <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="true">
+                            <Setter Property="Background" TargetName="border" Value="#1A000000"/>
+                            <Setter Property="BorderBrush" TargetName="border" Value= "AntiqueWhite"/>
+                        </Trigger>
+                        <Trigger Property="IsPressed" Value="true">
+                            <Setter Property="Background" TargetName="border" Value="#26000000"/>
+                            <Setter Property="BorderBrush" TargetName="border" Value= "WhiteSmoke"/>
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter Property="Background" TargetName="border" Value="White"/>
+                            <Setter Property="BorderBrush" TargetName="border" Value="White"/>
+                            <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="Black"/>
+                            <Setter Property="Opacity" TargetName="contentPresenter" Value="1"/>
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+</ResourceDictionary>
+    
+    

+ 1 - 0
PDF Office/Styles/WindowsStyle.xaml

@@ -11,6 +11,7 @@
                     GlassFrameThickness="-1"
                     ResizeBorderThickness="5"
                     UseAeroCaptionButtons="False" />
+                <!--  GlassFrameThickness="-1" win11上显示异常  -->
             </Setter.Value>
         </Setter>
         <Setter Property="Template">

+ 77 - 3
PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs

@@ -5,19 +5,84 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using System.Windows.Controls;
 
 namespace PDF_Office.ViewModels.BOTA
 {
     public class BOTAContentViewModel:BindableBase, INavigationAware
     {
 
-        public BOTAContentViewModel()
+        private CPDFViewer pdfViewer { get; set; }
+
+        private IRegionManager regions { get; set; }
+
+        private ViewContentViewModel viewContentViewModel { get; set; }
+
+        private Dictionary<string, string> viewNameByTabItem { get; set; }
+
+        private string botaContentRegionName;
+
+        public string BOTAContentRegionNmae
         {
+            get { return botaContentRegionName; }
+            set
+            {
+                SetProperty(ref botaContentRegionName, value);
+            }
+        }
 
+        public DelegateCommand<object> TabControlSelectionChangedCommand { get; set; }
+
+        public BOTAContentViewModel(IRegionManager regionManager)
+        {
+            regions = regionManager;
+            
+            BOTAContentRegionNmae = Guid.NewGuid().ToString();
+
+            InitDictionartViewNameByTabItem();
         }
 
-        #region Navigate
 
+        private void TabControlSelectionChangedEvent(object e)
+        {
+            var args = e as SelectionChangedEventArgs;
+            if (args != null)
+            {
+                EnterSelectedBar((args.AddedItems[0] as TabItem).Name);
+            }
+        }
+
+        /// <summary>
+        /// 初始化名称-视图字典
+        /// </summary>
+        private void InitDictionartViewNameByTabItem()
+        {
+            viewNameByTabItem = new Dictionary<string, string>();
+            //绑定tabitem名字和对应的View控件名称
+            viewNameByTabItem.Add("TabItemThumbnail","");
+            viewNameByTabItem.Add("TabItemOutLine", "");
+            viewNameByTabItem.Add("TabItemBookMark", "");
+            viewNameByTabItem.Add("TabItemAnnotation", "");
+            viewNameByTabItem.Add("TabItemSearch", "");
+            viewNameByTabItem.Add("TabItemForm", "");
+            viewNameByTabItem.Add("TabItemSign", "");
+        }
+
+        /// <summary>
+        /// 导航至目标TabItem
+        /// </summary>
+        /// <param name="currentBar"></param>
+        private void EnterSelectedBar(string currentBar)
+        {
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, pdfViewer);
+            regions.RequestNavigate(BOTAContentRegionNmae, viewNameByTabItem[currentBar], param);
+        }
+
+        #region Navigate
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;
@@ -30,7 +95,16 @@ namespace PDF_Office.ViewModels.BOTA
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
-            
+            var contentViewModel = navigationContext.Parameters[ParameterNames.ViewContentViewModel] as ViewContentViewModel;
+            if (contentViewModel != null)
+            {
+                viewContentViewModel = contentViewModel;
+            }
+            var pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
+            if (pdfview != null)
+            {
+                pdfViewer = pdfview;
+            }
         }
         #endregion
     }

+ 131 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterCSVDialogViewModel.cs

@@ -0,0 +1,131 @@
+using ComPDFKit.PDFDocument;
+using ComPDFKit_Conversion.Options;
+using ComPDFKitViewer.PdfViewer;
+using Microsoft.Office.Interop.Excel;
+using Microsoft.Office.Interop.Word;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.ConverterDialogs;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+using static Dropbox.Api.Files.FileCategory;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
+{
+    public class ConverterCSVDialogViewModel : BindableBase,IDialogAware
+    {
+        public ConverterCSVDialogModel ConverterCSVModel = new ConverterCSVDialogModel();
+
+        public CPDFViewer currentViewer;
+
+        public IDialogService dialogs;
+
+        public string CurrentPageIndex="1";
+
+        public string PageRangeText { set; get; } = "0";
+
+        public string PageRangeSelectIndex { set; get; } = "0";
+
+        public DelegateCommand<string> RadioButtonCommand { get; set; }
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand ConverterCommnad { get; set; }
+        public ConverterCSVDialogViewModel(IDialogService dialogService)
+        {
+            CancelCommand = new DelegateCommand(cancel);
+            ConverterCommnad = new DelegateCommand(converter);
+            RadioButtonCommand = new DelegateCommand<string>(radiobutton);
+            dialogs = dialogService;
+        }
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private  void converter()
+        {
+            FolderBrowserDialog dlg = new FolderBrowserDialog();
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                ConverterCSVModel.OutputPath =dlg.SelectedPath.Trim();
+            }
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref ConverterCSVModel.PageRange, PageRangeText, true, CurrentPageIndex);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterCSVModel.PageIndexLists, ConverterCSVModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.ConverterType,"CSV");
+            value.Add(ParameterNames.ConverterTypeModel, ConverterCSVModel);
+            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+            dialogs.ShowDialog(DialogNames.ConverterProgressBarDialog, value, e =>
+            {
+
+            });
+            
+        }
+
+        private void radiobutton(string e)
+        {
+            string radioButton = e;
+            if (radioButton != null)
+            {
+                switch (radioButton)
+                {
+                    case "ForEachPageRadioBtn":
+                        break;
+                    case "OnlyTableRadioBtn":
+                        break;
+                    default:
+                        break;
+                }
+            }
+
+        }
+
+        private void SetProgress(int pageIndex)
+        {
+
+        }
+        public string Title=>"";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer pdfViewer = null;
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer);
+            if (pdfViewer != null)
+            {
+                currentViewer = pdfViewer;
+                ConverterCSVModel.InputPath = pdfViewer.Document.FilePath;
+                FileInfo fileinfo = new FileInfo(ConverterCSVModel.InputPath);
+                ConverterCSVModel.OutputPath = fileinfo.DirectoryName;
+            }
+        }
+    }
+}

+ 136 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterExcelDialogViewModel.cs

@@ -0,0 +1,136 @@
+using ComPDFKit_Conversion.Options;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.ConverterDialogs;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
+{
+    public class ConverterExcelDialogViewModel : BindableBase, IDialogAware
+    {
+        public ConverterExcelDialogModel ConverterExcelModel = new ConverterExcelDialogModel();
+
+        public CPDFViewer currentViewer;
+
+        public string CurrentPageIndex = "1";
+
+
+        public IDialogService dialogs;
+
+        public string PageRangeText { set; get; } = "0";
+
+        public string PageRangeSelectIndex { set; get; } = "0";
+
+
+        public DelegateCommand<string> RadioButtonCommand { get; set; }
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand ConverterCommnad { get; set; }
+        public ConverterExcelDialogViewModel(IDialogService dialogService)
+        {
+            CancelCommand = new DelegateCommand(cancel);
+            ConverterCommnad = new DelegateCommand(converter);
+            RadioButtonCommand = new DelegateCommand<string>(radiobutton);
+            dialogs = dialogService;
+        }
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void converter()
+        {
+            FolderBrowserDialog dlg = new FolderBrowserDialog();
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                ConverterExcelModel.OutputPath = dlg.SelectedPath.Trim();
+            }
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref ConverterExcelModel.PageRange, PageRangeText, true, CurrentPageIndex);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterExcelModel.PageIndexLists, ConverterExcelModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            if (ConverterExcelModel.excelOption == null) {
+                ConverterExcelModel.excelOption = ConverterExcelModel.ExcelOptions();
+            }
+
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.ConverterType, "Excel");
+            value.Add(ParameterNames.ConverterTypeModel, ConverterExcelModel);
+            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+            dialogs.ShowDialog(DialogNames.ConverterProgressBarDialog, value, e =>
+            {
+
+            });
+            
+        }
+
+        private void radiobutton(string e) {
+            string radioButton=e;
+            if (radioButton != null) {
+                switch (radioButton)
+                {
+                    case "ForEachPageRadioBtn":
+                        ConverterExcelModel.excelOption=ConverterExcelModel.ExcelOptions();
+                        break;
+                    case "ForTheDocRadioBtn":
+                        ConverterExcelModel.excelOption = ConverterExcelModel.ExcelOptions(WorksheetOptions.ForTheDocument);
+                        break;
+                    case "OnlyTableRadioBtn":
+                        ConverterExcelModel.excelOption = ConverterExcelModel.ExcelOptions(WorksheetOptions.ForEachTable, ContentOptions.OnlyTable);
+                        break;
+                    default:
+                        break;
+                }
+            }
+        
+        }
+
+
+        private void SetProgress(int pageIndex)
+        {
+
+        }
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer pdfViewer = null;
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer);
+            if (pdfViewer != null)
+            {
+                currentViewer = pdfViewer;
+                ConverterExcelModel.InputPath = pdfViewer.Document.FilePath;
+                FileInfo fileinfo = new FileInfo(ConverterExcelModel.InputPath);
+                ConverterExcelModel.OutputPath = fileinfo.DirectoryName;
+            }
+        }
+    }
+}

+ 108 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterHTMLDialogViewModel.cs

@@ -0,0 +1,108 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.ConverterDialogs;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
+{
+    public class ConverterHTMLDialogViewModel : BindableBase, IDialogAware
+    {
+
+        public ConverterHTMLDialogModel ConverterHTMLModel = new ConverterHTMLDialogModel();
+
+        public CPDFViewer currentViewer;
+
+        public IDialogService dialogs;
+
+        public string CurrentPageIndex = "1";
+
+        public string PageRangeText { set; get; } = "0";
+
+        public string PageRangeSelectIndex { set; get; } = "0";
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand ConverterCommnad { get; set; }
+        public ConverterHTMLDialogViewModel(IDialogService dialogService)
+        {
+            CancelCommand = new DelegateCommand(cancel);
+            ConverterCommnad = new DelegateCommand(converter);
+            dialogs = dialogService;
+
+        }
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void converter()
+        {
+
+            FolderBrowserDialog dlg = new FolderBrowserDialog();
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                ConverterHTMLModel.OutputPath = dlg.SelectedPath.Trim();
+            }
+         
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref ConverterHTMLModel.PageRange, PageRangeText, true, CurrentPageIndex);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterHTMLModel.PageIndexLists, ConverterHTMLModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            //result = await ConverterHelper.TxtConvert(ConverterTextModel.InputPath, ConverterTextModel.OutputPath, ConverterTextModel.GetProgress, ConverterTextModel.PageIndexLists, ConverterTextModel.Pawssword);
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.ConverterType, "HTML");
+            value.Add(ParameterNames.ConverterTypeModel, ConverterHTMLModel);
+            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+            dialogs.ShowDialog(DialogNames.ConverterProgressBarDialog, value, e =>
+            {
+
+            });
+        }
+
+        private void SetProgress(int pageIndex)
+        {
+
+        }
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer pdfViewer = null;
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer);
+            if (pdfViewer != null)
+            {
+                currentViewer = pdfViewer;
+                ConverterHTMLModel.InputPath = pdfViewer.Document.FilePath;
+                FileInfo fileinfo = new FileInfo(ConverterHTMLModel.InputPath);
+                ConverterHTMLModel.OutputPath = fileinfo.DirectoryName;
+            }
+        }
+    }
+}

+ 131 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterImgDialogViewModel.cs

@@ -0,0 +1,131 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.ConverterDialogs;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
+{
+    public class ConverterImgDialogViewModel : BindableBase, IDialogAware
+    {
+        public ConverterImgDialogModel ConverterImgModel = new ConverterImgDialogModel();
+
+        public CPDFViewer currentViewer;
+
+        public string CurrentPageIndex = "1";
+
+        public IDialogService dialogs;
+
+        public string PageRangeText { set; get; } = "0";
+
+        public string PageRangeSelectIndex { set; get; } = "0";
+
+        public List<string> ImageTypeFamily { set; get; } =new List<string>();
+
+        private void SetImageTypeOrigin()
+        {
+            this.ImageTypeFamily.Add("JPEG");
+            this.ImageTypeFamily.Add("JPG");
+            this.ImageTypeFamily.Add("PNG");
+            this.ImageTypeFamily.Add("GIF");
+            this.ImageTypeFamily.Add("TIFF");
+            this.ImageTypeFamily.Add("TGA");
+            this.ImageTypeFamily.Add("BMP");
+            this.ImageTypeFamily.Add("JPEG-2000");
+        }
+
+        public List<string> ImageDPIFamily { set; get; } = new List<string>();
+        private void SetImageDPIOrigin()
+        {
+            this.ImageDPIFamily.Add("50 dpi");
+            this.ImageDPIFamily.Add("72 dpi");
+            this.ImageDPIFamily.Add("96 dpi");
+            this.ImageDPIFamily.Add("150 dpi");
+            this.ImageDPIFamily.Add("300 dpi");
+            this.ImageDPIFamily.Add("600 dpi");
+        }
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand ConverterCommnad { get; set; }
+        public ConverterImgDialogViewModel(IDialogService dialogService)
+        {
+            CancelCommand = new DelegateCommand(cancel);
+            ConverterCommnad = new DelegateCommand(converter);
+            dialogs = dialogService;
+        }
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private  void converter()
+        {
+            FolderBrowserDialog dlg = new FolderBrowserDialog();
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                ConverterImgModel.OutputPath = dlg.SelectedPath.Trim();
+            }
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref ConverterImgModel.PageRange, PageRangeText, true, CurrentPageIndex);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterImgModel.PageIndexLists, ConverterImgModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+           
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.ConverterType, "Img");
+            value.Add(ParameterNames.ConverterTypeModel, ConverterImgModel);
+            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+            dialogs.ShowDialog(DialogNames.ConverterProgressBarDialog, value, e =>
+            {
+
+            });
+        }
+
+        private void SetProgress(int pageIndex)
+        {
+
+        }
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer pdfViewer = null;
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer);
+            if (pdfViewer != null)
+            {
+                currentViewer = pdfViewer;
+                ConverterImgModel.InputPath = pdfViewer.Document.FilePath;
+                FileInfo fileinfo = new FileInfo(ConverterImgModel.InputPath);
+                ConverterImgModel.OutputPath = fileinfo.DirectoryName;
+                SetImageTypeOrigin();
+                SetImageDPIOrigin();
+            }
+        }
+    }
+}

+ 105 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterPPTDialogViewModel.cs

@@ -0,0 +1,105 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.ConverterDialogs;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
+{
+    public class ConverterPPTDialogViewModel : BindableBase, IDialogAware
+    {
+
+        public ConverterPPTDialogModel ConverterPPTModel = new ConverterPPTDialogModel();
+
+        public CPDFViewer currentViewer;
+
+        public IDialogService dialogs;
+
+        public string CurrentPageIndex = "1";
+
+        public string PageRangeText { set; get; } = "0";
+
+        public string PageRangeSelectIndex { set; get; } = "0";
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand ConverterCommnad { get; set; }
+        public ConverterPPTDialogViewModel(IDialogService dialogService)
+        {
+            CancelCommand = new DelegateCommand(cancel);
+            ConverterCommnad = new DelegateCommand(converter);
+            dialogs = dialogService;
+        }
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void converter()
+        {
+            FolderBrowserDialog dlg = new FolderBrowserDialog();
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                ConverterPPTModel.OutputPath = dlg.SelectedPath.Trim();
+            }
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref ConverterPPTModel.PageRange, PageRangeText, true, CurrentPageIndex);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterPPTModel.PageIndexLists, ConverterPPTModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.ConverterType, "PPT");
+            value.Add(ParameterNames.ConverterTypeModel, ConverterPPTModel);
+            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+            dialogs.ShowDialog(DialogNames.ConverterProgressBarDialog, value, e =>
+            {
+
+            });
+        }
+
+        private void SetProgress(int pageIndex)
+        {
+
+        }
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer pdfViewer = null;
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer);
+            if (pdfViewer != null)
+            {
+                currentViewer = pdfViewer;
+                ConverterPPTModel.InputPath = pdfViewer.Document.FilePath;
+                FileInfo fileinfo = new FileInfo(ConverterPPTModel.InputPath);
+                ConverterPPTModel.OutputPath = fileinfo.DirectoryName;
+            }
+        }
+    }
+}

+ 155 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterProgressBarDialogViewModel.cs

@@ -0,0 +1,155 @@
+using ComPDFKit.PDFDocument;
+using ComPDFKit_Conversion.Converter;
+using ComPDFKit_Conversion.Options;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.ConverterDialogs;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Mime;
+using static Dropbox.Api.Sharing.ListFileMembersIndividualResult;
+
+namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
+{
+    public class ConverterProgressBarDialogViewModel : BindableBase,IDialogAware
+    {
+        private string _pageIndex = "0";
+
+        /// <value>
+        /// 当前页
+        /// </value>
+        public string PageIndex
+        {
+            get { return _pageIndex; }
+            set
+            {
+                SetProperty(ref _pageIndex, value);
+            }
+        }
+
+        private string _pageNumber = "";
+        /// <value>
+        /// 总页数
+        /// </value>
+        public string PageNumber
+        {
+            get { return _pageNumber; }
+            set
+            {
+                SetProperty(ref _pageNumber, value);
+            }
+        }
+
+        public ConverterProgressBarDialogViewModel()
+        {
+
+        }
+
+        private void SetProgress(int pageIndex)
+        {
+            PageIndex=pageIndex.ToString();
+        }
+
+        public string Title =>"";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public async void OnDialogOpened(IDialogParameters parameters)
+        {
+            bool result=false;
+            string convertType="";
+            OnProgress GetProgress = null;
+            GetProgress += SetProgress;
+            parameters.TryGetValue<string>(ParameterNames.ConverterType, out convertType);
+            switch (convertType)
+            {
+                case "CSV":
+                    ConverterCSVDialogModel ConverterCSVModel;
+                    parameters.TryGetValue<ConverterCSVDialogModel>(ParameterNames.ConverterTypeModel, out ConverterCSVModel);
+                    if (ConverterCSVModel != null)
+                    {
+                        PageNumber = ConverterCSVModel.PageIndexLists.Count().ToString();
+                        result = await ConverterHelper.CSVConvert(ConverterCSVModel.InputPath, ConverterCSVModel.OutputPath, GetProgress, ConverterCSVModel.PageIndexLists, ConverterCSVModel.Pawssword);
+                        RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+                    }
+                    break;
+                case "Excel":
+                    ConverterExcelDialogModel ConverterExcelModel;
+                    parameters.TryGetValue<ConverterExcelDialogModel>(ParameterNames.ConverterTypeModel, out ConverterExcelModel);
+                    if (ConverterExcelModel != null)
+                    {
+                        PageNumber = ConverterExcelModel.PageIndexLists.Count().ToString();
+                        result = await ConverterHelper.ExcelConvert(ConverterExcelModel.InputPath, ConverterExcelModel.OutputPath, GetProgress, ConverterExcelModel.PageIndexLists, ConverterExcelModel.Pawssword, ConverterExcelModel.excelOption);
+                    }
+                    break;
+                case "HTML":
+                    ConverterHTMLDialogModel ConverterHTMLModel;
+                    parameters.TryGetValue<ConverterHTMLDialogModel>(ParameterNames.ConverterTypeModel, out ConverterHTMLModel);
+                    if (ConverterHTMLModel != null)
+                    {
+                        PageNumber = ConverterHTMLModel.PageIndexLists.Count().ToString();
+                    }
+                    break;
+                case "Img":
+                    ConverterImgDialogModel ConverterImgModel;
+                    parameters.TryGetValue<ConverterImgDialogModel>(ParameterNames.ConverterTypeModel, out ConverterImgModel);
+                    if (ConverterImgModel != null)
+                    {
+                        PageNumber = ConverterImgModel.PageIndexLists.Count().ToString();
+                        result = await ConverterHelper.ImgConvert(ConverterImgModel.InputPath, ConverterImgModel.OutputPath, GetProgress, ConverterImgModel.PageIndexLists, ConverterImgModel.Pawssword, ConverterImgModel.Type);
+                    }
+                    break;
+                case "PPT":
+                    ConverterPPTDialogModel ConverterPPTModel;
+                    parameters.TryGetValue<ConverterPPTDialogModel>(ParameterNames.ConverterTypeModel, out ConverterPPTModel);
+                    if (ConverterPPTModel != null)
+                    {
+                        PageNumber = ConverterPPTModel.PageIndexLists.Count().ToString();
+                        result = await ConverterHelper.PPTConvert(ConverterPPTModel.InputPath, ConverterPPTModel.OutputPath, GetProgress, ConverterPPTModel.PageIndexLists, ConverterPPTModel.Pawssword);
+                    }
+                    break;
+                case "RTF":
+                    ConverterRTFDialogModel ConverterRTFModel;
+                    parameters.TryGetValue<ConverterRTFDialogModel>(ParameterNames.ConverterTypeModel, out ConverterRTFModel);
+                    if (ConverterRTFModel != null)
+                    {
+                        PageNumber = ConverterRTFModel.PageIndexLists.Count().ToString();
+                    }
+                        break;
+                case "Text":
+                    ConverterTextDialogModel ConverterTextModel;
+                    parameters.TryGetValue<ConverterTextDialogModel>(ParameterNames.ConverterTypeModel, out ConverterTextModel);
+                    if (ConverterTextModel != null)
+                    {
+                        PageNumber = ConverterTextModel.PageIndexLists.Count().ToString();
+                        result = await ConverterHelper.TxtConvert(ConverterTextModel.InputPath, ConverterTextModel.OutputPath, GetProgress, ConverterTextModel.PageIndexLists, ConverterTextModel.Pawssword);
+                    }
+                    break;
+                case "Word":
+                    ConverterWordDialogModel ConverterWordModel;
+                    parameters.TryGetValue<ConverterWordDialogModel>(ParameterNames.ConverterTypeModel, out ConverterWordModel);
+                    if (ConverterWordModel != null) {
+                        PageNumber = ConverterWordModel.PageIndexLists.Count().ToString();
+                        result = await ConverterHelper.WordConvert(ConverterWordModel.InputPath, ConverterWordModel.OutputPath, GetProgress, ConverterWordModel.PageIndexLists, ConverterWordModel.Pawssword);
+                    }
+                    break;
+                default:
+                    break;
+            }
+            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+        }
+    }
+}

+ 105 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterRTFDialogViewModel.cs

@@ -0,0 +1,105 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.ConverterDialogs;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
+{
+    public class ConverterRTFDialogViewModel : BindableBase, IDialogAware
+    {
+
+        public ConverterRTFDialogModel ConverterRTFModel = new ConverterRTFDialogModel();
+
+        public CPDFViewer currentViewer;
+
+        public IDialogService dialogs;
+
+        public string CurrentPageIndex = "1";
+
+        public string PageRangeText { set; get; } = "0";
+
+        public string PageRangeSelectIndex { set; get; } = "0";
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand ConverterCommnad { get; set; }
+        public ConverterRTFDialogViewModel(IDialogService dialogService)
+        {
+            CancelCommand = new DelegateCommand(cancel);
+            ConverterCommnad = new DelegateCommand(converter);
+            dialogs = dialogService;
+        }
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void converter()
+        {
+            FolderBrowserDialog dlg = new FolderBrowserDialog();
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                ConverterRTFModel.OutputPath = dlg.SelectedPath.Trim();
+            }
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref ConverterRTFModel.PageRange, PageRangeText, true, CurrentPageIndex);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterRTFModel.PageIndexLists, ConverterRTFModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            //result = await ConverterHelper.TxtConvert(ConverterTextModel.InputPath, ConverterTextModel.OutputPath, ConverterTextModel.GetProgress, ConverterTextModel.PageIndexLists, ConverterTextModel.Pawssword);
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.ConverterType, "RTF");
+            value.Add(ParameterNames.ConverterTypeModel, ConverterRTFModel);
+            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+            dialogs.ShowDialog(DialogNames.ConverterProgressBarDialog, value, e =>
+            {
+
+            });
+        }
+
+        private void SetProgress(int pageIndex)
+        {
+
+        }
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer pdfViewer = null;
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer);
+            if (pdfViewer != null)
+            {
+                currentViewer = pdfViewer;
+                ConverterRTFModel.InputPath = pdfViewer.Document.FilePath;
+                FileInfo fileinfo = new FileInfo(ConverterRTFModel.InputPath);
+                ConverterRTFModel.OutputPath = fileinfo.DirectoryName;
+            }
+        }
+    }
+}

+ 104 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterTextDialogViewModel.cs

@@ -0,0 +1,104 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.ConverterDialogs;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+using static Dropbox.Api.Sharing.ListFileMembersIndividualResult;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
+{
+    public class ConverterTextDialogViewModel : BindableBase, IDialogAware
+    {
+        public ConverterTextDialogModel ConverterTextModel = new ConverterTextDialogModel();
+
+        public CPDFViewer currentViewer;
+
+        public IDialogService dialogs;
+
+        public string CurrentPageIndex = "1";
+
+        public string PageRangeText { set; get; } = "0";
+
+        public string PageRangeSelectIndex { set; get; } = "0";
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand ConverterCommnad { get; set; }
+        public ConverterTextDialogViewModel(IDialogService dialogService)
+        {
+            CancelCommand = new DelegateCommand(cancel);
+            ConverterCommnad = new DelegateCommand(converter);
+            dialogs = dialogService;
+        }
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private  void converter()
+        {
+            FolderBrowserDialog dlg = new FolderBrowserDialog();
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                ConverterTextModel.OutputPath = dlg.SelectedPath.Trim();
+            }
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref ConverterTextModel.PageRange, PageRangeText,true, CurrentPageIndex);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterTextModel.PageIndexLists, ConverterTextModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.ConverterType, "Text");
+            value.Add(ParameterNames.ConverterTypeModel, ConverterTextModel);
+            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+            dialogs.ShowDialog(DialogNames.ConverterProgressBarDialog, value, e =>
+            {
+
+            });
+        }
+
+        private void SetProgress(int pageIndex)
+        { 
+        
+        }
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer pdfViewer = null;
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer);
+            if (pdfViewer != null)
+            {
+                currentViewer = pdfViewer;
+                ConverterTextModel.InputPath = pdfViewer.Document.FilePath;
+                FileInfo fileinfo = new FileInfo(ConverterTextModel.InputPath);
+                ConverterTextModel.OutputPath=fileinfo.DirectoryName;
+            }
+        }
+    }
+}

+ 125 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterWordDialogViewModel.cs

@@ -0,0 +1,125 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.ConverterDialogs;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
+{
+    public class ConverterWordDialogViewModel : BindableBase, IDialogAware
+    {
+        public ConverterWordDialogModel ConverterWordModel = new ConverterWordDialogModel();
+
+        public CPDFViewer currentViewer;
+
+        public IDialogService dialogs;
+
+        public string CurrentPageIndex = "1";
+
+        public string PageRangeText { set; get; } = "0";
+
+        public string PageRangeSelectIndex { set; get; } = "0";
+
+        public DelegateCommand<string> RadioButtonCommand { get; set; }
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand ConverterCommnad { get; set; }
+
+        public ConverterWordDialogViewModel(IDialogService dialogService)
+        {
+            CancelCommand = new DelegateCommand(cancel);
+            ConverterCommnad = new DelegateCommand(converter);
+            RadioButtonCommand = new DelegateCommand<string>(radiobutton);
+            dialogs = dialogService;
+        }
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void converter()
+        {
+            FolderBrowserDialog dlg = new FolderBrowserDialog();
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                ConverterWordModel.OutputPath = dlg.SelectedPath.Trim();
+            }
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref ConverterWordModel.PageRange, PageRangeText, true, CurrentPageIndex);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterWordModel.PageIndexLists, ConverterWordModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.ConverterType, "Word");
+            value.Add(ParameterNames.ConverterTypeModel, ConverterWordModel);
+            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+            dialogs.ShowDialog(DialogNames.ConverterProgressBarDialog, value, e =>
+            {
+
+            });
+        }
+
+        private void radiobutton(string e)
+        {
+            string radioButton = e;
+            if (radioButton != null)
+            {
+                switch (radioButton)
+                {
+                    case "FlowingTextRadioBtn":
+                        break;
+                    case "PageLayoutRadioBtn":
+                        break;
+                    default:
+                        break;
+                }
+            }
+
+        }
+
+        private void SetProgress(int pageIndex)
+        {
+
+        }
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer pdfViewer = null;
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer);
+            if (pdfViewer != null)
+            {
+                currentViewer = pdfViewer;
+                ConverterWordModel.InputPath = pdfViewer.Document.FilePath;
+                FileInfo fileinfo = new FileInfo(ConverterWordModel.InputPath);
+                ConverterWordModel.OutputPath = fileinfo.DirectoryName;
+            }
+        }
+    }
+}

+ 102 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBatchProcessingDialogViewModel.cs

@@ -0,0 +1,102 @@
+using ComPDFKitViewer.PdfViewer;
+using Microsoft.Office.Interop.Word;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing
+{
+    public class HomePageBatchProcessingDialogViewModel : BindableBase, IDialogAware, INavigationAware
+    {
+        private List<string> fileNames;
+
+        public IRegionManager BatchProcessingRegion;
+
+        private string batchProcessingRegionName;
+        public string BatchProcessingRegionName
+        {
+            get
+            {
+                return batchProcessingRegionName;
+            }
+            set
+            {
+                SetProperty(ref batchProcessingRegionName, value);
+            }
+        }
+
+        private Visibility batchProcessingVisible = Visibility.Collapsed;
+        public Visibility BatchProcessingVisible
+        {
+            get { return batchProcessingVisible; }
+            set { SetProperty(ref batchProcessingVisible, value); }
+        }
+        public DelegateCommand<string> DelegateChangeBatchProcessingCommand { get; set; }
+
+        public HomePageBatchProcessingDialogViewModel(IRegionManager regionManager)
+        {
+            BatchProcessingRegion = regionManager;
+            BatchProcessingRegionName = Guid.NewGuid().ToString();
+            DelegateChangeBatchProcessingCommand= new DelegateCommand<string>(ChangeBatchProcessing);
+        }
+
+        public void ChangeBatchProcessing(string index) {
+            if (index =="1"||index=="2") { 
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.FilePath, HomePageBatchProcessingDialogModel.FilePaths);
+            BatchProcessingVisible = Visibility.Collapsed;
+            BatchProcessingRegion.RequestNavigate(BatchProcessingRegionName, HomePageBatchProcessingDialogModel.GetBatchProcessing[int.Parse(index)], param);
+            BatchProcessingVisible = Visibility.Visible;
+            }
+        }
+
+        public string Title => "PDF批量工具";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            string batchprocessingname = "";
+            string[] filepath = null;
+            parameters.TryGetValue<string>(ParameterNames.BatchProcessing_Name, out batchprocessingname);
+            parameters.TryGetValue<string[]>(ParameterNames.FilePath, out filepath);
+            if (batchprocessingname != null || filepath != null) {
+                fileNames = filepath.ToList();
+                ChangeBatchProcessing(batchprocessingname);
+            }
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+    }
+}

+ 349 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageCompressDialogViewModel.cs

@@ -0,0 +1,349 @@
+using ComPDFKit.PDFDocument;
+using PDF_Office.CustomControl;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Windows;
+using System.Windows.Forms;
+using DataTable = System.Data.DataTable;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+using Task = System.Threading.Tasks.Task;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing
+{
+    public class HomePageCompressDialogViewModel : BindableBase, INavigationAware
+    {
+        private List<string> fileNames;
+
+        private CPDFDocument tempDocument;
+
+        public List<int> fileNamesView = new List<int>();
+
+        private int fileNamesIndex = 0;
+
+        private IntPtr compressingIntpr = IntPtr.Zero;
+
+        private CPDFDocument.GetPageIndexDelegate indexDelegate = null;
+
+        HomePageCompressDialogModel homePageCompressDialogModel=new HomePageCompressDialogModel();
+
+        private DataTable pdfDataTable = new DataTable();
+        public DataTable PDFDataTable
+        {
+            get { return pdfDataTable; }
+            set
+            {
+                SetProperty(ref pdfDataTable, value);
+            }
+        }
+
+        private string compressGridIsEnabled="True";
+        public string CompressGridIsEnabled
+        {
+            get
+            {
+                return compressGridIsEnabled;
+            }
+            set
+            {
+                SetProperty(ref compressGridIsEnabled, value);
+            }
+        }
+
+        private string setCompressGridIsEnabled = "True";
+        public string SetCompressGridIsEnabled
+        {
+            get
+            {
+                return setCompressGridIsEnabled;
+            }
+            set
+            {
+                SetProperty(ref setCompressGridIsEnabled, value);
+            }
+        }
+
+        private string removeIsEnable = "False";
+        public string RemoveIsEnable
+        {
+            get { return removeIsEnable; }
+            set
+            {
+                SetProperty(ref removeIsEnable, value);
+            }
+        }
+
+        private string selectFileName = "False";
+        public string SelectFileName
+        {
+            get { return selectFileName; }
+            set
+            {
+                SetProperty(ref selectFileName, value);
+            }
+        }
+
+        private Visibility addFileVisibility = Visibility.Hidden;
+        public Visibility AddFileVisibility
+        {
+            get { return addFileVisibility; }
+            set
+            {
+                SetProperty(ref addFileVisibility, value);
+                RaisePropertyChanged();
+
+            }
+        }
+        public DelegateCommand ADDPDFCommand { get; set; }
+
+        public DelegateCommand RemovePDFFileCommand { get; set; }
+
+        public DelegateCommand ADDPDFFilesCommand { get; set; }
+
+        public DelegateCommand CompressCommand { get; set; }
+
+        public DelegateCommand<string> RadioButtonCommand{ get; set; }
+
+        public HomePageCompressDialogViewModel()
+        {
+            PDFDataTable.Columns.Add("FileName");
+            PDFDataTable.Columns.Add("FileSize");
+            PDFDataTable.Columns.Add("FileState");
+            ADDPDFCommand = new DelegateCommand(addpicture);
+            ADDPDFFilesCommand = new DelegateCommand(addpicturefiles);
+            RemovePDFFileCommand = new DelegateCommand(removepdffile);
+            CompressCommand = new DelegateCommand(compress);
+            RadioButtonCommand = new DelegateCommand<string>(RadioButton);
+        }
+
+        private void RadioButton(string sender) {
+            if (sender != "") {
+
+                switch (sender) {
+                    case "LargeQualityRadioBtn":
+                        homePageCompressDialogModel.CompressQuality = HomePageCompressDialogModel.EnumQualityLevel.StatusLarge;
+                        break;
+                    case "StandardQualityRadioBtn":
+                        homePageCompressDialogModel.CompressQuality = HomePageCompressDialogModel.EnumQualityLevel.StatusStandard;
+                        break;
+                    case "LittleQualityRadioBtn":
+                        homePageCompressDialogModel.CompressQuality = HomePageCompressDialogModel.EnumQualityLevel.StatusLittle;
+                        break;
+                    case "MicroQualityRadioBtn":
+                        homePageCompressDialogModel.CompressQuality = HomePageCompressDialogModel.EnumQualityLevel.StatusMicro;
+                        break;
+                        default:
+                        homePageCompressDialogModel.CompressQuality = HomePageCompressDialogModel.EnumQualityLevel.StatusDefault;
+                        break;
+
+                }
+            }
+
+        }
+
+        private int GetIndex(int pageindex)
+        {
+            PDFDataTable.Rows[fileNamesIndex]["FileState"]="已经压缩"+pageindex.ToString()+"页";
+            return 0;
+        }
+
+        private async void compress() {
+            CompressGridIsEnabled = "False";
+            //GC.KeepAlive(indexDelegate);
+            fileNamesIndex = 0;
+            foreach (var filename in fileNames)
+            {
+                CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
+                if (document == null) {
+                    PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                    continue;
+                }
+                FileInfo fileinfo = new FileInfo(filename);
+                string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
+                indexDelegate += GetIndex;
+                compressingIntpr = document.CompressFile_Init(((float)homePageCompressDialogModel.CompressQuality), indexDelegate);
+                tempDocument = document;
+                await Task.Run<bool>(() => { return document.CompressFile_Start(compressingIntpr, filename+"compress.pdf"); });
+                PDFDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                fileNamesIndex++;
+                document.Release();
+            }
+            CompressGridIsEnabled = "True";
+            MessageBoxEx.Show("已完成");
+            SetCompressGridIsEnabled = "False";
+            AddFileVisibility = Visibility.Visible;
+            fileNames.Clear();
+            HomePageBatchProcessingDialogModel.FilePaths.Clear();
+        }
+
+        /// <summary>
+        /// 添加PDF文件
+        /// </summary>
+        private void addpicture()
+        {
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = true;
+            dlg.Filter = "PDF|*.pdf;*.PDF;";
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                fileNames.AddRange(dlg.FileNames.ToList());
+                RemoveExcess(ref fileNames);
+                SetCompressGridIsEnabled = "True";
+                AddFileVisibility = Visibility.Collapsed;
+                updateListview("待确定");
+            }
+        }
+
+        /// <summary>
+        /// 删除重复的文件
+        /// </summary>
+        public void RemoveExcess(ref List<string> Filenames)
+        {
+            List<string> filenames = new List<string>();
+            foreach (var fileName in Filenames)
+            {
+                if (!filenames.Contains(fileName))
+                {
+                    filenames.Add(fileName);
+                }
+            }
+            Filenames.Clear();
+            Filenames = filenames;
+        }
+
+        /// <summary>
+        /// 添加PDF文件夹
+        /// </summary>
+        private void addpicturefiles()
+        {
+            FolderBrowserDialog dialog = new FolderBrowserDialog();
+            dialog.Description = "请选择文件路径";
+            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+
+                string foldPath = dialog.SelectedPath;
+                var apps = System.IO.Directory.GetFiles(foldPath);
+                foreach (string app in apps)
+                {
+                    var fi = new FileInfo(app);
+                    if (fi.Extension == ".pdf" || fi.Extension == ".PDF")
+                    {
+                        fileNames.Add(app);
+                    }
+                }
+                RemoveExcess(ref fileNames);
+                updateListview("待确定");
+                SetCompressGridIsEnabled = "True";
+                AddFileVisibility = Visibility.Collapsed;
+            }
+            
+        }
+        /// <summary>
+        /// 更新listview显示
+        /// state 状态显示字符串
+        /// </summary>
+        public void updateListview(string state)
+        {
+            DataTable pdfdatatable = new DataTable();
+            pdfdatatable.Columns.Add("FileName");
+            pdfdatatable.Columns.Add("FileSize");
+            pdfdatatable.Columns.Add("FileState");
+            foreach (var fileName in fileNames)
+            {
+                string file_all = fileName;
+                FileInfo f = new FileInfo(file_all);
+                string file_size = (((float)f.Length) / 1024).ToString() + " K";
+                pdfdatatable.Rows.Add(f.Name, file_size, state);
+            }
+            PDFDataTable = pdfdatatable;
+            HomePageBatchProcessingDialogModel.FilePaths = fileNames;
+
+        }
+        /// <summary>
+        /// 逆序int类型集合
+        /// </summary>
+        public void Reverseorder(ref List<int> Numbers)
+        {
+            Numbers = Numbers.OrderBy(a => a).ToList();
+            Numbers.Reverse();
+        }
+
+        /// <summary>
+        /// 打开文件PDF
+        /// </summary>
+        public void openfiledialog()
+        {
+
+            foreach (int filenamesview in fileNamesView)
+            {
+                System.Diagnostics.Process.Start(fileNames[filenamesview]);
+            }
+        }
+
+        /// <summary>
+        /// 删除文件PDF
+        /// </summary>
+        public void removepdffile()
+        {
+            Reverseorder(ref fileNamesView);
+            foreach (int filenamesview in fileNamesView)
+            {
+                //Trace.WriteLine(filenamesview);
+                fileNames.Remove(fileNames[filenamesview]);
+            }
+            if (fileNames.Count < 1)
+            {
+                SetCompressGridIsEnabled = "False";
+                AddFileVisibility = Visibility.Visible;
+            }
+            updateListview("待确定");
+        }
+
+
+        public void PDFFileCount()
+        {
+            if (fileNames.Count == 0)
+            {
+                SetCompressGridIsEnabled = "False";
+                AddFileVisibility = Visibility.Visible;
+            }
+            else
+            {
+                SetCompressGridIsEnabled = "True";
+                AddFileVisibility = Visibility.Collapsed;
+            }
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            List<string> filepath = new List<string>();
+            navigationContext.Parameters.TryGetValue<List<string>>(ParameterNames.FilePath, out filepath);
+            if (filepath != null)
+            {
+
+                fileNames = filepath;
+                PDFFileCount();
+                updateListview("待确定");
+            }
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            if(tempDocument!=null)
+            tempDocument.CompressFile_Cancel(compressingIntpr);
+        }
+    }
+}

+ 468 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageSetPasswordDialogViewModel.cs

@@ -0,0 +1,468 @@
+using ComPDFKit.PDFDocument;
+using PDF_Office.CustomControl;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Windows;
+using System.Windows.Forms;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing
+{
+    public class HomePageSetPasswordDialogViewModel : BindableBase, INavigationAware
+    {
+        private List<string> fileNames;
+
+        private int fileNamesIndex = 0;
+
+        private HomePageSetPasswordDialogModel setPasswordDialogModel = new HomePageSetPasswordDialogModel();
+
+        public List<int> fileNamesView = new List<int>();
+
+        private bool _canOpen;
+        public bool CanOpen
+        {
+            get { return _canOpen; }
+            set
+            {
+                _canOpen = value;
+                RaisePropertyChanged("isChecked");
+            }
+        }
+
+        private bool _canEdit;
+        public bool CanEdit
+        {
+            get { return _canEdit; }
+            set
+            {
+                _canEdit = value;
+                RaisePropertyChanged("isChecked");
+            }
+        }
+
+        private string _changeMod = "0";
+        ///<value>
+        ///"0"为ChangeMod.None;
+        ///"1"为ChangeMod.ChangePage;
+        ///"2"为ChangeMod.FormAndSignature;
+        ///"3"为ChangeMod.AnnotAndFormAndSignature;
+        ///"4"为ChangeMod.ExceptAbstrat;
+        ///</value>
+        public string ChangeMod
+        {
+            get { return _changeMod; }
+            set
+            {
+                _changeMod = value;
+            }
+        }
+
+        private string _printMod = "0";
+        ///<value>
+        ///"0"为PrintMod.None;
+        ///"1"为PrintMod.LowDpi;
+        ///"2"为PrintMod.HighDpi;
+        ///</value>
+        public string PrintMod
+        {
+            get { return _printMod; }
+            set
+            {
+                _printMod = value;
+            }
+        }
+
+        private string safetyGridIsEnabled = "True";
+        public string SafetyGridIsEnabled
+        {
+            get
+            {
+                return safetyGridIsEnabled;
+            }
+            set
+            {
+                SetProperty(ref safetyGridIsEnabled, value);
+            }
+        }
+
+        private string setSafetyGridIsEnabled = "True";
+        public string SetSafetyGridIsEnabled
+        {
+            get
+            {
+                return setSafetyGridIsEnabled;
+            }
+            set
+            {
+                SetProperty(ref setSafetyGridIsEnabled, value);
+            }
+        }
+
+        private string _isEnableConfirm = "False";
+        public string IsEnabledConfirm
+        {
+            get { return _isEnableConfirm; }
+            set
+            {
+                SetProperty(ref _isEnableConfirm, value);
+            }
+        }
+
+        private DataTable pdfDataTable = new DataTable();
+        public DataTable PDFDataTable
+        {
+            get { return pdfDataTable; }
+            set
+            {
+                SetProperty(ref pdfDataTable, value);
+            }
+        }
+
+        private string removeIsEnable = "False";
+        public string RemoveIsEnable
+        {
+            get { return removeIsEnable; }
+            set
+            {
+                SetProperty(ref removeIsEnable, value);
+            }
+        }
+
+        private string selectFileName = "False";
+        public string SelectFileName
+        {
+            get { return selectFileName; }
+            set
+            {
+                SetProperty(ref selectFileName, value);
+            }
+        }
+
+        private Visibility addFileVisibility = Visibility.Hidden;
+        public Visibility AddFileVisibility
+        {
+            get { return addFileVisibility; }
+            set
+            {
+                SetProperty(ref addFileVisibility, value);
+                RaisePropertyChanged();
+
+            }
+        }
+
+        public DelegateCommand DelegateSetOpenCommand { get; set; }
+
+        public DelegateCommand DelegateSetEditCommand { get; set; }
+
+        public DelegateCommand DelegateCanOpenTextChangedCommand { get; set; }
+
+        public DelegateCommand DelegateCanEditTextChangedCommand { get; set; }
+
+        public DelegateCommand DelegateConfirmEncryptCommand { get; set; }
+
+        public DelegateCommand DelegateCancelEncryptCommand { get; set; }
+
+        public DelegateCommand ADDPDFCommand { get; set; }
+
+        public DelegateCommand RemovePDFFileCommand { get; set; }
+
+        public DelegateCommand ADDPDFFilesCommand { get; set; }
+
+        public HomePageSetPasswordDialogViewModel()
+        {
+            PDFDataTable.Columns.Add("FileName");
+            PDFDataTable.Columns.Add("FileSize");
+            PDFDataTable.Columns.Add("FileState");
+            HomePageSetPasswordDialogModel.PasswordForOpen = "";
+            HomePageSetPasswordDialogModel.PasswordForEdit = "";
+            DelegateConfirmEncryptCommand = new DelegateCommand(ConfirmEncrypt);
+            DelegateSetOpenCommand = new DelegateCommand(SetCanOpen);
+            DelegateSetEditCommand = new DelegateCommand(SetCanEdit);
+            DelegateCanOpenTextChangedCommand = new DelegateCommand(CanOpenTextChanged);
+            DelegateCanEditTextChangedCommand = new DelegateCommand(CanEditTextChanged);
+            ADDPDFCommand = new DelegateCommand(addpdf);
+            ADDPDFFilesCommand = new DelegateCommand(addpdffiles);
+            RemovePDFFileCommand = new DelegateCommand(removepdffile);
+        }
+
+        #region 检查和初始化
+        private void CheckCanConfirmEncrypt()
+        {
+            if (setPasswordDialogModel.CanOpen)
+            {
+                if (HomePageSetPasswordDialogModel.PasswordForOpen.Length > 0)
+                {
+                    IsEnabledConfirm = "True";
+                    return;
+                }
+            }
+            if (setPasswordDialogModel.CanEdit)
+            {
+                if (HomePageSetPasswordDialogModel.PasswordForEdit.Length > 0)
+                {
+                    IsEnabledConfirm = "True";
+                    return;
+                }
+            }
+            IsEnabledConfirm = "False";
+        }
+
+        private void InitPermissionsDictionary(ref Dictionary<string, HomePageSetPasswordDialogModel.PrintMod> GetPrintMod, ref Dictionary<string, HomePageSetPasswordDialogModel.ChangeMod> GetChangeMod)
+        {
+            GetPrintMod.Add("0", HomePageSetPasswordDialogModel.PrintMod.None);
+            GetPrintMod.Add("1", HomePageSetPasswordDialogModel.PrintMod.LowDpi);
+            GetPrintMod.Add("2", HomePageSetPasswordDialogModel.PrintMod.HighDpi);
+
+            GetChangeMod.Add("0", HomePageSetPasswordDialogModel.ChangeMod.None);
+            GetChangeMod.Add("1", HomePageSetPasswordDialogModel.ChangeMod.ChangePage);
+            GetChangeMod.Add("2", HomePageSetPasswordDialogModel.ChangeMod.FormAndSignature);
+            GetChangeMod.Add("3", HomePageSetPasswordDialogModel.ChangeMod.AnnotAndFormAndSignature);
+            GetChangeMod.Add("4", HomePageSetPasswordDialogModel.ChangeMod.ExceptAbstrat);
+        }
+        #endregion
+        /// <summary>
+        /// 添加PDF文件
+        /// </summary>
+        private void addpdf()
+        {
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = true;
+            dlg.Filter = "PDF|*.pdf;*.PDF;";
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                fileNames.AddRange(dlg.FileNames.ToList());
+                RemoveExcess(ref fileNames);
+                SetSafetyGridIsEnabled = "True";
+                AddFileVisibility = Visibility.Collapsed;
+                updateListview("待确定");
+            }
+        }
+
+        /// <summary>
+        /// 删除重复的文件
+        /// </summary>
+        public void RemoveExcess(ref List<string> Filenames)
+        {
+            List<string> filenames = new List<string>();
+            foreach (var fileName in Filenames)
+            {
+                if (!filenames.Contains(fileName))
+                {
+                    filenames.Add(fileName);
+                }
+            }
+            Filenames.Clear();
+            Filenames = filenames;
+        }
+
+        /// <summary>
+        /// 添加PDF文件夹
+        /// </summary>
+        private void addpdffiles()
+        {
+            FolderBrowserDialog dialog = new FolderBrowserDialog();
+            dialog.Description = "请选择文件路径";
+            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+
+                string foldPath = dialog.SelectedPath;
+                var apps = System.IO.Directory.GetFiles(foldPath);
+                foreach (string app in apps)
+                {
+                    var fi = new FileInfo(app);
+                    if (fi.Extension == ".pdf" || fi.Extension == ".PDF")
+                    {
+                        fileNames.Add(app);
+                    }
+                }
+                RemoveExcess(ref fileNames);
+                updateListview("待确定");
+                SetSafetyGridIsEnabled = "True";
+                AddFileVisibility = Visibility.Collapsed;
+            }
+        }
+
+        /// <summary>
+        /// 更新listview显示
+        /// state 状态显示字符串
+        /// </summary>
+        public void updateListview(string state)
+        {
+            DataTable pdfdatatable = new DataTable();
+            pdfdatatable.Columns.Add("FileName");
+            pdfdatatable.Columns.Add("FileSize");
+            pdfdatatable.Columns.Add("FileState");
+            foreach (var fileName in fileNames)
+            {
+                string file_all = fileName;
+                FileInfo f = new FileInfo(file_all);
+                string file_size = (((float)f.Length) / 1024).ToString() + " K";
+                pdfdatatable.Rows.Add(f.Name, file_size, state);
+            }
+            PDFDataTable = pdfdatatable;
+            HomePageBatchProcessingDialogModel.FilePaths = fileNames;
+
+        }
+
+        public void SetCanOpen()
+        {
+            setPasswordDialogModel.CanOpen = CanOpen;
+            CheckCanConfirmEncrypt();
+        }
+
+        public void SetCanEdit()
+        {
+            setPasswordDialogModel.CanEdit = CanEdit;
+            CheckCanConfirmEncrypt();
+        }
+
+        public void CanOpenTextChanged()
+        {
+            CheckCanConfirmEncrypt();
+        }
+
+        public void CanEditTextChanged()
+        {
+            CheckCanConfirmEncrypt();
+        }
+
+        public void ConfirmEncrypt()
+        {
+            SafetyGridIsEnabled = "False";
+            string openPassword = "";
+            string editPassword = "";
+            CPDFPermissionsInfo permissionsInfo = new CPDFPermissionsInfo();
+            if (setPasswordDialogModel.CanOpen)
+            {
+                if (!string.IsNullOrEmpty(HomePageSetPasswordDialogModel.PasswordForOpen))
+                {
+                    openPassword = HomePageSetPasswordDialogModel.PasswordForOpen;
+                }
+            }
+            if (setPasswordDialogModel.CanEdit)
+            {
+                if (!string.IsNullOrEmpty(HomePageSetPasswordDialogModel.PasswordForEdit))
+                {
+                    editPassword = HomePageSetPasswordDialogModel.PasswordForEdit;
+                    Dictionary<string, HomePageSetPasswordDialogModel.PrintMod> GetPrintMod = new Dictionary<string, HomePageSetPasswordDialogModel.PrintMod>();
+                    Dictionary<string, HomePageSetPasswordDialogModel.ChangeMod> GetChangeMod = new Dictionary<string, HomePageSetPasswordDialogModel.ChangeMod>(); ;
+                    InitPermissionsDictionary(ref GetPrintMod, ref GetChangeMod);
+                    permissionsInfo = setPasswordDialogModel.CreatePermissionsInfo(GetPrintMod[PrintMod], GetChangeMod[ChangeMod]);
+                }
+            }
+            fileNamesIndex = 0;
+            foreach (var filename in fileNames)
+            {
+                PDFDataTable.Rows[fileNamesIndex]["FileState"] = "待完成";
+                CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
+                if (document == null)
+                {
+                    PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                    continue;
+                }
+                FileInfo fileinfo = new FileInfo(filename);
+                string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
+                if (document == null)
+                {
+                    return;
+                }
+                document.Encrypt(openPassword, editPassword, permissionsInfo);
+                document.WriteToFilePath(filename + "SetPassword");
+
+                PDFDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                fileNamesIndex++;
+                document.Release();
+            }
+            SafetyGridIsEnabled = "True";
+            MessageBoxEx.Show("已完成");
+            SetSafetyGridIsEnabled = "False";
+            AddFileVisibility = Visibility.Visible;
+            fileNames.Clear();
+            HomePageBatchProcessingDialogModel.FilePaths.Clear();
+        }
+
+        /// <summary>
+        /// 逆序int类型集合
+        /// </summary>
+        public void Reverseorder(ref List<int> Numbers)
+        {
+            Numbers = Numbers.OrderBy(a => a).ToList();
+            Numbers.Reverse();
+        }
+
+        /// <summary>
+        /// 打开文件PDF
+        /// </summary>
+        public void openfiledialog()
+        {
+
+            foreach (int filenamesview in fileNamesView)
+            {
+                System.Diagnostics.Process.Start(fileNames[filenamesview]);
+            }
+        }
+
+        /// <summary>
+        /// 删除文件PDF
+        /// </summary>
+        public void removepdffile()
+        {
+            Reverseorder(ref fileNamesView);
+            foreach (int filenamesview in fileNamesView)
+            {
+                //Trace.WriteLine(filenamesview);
+                fileNames.Remove(fileNames[filenamesview]);
+            }
+            if (fileNames.Count < 1)
+            {
+                SetSafetyGridIsEnabled = "False";
+                AddFileVisibility = Visibility.Visible;
+            }
+            updateListview("待确定");
+        }
+
+        public void PDFFileCount()
+        {
+            if (fileNames.Count == 0)
+            {
+                SetSafetyGridIsEnabled = "False";
+                AddFileVisibility = Visibility.Visible;
+            }
+            else
+            {
+                SetSafetyGridIsEnabled = "True";
+                AddFileVisibility = Visibility.Collapsed;
+            }
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            List<string> filepath = new List<string>();
+            navigationContext.Parameters.TryGetValue<List<string>>(ParameterNames.FilePath, out filepath);
+            if (filepath != null)
+            {
+
+                fileNames = filepath;
+                PDFFileCount();
+                updateListview("待确定");
+            }
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+    }
+}

+ 5 - 37
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageExtractDialogViewModel.cs

@@ -21,7 +21,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         #region 参数和属性
         public CPDFDocument document;
 
-        private CPDFViewer currentViewer;
+        public CPDFViewer currentViewer;
 
         private HomePageExtractDialogModel extractModel = new HomePageExtractDialogModel();
 
@@ -29,45 +29,13 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
 
 
 
-        private string extractToSingleFileIsCheck = "False";
-        public string ExtractToSingleFileIsCheck
-        {
-            get { return extractToSingleFileIsCheck; }
-            set
-            {
-                extractToSingleFileIsCheck = value;
-            }
-        }
+        public string ExtractToSingleFileIsCheck {get;set;} = "False";
 
-        private string deleteAfterExtractIsCheck = "Fales";
-        public string DeleteAfterExtractIsCheck
-        {
-            get { return deleteAfterExtractIsCheck; }
-            set
-            {
-                deleteAfterExtractIsCheck = value;
-            }
-        }
+        public string DeleteAfterExtractIsCheck { get; set; } = "Fales";
 
-        private string pageRangeText = "";
-        public string PageRangeText
-        {
-            get { return pageRangeText; }
-            set
-            {
-                pageRangeText = value;
-            }
-        }
+        public string PageRangeText { get; set; } = "";
 
-        private string pageRangeSelectIndex = "";
-        public string PageRangeSelectIndex
-        {
-            get { return pageRangeSelectIndex; }
-            set
-            {
-                pageRangeSelectIndex = value;
-            }
-        }
+        public string PageRangeSelectIndex { get; set; } = "";
         #endregion
 
         #region 委托声明

+ 3 - 33
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageInsertDialogViewModel.cs

@@ -5,17 +5,10 @@ using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
-using System.Collections.Generic;
-using System.Linq;
 using PDF_Office.Model.HomePageToolsDialogs;
 using System.Diagnostics;
-using System.Globalization;
-using System.Windows;
-using static PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs.SetPasswordDialogModel;
-using System.Windows.Forms;
 using DialogResult = Prism.Services.Dialogs.DialogResult;
 using PDF_Office.CustomControl;
-using PDF_Office.Model.Dialog.HomePageToolsDialogs;
 
 namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
 {
@@ -24,9 +17,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         #region 参数和属性
         public CPDFDocument document;
 
-        private CPDFViewer currentViewer;
-
-        private string saveFilePath { get; set; }
+        public CPDFViewer currentViewer;
 
         private HomePageInsertDialogModel insertModel = new HomePageInsertDialogModel();
 
@@ -40,15 +31,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             }
         }
 
-        private string pageLocation = "0";
-        public string PageLocation
-        {
-            get { return pageLocation; }
-            set
-            {
-                pageLocation = value;
-            }
-        }
+        public string PageLocation { get; set; } = "0";
 
         private string pageNumber = "1";
         public string PageNumber
@@ -60,19 +43,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             }
         }
 
-        private string pageInsertIndex = "1";
-        public string PageInsertIndex
-        {
-            get
-            {
-                return pageInsertIndex;
-            }
-            set
-            {
-
-                pageInsertIndex = value;
-            }
-        }
+        public string PageInsertIndex { get; set; } = "1";
 
         private string firstIsCheck = "True";
         public string FirstIsCheck
@@ -238,7 +209,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             if (viewer != null && viewer.Document != null)
             {
                 currentViewer = viewer;
-                saveFilePath = filepath;
                 document = currentViewer.Document;
                 PageNumber = currentViewer.Document.PageCount.ToString();
             }

+ 474 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogViewModel.cs

@@ -0,0 +1,474 @@
+using PDF_Office.Model;
+using Prism.Commands;
+using System.Data;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using System.IO;
+using System.Diagnostics;
+using PDF_Office.CustomControl;
+using System.Windows;
+using PDF_Office.Helper;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs;
+using ComPDFKit.PDFDocument;
+using System.Drawing;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
+{
+    public class HomePagePictureToPDFDialogViewModel : BindableBase, IDialogAware
+    {
+        #region 参数和属性
+        private List<string> fileNames;
+
+        private int fileNamesIndex = 0;
+
+        public List<int> fileNamesView = new List<int>();
+
+        public HomePagePictureToPDFDialogModel pictureToPDFModel=new HomePagePictureToPDFDialogModel();
+
+        private string pictureToPDFGridIsEnabled = "True";
+        public string PictureToPDFGridIsEnabled
+        {
+            get
+            {
+                return pictureToPDFGridIsEnabled;
+            }
+            set
+            {
+                SetProperty(ref pictureToPDFGridIsEnabled, value);
+            }
+        }
+
+        private string setPictureToPDFGridIsEnabled = "True";
+        public string SetPictureToPDFGridIsEnabled
+        {
+            get
+            {
+                return setPictureToPDFGridIsEnabled;
+            }
+            set
+            {
+                SetProperty(ref setPictureToPDFGridIsEnabled, value);
+            }
+        }
+
+        private DataTable imagesDataTable = new DataTable();
+        public DataTable ImagesDataTable
+        {
+            get { return imagesDataTable; }
+            set
+            {
+                SetProperty(ref imagesDataTable, value);
+            }
+        }
+        private string removeIsEnable = "False";
+        public string RemoveIsEnable
+        {
+            get { return removeIsEnable; }
+            set
+            {
+                SetProperty(ref removeIsEnable, value);
+            }
+        }
+
+        private string selectFileName = "False";
+        public string SelectFileName
+        {
+            get { return selectFileName; }
+            set
+            {
+                SetProperty(ref selectFileName, value);
+            }
+        }
+
+        private Visibility addFileVisibility = Visibility.Hidden;
+        public Visibility AddFileVisibility
+        {
+            get { return addFileVisibility; }
+            set
+            {
+                SetProperty(ref addFileVisibility, value);
+                RaisePropertyChanged();
+
+            }
+        }
+
+        #endregion
+        #region 委托声明
+
+        public DelegateCommand ToPDFCommand { get; set; }
+
+        public DelegateCommand ADDPictureCommand { get; set; }
+
+        public DelegateCommand ADDPictureFilesCommand { get; set; }
+
+        public DelegateCommand RemovePictureFileCommand { get; set; }
+
+        public DelegateCommand SelectFileCommand { get; set; }
+
+        #endregion
+        public HomePagePictureToPDFDialogViewModel()
+        {
+            ToPDFCommand = new DelegateCommand(topdf);
+            ADDPictureCommand = new DelegateCommand(addpicture);
+            ADDPictureFilesCommand = new DelegateCommand(addpicturefiles);
+            RemovePictureFileCommand = new DelegateCommand(removepicturefile);
+            SelectFileCommand = new DelegateCommand(selectFile);
+
+        }
+        #region 逻辑函数
+        private void topdf() {
+            PictureToPDFGridIsEnabled = "False";
+            if (pictureToPDFModel.Mode == HomePagePictureToPDFDialogModel.ToPDFFileMode.NewFiles)
+            {
+                fileNamesIndex = 0;
+                foreach (var filename in fileNames)
+                {
+                    ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "准备转换";
+                    Image img = Image.FromFile(filename);
+                    if (img == null)
+                    {
+                        ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                        continue;
+                    }
+                    CPDFDocument topdfdoc = CPDFDocument.CreateDocument();
+                    FileInfo fileinfo = new FileInfo(filename);
+                    JpegInsertPage(ref topdfdoc, filename, fileinfo,img.Width,img.Height);
+                    Trace.WriteLine("Path.GetTempPath():" + Path.GetTempPath());
+                    topdfdoc.WriteToFilePath(savefilename(filename));
+                    topdfdoc.Release();
+                    string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
+                    ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                    fileNamesIndex++;
+                }
+                System.Diagnostics.Process.Start("Explorer", "/select," + savefilename(fileNames[0]));
+            }
+            if (pictureToPDFModel.Mode == HomePagePictureToPDFDialogModel.ToPDFFileMode.OneNewFile)
+            {
+                CPDFDocument topdfdoc = CPDFDocument.CreateDocument();
+                int pageindex = 0;
+                foreach (var filename in fileNames) {
+                    ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "准备转换";
+                    Image img = Image.FromFile(filename);
+                    if (img == null)
+                    {
+                        ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                        continue;
+                    }
+                    FileInfo fileinfo = new FileInfo(filename);
+                    JpegInsertPage(ref topdfdoc, filename, fileinfo,img.Width, img.Height);
+                    pageindex++;
+                    string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
+                    ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                    fileNamesIndex++;
+                }
+                System.Diagnostics.Process.Start("Explorer", "/select," + savefilename(fileNames[0]));
+                topdfdoc.WriteToFilePath(savefilename(fileNames[0]));
+                topdfdoc.Release();
+            }
+            if (pictureToPDFModel.Mode == HomePagePictureToPDFDialogModel.ToPDFFileMode.SelectFileName)
+            {
+                CPDFDocument topdfdoc =CPDFDocument.InitWithFilePath(pictureToPDFModel.FilePath);
+                if (topdfdoc == null)
+                {
+                    Trace.WriteLine("Document==null");
+                    //TODO
+                    MessageBoxEx.Show("文档为空");
+                    return;
+                }
+                if (topdfdoc.IsEncrypted)
+                {
+                    Trace.WriteLine("youmima");
+                    MessageBoxEx.Show("文档加密");
+                    //TODO
+                    return;
+                }
+                int pageindex = topdfdoc.PageCount;
+                foreach (var filename in fileNames)
+                {
+                    ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "准备转换";
+                    Image img = Image.FromFile(filename);
+                    if (img == null)
+                    {
+                        ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                        continue;
+                    }
+                    FileInfo fileinfo = new FileInfo(filename);
+                    JpegInsertPage(ref topdfdoc, filename, fileinfo, img.Width, img.Height, pageindex);
+                    pageindex++;
+                    string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
+                    ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                    fileNamesIndex++;
+                }
+                topdfdoc.WriteToLoadedPath();
+                System.Diagnostics.Process.Start("Explorer", "/select," + topdfdoc.FilePath);
+                topdfdoc.Release();
+            }
+            RequestClose.Invoke(new DialogResult(ButtonResult.OK));
+        }
+
+        /// <summary>
+        /// 设置保存后的文件名
+        /// </summary>
+        public string savefilename(string filename)
+        {
+            FileInfo file = new FileInfo(filename);
+            return filename.Replace(file.Name, "") +pictureToPDFModel.FrontFileNameLabel+file.Name+pictureToPDFModel.RearFileNameLabel+".pdf";
+        }
+
+        /// <summary>
+        /// 选择PDF文件
+        /// </summary>
+        private void selectFile()
+        {
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = false;
+            dlg.Filter = "PDF|*.pdf;*.PDF;";
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                SelectFileName=dlg.FileName;
+                pictureToPDFModel.FilePath = dlg.FileName;
+            }
+        }
+
+        /// <summary>
+        /// 添加图片文件
+        /// </summary>
+        private void addpicture()
+        {
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = true;
+            dlg.Filter = "Picture|*.png;*.PNG;*.jpg;*.JPG;*.bmp;*.gif;*tiff;";
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                fileNames.AddRange(dlg.FileNames.ToList());
+                RemoveExcess(ref fileNames);
+                SetPictureToPDFGridIsEnabled = "True";
+                AddFileVisibility = Visibility.Collapsed;
+                updateListview("待确定");
+            }
+        }
+
+        /// <summary>
+        /// 添加图片文件夹
+        /// </summary>
+        private void addpicturefiles()
+        {
+            FolderBrowserDialog dialog = new FolderBrowserDialog();
+            dialog.Description = "请选择文件路径";
+            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+
+                string foldPath = dialog.SelectedPath;
+                var apps = System.IO.Directory.GetFiles(foldPath);
+                foreach (string app in apps)
+                {
+                    var fi = new FileInfo(app);
+                    if (fi.Extension == ".png" || fi.Extension == ".jpg" || fi.Extension == ".jpeg" || fi.Extension ==".bmp"|| fi.Extension == ".gif"|| fi.Extension == ".tiff")
+                    {
+                        fileNames.Add(app);
+                    }
+                }
+                RemoveExcess(ref fileNames);
+                updateListview("待确定");
+                SetPictureToPDFGridIsEnabled = "True";
+                AddFileVisibility = Visibility.Collapsed;
+            }
+        }
+
+        /// <summary>
+        /// 删除图片文件
+        /// </summary>
+        public void removepicturefile() {
+            Reverseorder(ref fileNamesView);
+            foreach (int filenamesview in fileNamesView)
+            {
+                //Trace.WriteLine(filenamesview);
+                fileNames.Remove(fileNames[filenamesview]);
+            }
+            if (fileNames.Count < 1)
+            {
+                SetPictureToPDFGridIsEnabled = "False";
+                AddFileVisibility = Visibility.Visible;
+            }
+            updateListview("待确定");
+        }
+
+
+            /// <summary>
+            /// 打开文件图片
+            /// </summary>
+            public void openfiledialog(){
+
+            foreach (int filenamesview in fileNamesView)
+            {
+                System.Diagnostics.Process.Start(fileNames[filenamesview]);
+            }
+        }
+
+        /// <summary>
+        /// 删除重复的文件
+        /// </summary>
+        public void RemoveExcess(ref List<string> Filenames) {
+            List<string> filenames = new List<string>();
+            foreach (var fileName in Filenames)
+            {
+                if (!filenames.Contains(fileName))
+                {
+                    filenames.Add(fileName);
+                }
+            }
+            Filenames.Clear();
+            Filenames = filenames;
+        }
+
+        /// <summary>
+        /// 逆序int类型集合
+        /// </summary>
+        public void Reverseorder(ref List<int> Numbers)
+        {
+            Numbers=Numbers.OrderBy(a=>a).ToList();
+            Numbers.Reverse();
+        }
+
+        /// <summary>
+        /// 更新listview显示
+        /// state 状态显示字符串
+        /// </summary>
+        public void updateListview( string state) {
+            DataTable imagesdatatable = new DataTable();
+            imagesdatatable.Columns.Add("FileName");
+            imagesdatatable.Columns.Add("FileSize");
+            imagesdatatable.Columns.Add("FileState");
+            foreach (var fileName in fileNames)
+            {
+                string file_all = fileName;
+                FileInfo f = new FileInfo(file_all);
+                string file_size = (((float)f.Length)/1024).ToString()+" K";
+                imagesdatatable.Rows.Add(f.Name, file_size, state);
+            }
+            ImagesDataTable = imagesdatatable;
+
+        }
+
+        /// <summary>
+        /// 图片转PNG
+        /// picturefile 图片文件名
+        /// filePath 保存路径
+        /// </summary>
+        public bool SavePng(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+        /// <summary>
+        /// 图片转JPeG
+        /// picturefile 图片文件名
+        /// filePath 保存路径
+        /// </summary>
+        public bool SaveJpeg(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    //存储各种格式
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+        /// <summary>
+        /// 插入JPeG图片
+        /// topdfdoc 所要插入的文档
+        /// filename 图片文件名
+        /// fileinfo 文件信息
+        /// width page宽
+        /// height page高
+        /// index 插入位置
+        /// </summary>
+        private void JpegInsertPage(ref CPDFDocument topdfdoc,string filename, FileInfo fileinfo,int width,int height,int index=0) {
+
+            string tempFileName = "";
+            if (fileinfo.Extension == ".jpg"|| fileinfo.Extension == ".jpeg")
+            {
+                topdfdoc.InsertPage(index, width, height, filename);
+            }
+            else 
+            {
+                tempFileName = Path.GetTempPath() + "pngtemp.jpg";
+                if (!PictureConverter.SaveJpeg(filename, tempFileName))
+                { 
+                    MessageBoxEx.Show("图片格式有问题");
+                }
+                topdfdoc.InsertPage(index, width, height, tempFileName);
+            }
+        }
+        #endregion
+
+        #region 构架行为
+        public string Title => "图片转PDF";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            string[] filepath=null;
+            parameters.TryGetValue<string[]>(ParameterNames.FilePath, out filepath);
+            if (filepath!=null)
+            {
+                fileNames=filepath.ToList();
+                ImagesDataTable.Columns.Add("FileName");
+                ImagesDataTable.Columns.Add("FileSize");
+                ImagesDataTable.Columns.Add("FileState");
+                updateListview("待确定");
+            }
+        }
+        #endregion
+    }
+}

+ 26 - 26
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContentViewModel.cs

@@ -1,17 +1,17 @@
 using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter;
-using Prism.Commands;
+using Prism.Commands;
 using Prism.Events;
-using Prism.Mvvm;
-using Prism.Regions;
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
 using System.Management.Instrumentation;
-
-namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
-{
-    public class HomePagePrinterModSizeContentViewModel : BindableBase, INavigationAware
-    {
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    public class HomePagePrinterModSizeContentViewModel : BindableBase, INavigationAware
+    {
         private IEventAggregator eventAggregator;
 
         private bool _isStatusAdaptive = true;
@@ -138,21 +138,21 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
                 SizeInfo.EnumSizeType = EnumSizeType.StatusCustomized;
             }
             SizeInfo.DisplayRatio = int.Parse(DisplayRatio);
-        }
-
-        public bool IsNavigationTarget(NavigationContext navigationContext)
-        {
-            return true;
-        }
-
-        public void OnNavigatedFrom(NavigationContext navigationContext)
-        {
-        }
-
-        public void OnNavigatedTo(NavigationContext navigationContext)
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
         {
             InitSizeInfo();
             SendSizeInfo();
-        }
-    }
-}
+        }
+    }
+}

+ 15 - 95
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageSplitDialogViewModel.cs

@@ -6,17 +6,8 @@ using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
 using PDF_Office.Helper;
-using System.Collections.Generic;
 using System.Diagnostics;
-using System.Linq;
-using ImTools;
-using PDF_Office.Model.PageEdit;
-using ComPDFKit.PDFPage;
-using System.Threading.Tasks;
-using System.Windows.Media.Imaging;
-using System.Windows.Media;
 using PDF_Office.CustomControl;
-using PDF_Office.Model.Dialog.HomePageToolsDialogs;
 using PDF_Office.Model.HomePageToolsDialogs;
 
 namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
@@ -26,7 +17,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         #region 参数和属性
         public CPDFDocument document;
 
-        private CPDFViewer currentViewer;
+        public CPDFViewer currentViewer;
 
         private HomePageSplitDialogModel splitModel = new HomePageSplitDialogModel();
 
@@ -34,25 +25,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
 
         private string savefilename { get; set; }
 
-        private string pageRangeText = "0";
-        public string PageRangeText
-        {
-            get { return pageRangeText; }
-            set
-            {
-                pageRangeText = value;
-            }
-        }
-
-        private string pageRangeSelectIndex = "0";
-        public string PageRangeSelectIndex
-        {
-            get { return pageRangeSelectIndex; }
-            set
-            {
-                pageRangeSelectIndex = value;
-            }
-        }
+        public string PageRangeText { set; get; } = "0";
+        
+        public string PageRangeSelectIndex { set; get; } = "0";
 
         private string averagePagesIsCheck = "True";
         public string AveragePagesIsCheck
@@ -114,25 +89,10 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             }
         }
 
-        private string averagePagesText = "";
-        public string AveragePagesText
-        {
-            get { return averagePagesText; }
-            set
-            {
-                averagePagesText = value;
-            }
-        }
+        public string AveragePagesText { set; get; } = "";
 
-        private string averageFilesText = "";
-        public string AverageFilesText
-        {
-            get { return averageFilesText; }
-            set
-            {
-                averageFilesText = value;
-            }
-        }
+        public string AverageFilesText { set; get; } = "";
+        
 
         private string filePathName = "";
         public string FilePathName
@@ -144,55 +104,17 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             }
         }
 
-        private string fileNameLabelText = "part";
-        public string FileNameLabelText
-        {
-            get { return fileNameLabelText; }
-            set
-            {
-                fileNameLabelText = value;
-            }
-        }
-
-        private string fileNameDeimiterText = "-";
-        public string FileNameDeimiterText
-        {
-            get { return fileNameDeimiterText; }
-            set
-            {
-                fileNameDeimiterText = value;
-            }
-        }
+        public string FileNameLabelText{ set; get; } = "part";
+        
 
-        private string frontFileIsCheck = "True";
-        public string FrontFileIsCheck
-        {
-            get { return frontFileIsCheck; }
-            set
-            {
-                frontFileIsCheck = value;
-            }
-        }
+        public string FileNameDeimiterText{ set; get; } = "-";
+        
 
-        private string fileNameLabelIsCheck = "True";
-        public string FileNameLabelIsCheck
-        {
-            get { return fileNameLabelIsCheck; }
-            set
-            {
-                fileNameLabelIsCheck = value;
-            }
-        }
+        public string FrontFileIsCheck { set; get; } = "True";
+       
+        public string FileNameLabelIsCheck { set; get; } = "True";
 
-        private string fileNameDeimiterIsCheck = "True";
-        public string FileNameDeimiterIsCheck
-        {
-            get { return fileNameDeimiterIsCheck; }
-            set
-            {
-                fileNameDeimiterIsCheck = value;
-            }
-        }
+        public string FileNameDeimiterIsCheck { set; get; } = "True";
 
         private string fileNameLabelIsEnabled = "False";
         public string FileNameLabelIsEnabled
@@ -383,7 +305,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             AverageFilesIsEnabled = "False";
             AveragePagesIsEnabled = "True";
             splitModel.Mode = HomePageSplitDialogModel.SplitMode.AveragePages;
-
         }
 
         private void averageFiles()
@@ -396,7 +317,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             AverageFilesIsEnabled = "True";
             AveragePagesIsEnabled = "False";
             splitModel.Mode = HomePageSplitDialogModel.SplitMode.AverageFiles;
-
         }
 
         private void customPageRange()

+ 23 - 4
PDF Office/ViewModels/HomeContentViewModel.cs

@@ -44,15 +44,16 @@ namespace PDF_Office.ViewModels
             }
         }
 
-
-
-
         private MainContentViewModel mainContentViewModel;
 
         public DelegateCommand OpenFileCommand { get; set; }
 
         public DelegateCommand<string> ShowToolCommand { get; set; }
 
+        public DelegateCommand CreateBlackPDFCommand { get; set; }
+
+        public DelegateCommand CreateFromOtherFile { get; set; }
+
         public IRegionManager toolregion;
 
         public IEventAggregator eventer;
@@ -65,6 +66,8 @@ namespace PDF_Office.ViewModels
             ToolRegionName = Guid.NewGuid().ToString();
             OpenFileCommand = new DelegateCommand(OpenFile);
             ShowToolCommand = new DelegateCommand<string>(ShowToolContent);
+            CreateBlackPDFCommand = new DelegateCommand(CreatBlankPDF);
+            CreateFromOtherFile = new DelegateCommand(createFromOtherFile);
 
             System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
             {
@@ -81,6 +84,14 @@ namespace PDF_Office.ViewModels
             toolregion.RequestNavigate(ToolRegionName, view);
         }
 
+        /// <summary>
+        /// 从其他格式文件创建PDF
+        /// </summary>
+        private void createFromOtherFile()
+        {
+
+        }
+
         /// <summary>
         /// 打开文件
         /// </summary>
@@ -125,11 +136,19 @@ namespace PDF_Office.ViewModels
             }
         }
 
-        public void CreatBlankPDF()
+        /// <summary>
+        /// 打开其他格式文件
+        /// </summary>
+        public void OpenFromOtherFile()
         {
 
         }
 
+        public void CreatBlankPDF()
+        {
+            mainContentViewModel.CreateFile();
+        }
+
         #region Navigate
         public void OnNavigatedTo(NavigationContext navigationContext)
         {

+ 52 - 0
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveContentViewModel.cs

@@ -0,0 +1,52 @@
+using PDF_Office.Model.CloudDrive;
+using Prism.Commands;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive
+{
+    public class CloudDriveContentViewModel : BindableBase
+    {
+
+
+        public DelegateCommand<CloudBoxItem> CheckDriveCommand { get; set; }
+        public DelegateCommand<CloudBoxItem> CheckDriveLoginUserCommand { get; set; }
+
+        private CloudDriveManager Manager =>CloudDriveManager.GetInstance();
+        public event EventHandler<bool> IshowContentHandler;
+      
+        public CloudDriveContentViewModel()
+        {
+            CheckDriveCommand = new DelegateCommand<CloudBoxItem>(CheckDrive);
+            CheckDriveLoginUserCommand = new DelegateCommand<CloudBoxItem>(CheckDriveLoginUser);
+          
+        }
+
+        public void LoadUsers()
+        {
+            var result = Manager.LoadedUsers();
+
+            IshowContentHandler?.Invoke(null, !result);
+        }
+
+        public async void CheckDrive(CloudBoxItem cloudDriveItem)
+        {
+            bool result = false;
+            result = await Manager.LoginUser(cloudDriveItem.CloudDiskType);
+            IshowContentHandler?.Invoke(null, !result);
+        }
+
+        public async void CheckDriveLoginUser(CloudBoxItem cloudDriveItem)
+        {
+            bool result = false;
+            result = await Manager.LoginUser(cloudDriveItem.CloudDiskType);
+        }
+
+
+
+    }
+}

+ 107 - 0
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveManager.cs

@@ -0,0 +1,107 @@
+using PDF_Office.Model.CloudDrive;
+using PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive
+{
+   
+    //各云盘的管理类
+    //单实例化
+    public class CloudDriveManager
+    {
+      
+        public GoogleDriveManager GoogleDrive => GoogleDriveManager.GoogleDrive;
+        public DropbBoxManager DropbBox => DropbBoxManager.DropbBox;
+        public CloudType cloudType;
+
+        private static CloudDriveManager instance;
+
+        public static CloudDriveManager GetInstance()
+        {
+            if (instance == null)
+                instance = new CloudDriveManager();
+
+            return instance;
+        }
+        private CloudDriveManager()
+        {
+        }
+
+
+        #region 用户帐号
+
+        /// <summary>
+        /// 登录
+        /// </summary>
+        public async Task<bool> LoginUser(CloudType cloudType)
+        {
+            switch(cloudType)
+            {
+                case CloudType.GoogleDrive:
+                   return await GoogleDrive.LoginUserCount();
+                case CloudType.DropBox:
+                    return await DropbBox.LoginUser();
+            }
+            return false;
+        }
+
+        public bool LoadedUsers()
+        {
+            bool isUsers = false;
+            if (Cloud.CloudLists.Count > 0)
+                isUsers = true;
+
+            return isUsers;
+
+        }
+        /// <summary>
+        /// 移除用户
+        /// </summary>
+        public async Task<bool> RemoveUser()
+        {
+            GoogleDriveUserItem userIttem = null;
+            switch (cloudType)
+            {
+                case CloudType.OneDrive:
+                    return await GoogleDrive.RemoveUser(userIttem);
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 切换用户
+        /// </summary>
+        public void SwitchUser()
+        {
+
+        }
+
+
+        #endregion
+
+
+        #region 文件
+
+        public void GetFiles()
+        {
+
+        }
+
+        public void GetFolders()
+        {
+
+        }
+
+        public void UpLoad()
+        {
+
+        }
+        #endregion
+
+    }
+}

+ 92 - 0
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/DropbBoxManager.cs

@@ -0,0 +1,92 @@
+using Dropbox.Api;
+using PDF_Office.Model.CloudDrive;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
+{
+
+
+    public class DropbBoxManager
+    {
+        private static DropbBoxManager instance;
+        public static DropbBoxManager DropbBox => instance ?? (instance = new DropbBoxManager());
+
+        public DropbBoxManager()
+        {
+        }
+
+
+
+        #region 用户帐号
+
+        /// <summary>
+        /// 登录
+        /// </summary>
+        public async Task<bool> LoginUser()
+        {
+            bool result = false;
+            DropbBoxUserItem dropbBoxUserItem = new DropbBoxUserItem();
+            result = await dropbBoxUserItem.LoginUser();
+            if(result)
+            {
+                dropbBoxUserItem.cloudType = CloudType.DropBox;
+                   UserInfo user = new UserInfo();
+                user.Name = "DropBox测试" + (Cloud.CloudLists.Count + 1).ToString();
+                dropbBoxUserItem.userInfo = user;
+
+                Cloud.CloudLists.Add(dropbBoxUserItem);
+
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// 移除用户
+        /// </summary>
+        public void RemoveUser()
+        {
+
+        }
+
+        /// <summary>
+        /// 切换用户
+        /// </summary>
+        public void SwitchUser()
+        {
+
+        }
+
+
+        #endregion
+
+
+        #region 文件
+
+        public void GetFiles()
+        {
+
+        }
+
+        public void GetFolders()
+        {
+
+        }
+
+        public void UpLoad()
+        {
+
+        }
+        #endregion
+
+
+
+
+
+
+
+    }
+}

+ 274 - 0
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/DropbBoxUserItem.cs

@@ -0,0 +1,274 @@
+using Dropbox.Api;
+using Dropbox.Api.Files;
+using PDF_Office.Model.CloudDrive;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
+{
+    /// <summary>
+    /// 单用户
+    /// </summary>
+    public class DropbBoxUserItem : UserBaseItem
+    {
+        DropboxClient client;
+        private List<DropbBoxFiles> FilesList = new List<DropbBoxFiles>();//文件
+        private List<Metadata> MetadataList = new List<Metadata>();//文件
+        public async Task<bool> LoginUser()
+        {
+            client = await DropbBoxStatic.Connect();
+            if (client == null)
+                return false;
+            else
+                return true;
+        }
+
+        public async Task<List<DropbBoxFiles>> RefreshList(string path = "")
+        {
+            var files = await client.Files.ListFolderAsync(path);
+            DropbBoxFiles dropbBoxFiles = new DropbBoxFiles();
+            List<DropbBoxFiles> FileList = new List<DropbBoxFiles>();
+            foreach (var file in files.Entries)
+            {
+                dropbBoxFiles.Name = file.Name;
+                FileList.Add(dropbBoxFiles);
+            }
+            MetadataList = (List<Metadata>)files.Entries;
+            this.FilesList = FileList;
+            return FileList;
+        }
+
+
+
+        public async Task<string> Download(string name, string savePath)
+        {
+            Metadata metadata = null;
+            foreach(var item in MetadataList)
+            {
+                if (item.IsFolder)
+                    continue;
+
+                if (item.Name == name)
+                {
+                    metadata = item;
+                    break;
+                }
+            }
+
+            if (metadata != null)
+            {
+                savePath = savePath + "\\" + metadata.Name;
+                using (var response = await client.Files.DownloadAsync(metadata.PathDisplay))
+                {
+                    var result = await response.GetContentAsStreamAsync();
+                    var stream = StreamToMemoryStream(result);
+                    using (var fileStream = System.IO.File.Create(savePath))
+                    {
+                        stream.Seek(0, System.IO.SeekOrigin.Begin);
+                        stream.CopyTo(fileStream);
+                    }
+                }
+               // System.Diagnostics.Process.Start(@"explorer.exe", "/select,\"" + savePath + "\"");
+                RefreshList(savePath);
+
+                return savePath;
+            }
+            
+            return "";
+
+        }
+
+        public MemoryStream StreamToMemoryStream(Stream stream)
+        {
+            MemoryStream memoryStream = new MemoryStream();
+
+            //将基础流写入内存流
+            const int bufferLength = 1024;
+            byte[] buffer = new byte[bufferLength];
+            int actual = stream.Read(buffer, 0, bufferLength);
+            while (actual > 0)
+            {
+                // 读、写过程中,流的位置会自动走。
+                memoryStream.Write(buffer, 0, actual);
+                actual = stream.Read(buffer, 0, bufferLength);
+            }
+            memoryStream.Position = 0;
+
+            return memoryStream;
+        }
+
+        private void Upload()
+        {
+            //if (ItemList.SelectedItem != null)
+            //{
+            //    var item = ItemList.SelectedItem as Metadata;
+            //    if (item.IsFolder)
+            //        return;
+
+            //OpenFileDialog openFileDialog = new OpenFileDialog();
+            //if ((bool)openFileDialog.ShowDialog())
+            //{
+            //    string folder = currentFolder; /*= item.PathDisplay.Replace("/" + item.Name, "");*/
+            //    using (var stream = System.IO.File.OpenRead(openFileDialog.FileName))
+            //    {
+            //        await client.Files.UploadAsync(folder + "/" + openFileDialog.SafeFileName, WriteMode.Overwrite.Instance, body: stream);
+            //    }
+            //    MessageBox.Show("上传完成");
+            //    RefreshList(folder);
+            //}
+            //}
+        }
+
+        private void Loaded()
+        {
+            //var text = sender as TextBlock;
+            //if (text == null)
+            //    return;
+            //if (text.DataContext is Metadata)
+            //{
+            //    var data = (text.DataContext as Metadata);
+            //    if (data.IsFile)
+            //    {
+            //        text.Text = "File";
+            //    }
+            //    if (data.IsFolder)
+            //    {
+            //        text.Text = "Folder";
+            //    }
+            //}
+        }
+
+
+    }
+
+
+    #region 身份验证
+
+    public static class DropbBoxStatic
+    {
+        // This loopback host is for demo purpose. If this port is not
+        // available on your machine you need to update this URL with an unused port.
+        public static readonly string LoopbackHost = "http://127.0.0.1:8080/";
+        // Add an ApiKey (from https://www.dropbox.com/developers/apps) here
+        public static readonly string ApiKey = "k1hv3601odbsmln";
+        // URL to receive OAuth 2 redirect from Dropbox server.
+        // You also need to register this redirect URL on https://www.dropbox.com/developers/apps.
+        public static readonly Uri RedirectUri = new Uri(LoopbackHost + "authorize");
+
+        // URL to receive access token from JS.
+        public static readonly Uri JSRedirectUri = new Uri(LoopbackHost + "token");
+
+        private static HttpListener http = new HttpListener();
+        public static async Task<DropboxClient> Connect()
+        {
+            DropboxCertHelper.InitializeCertPinning();
+            var state = Guid.NewGuid().ToString("N");
+            var OAuthflow = new PKCEOAuthFlow();
+            var authorizeUri = OAuthflow.GetAuthorizeUri(OAuthResponseType.Code, ApiKey, RedirectUri.ToString(), state: state, tokenAccessType: TokenAccessType.Offline, scopeList: null, includeGrantedScopes: IncludeGrantedScopes.None);
+            //var http = new HttpListener();
+            http.Prefixes.Clear();
+            http.Prefixes.Add(LoopbackHost);
+            http.Start();
+            System.Diagnostics.Process.Start(authorizeUri.ToString());
+
+            await HandleOAuth2Redirect(http);
+
+            // Handle redirect from JS and process OAuth response.
+            var redirectUri = await HandleJSRedirect(http);
+
+            var tokenResult = await OAuthflow.ProcessCodeFlowAsync(redirectUri, ApiKey, RedirectUri.ToString(), state);
+
+            //  Window.GetWindow(this).Activate();
+            DropboxClientConfig dropboxClientConfig = new DropboxClientConfig("ControlTest");
+
+            DropboxClient client;
+            client = new DropboxClient(tokenResult.AccessToken, dropboxClientConfig);
+            return client;
+        }
+
+        /// <summary>
+        /// Handle the redirect from JS and process raw redirect URI with fragment to
+        /// complete the authorization flow.
+        /// </summary>
+        /// <param name="http">The http listener.</param>
+        /// <returns>The <see cref="OAuth2Response"/></returns>
+        private static async Task<Uri> HandleJSRedirect(HttpListener http)
+        {
+            var context = await http.GetContextAsync();
+
+            // We only care about request to TokenRedirectUri endpoint.
+            while (context.Request.Url.AbsolutePath != JSRedirectUri.AbsolutePath)
+            {
+                context = await http.GetContextAsync();
+            }
+
+            var redirectUri = new Uri(context.Request.QueryString["url_with_fragment"]);
+
+            return redirectUri;
+        }
+
+
+        public static void ListenerCallback(IAsyncResult result)
+        {
+            HttpListener listener = (HttpListener)result.AsyncState;
+            // Call EndGetContext to complete the asynchronous operation.
+            HttpListenerContext context = listener.EndGetContext(result);
+            HttpListenerRequest request = context.Request;
+            // Obtain a response object.
+            HttpListenerResponse response = context.Response;
+            // Construct a response.
+            string responseString = "<HTML><BODY> Hello world!</BODY></HTML>";
+            byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
+            // Get a response stream and write the response to it.
+            response.ContentLength64 = buffer.Length;
+            System.IO.Stream output = response.OutputStream;
+            output.Write(buffer, 0, buffer.Length);
+            // You must close the output stream.
+            output.Close();
+        }
+
+
+        /// <summary>
+        /// Handles the redirect from Dropbox server. Because we are using token flow, the local
+        /// http server cannot directly receive the URL fragment. We need to return a HTML page with
+        /// inline JS which can send URL fragment to local server as URL parameter.
+        /// </summary>
+        /// <param name="http">The http listener.</param>
+        /// <returns>The <see cref="Task"/></returns>
+        private static async Task HandleOAuth2Redirect(HttpListener http)
+        {
+            var context = await http.GetContextAsync();
+
+            // We only care about request to RedirectUri endpoint.
+            while (context.Request.Url.AbsolutePath != RedirectUri.AbsolutePath)
+            {
+                context = await http.GetContextAsync();
+            }
+
+            context.Response.ContentType = "text/html";
+
+            // Respond with a page which runs JS and sends URL fragment as query string
+            // to TokenRedirectUri.
+            using (var file = System.IO.File.OpenRead("index.html"))
+            {
+                file.CopyTo(context.Response.OutputStream);
+            }
+
+            context.Response.OutputStream.Close();
+        }
+
+
+    }
+
+
+    #endregion
+
+
+
+}

+ 102 - 0
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/GoogleDriveManager.cs

@@ -0,0 +1,102 @@
+using Google.Apis.Auth.OAuth2;
+using Google.Apis.Drive.v3;
+using Google.Apis.Services;
+using Google.Apis.Util.Store;
+using PDF_Office.Model.CloudDrive;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
+{
+    //多用户UX交互
+    public class GoogleDriveManager
+    {
+        private static GoogleDriveManager instance;
+        public static GoogleDriveManager GoogleDrive => instance ?? (instance = new GoogleDriveManager());
+        private GoogleDriveManager()
+        {
+             GoogleDriveStatic.GetFilesPathTemp();
+             GoogleDriveStatic.GetCredentialsPath();
+        }
+
+        #region   请求身份验证
+
+        /// <summary>
+        /// 获取登录过的用户
+        /// </summary>
+        public async Task<bool> GetHistoryUsers()
+        {
+            var tuples = await GoogleDriveStatic.GetHistoryService();
+            Cloud.CloudLists.Clear();
+            foreach (var tuple in tuples)
+            {
+
+                if (tuple != null && tuple.Item1 != null && tuple.Item2 != null)
+                {
+                    AddGoogleDriveUser(tuple);
+                }
+            }
+
+            if (Cloud.CloudLists.Count > 0)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public async void AddGoogleDriveUser(Tuple<DriveService, UserCredential> tuple)
+        {
+            GoogleDriveUserItem userItem = new GoogleDriveUserItem();
+            userItem.Service = tuple.Item1;
+            userItem.CurrentCredential = tuple.Item2;
+            userItem.cloudType = CloudType.GoogleDrive;
+
+            UserInfo user = new UserInfo();
+            user = await userItem.GetUserAcountAsync();
+            userItem.userInfo = user;
+
+            Cloud.CloudLists.Add(userItem);
+        }
+
+        public async Task<bool> LoginUserCount()
+        {
+            var tuple = await GoogleDriveStatic.GetServiceAsync();
+            bool result = false;
+            if (tuple != null)
+            {
+                result = true;
+                await GetUserInfo(tuple);//此处不可用异步处理,否则导致的结果是没法刷新集合呈现在UI上
+            }
+
+            return result;
+        }
+
+        public async Task<bool> GetUserInfo(Tuple<DriveService, UserCredential> tuple)
+        {
+            GoogleDriveUserItem userItem = new GoogleDriveUserItem();
+            userItem.Service = tuple.Item1;
+            userItem.CurrentCredential = tuple.Item2;
+            userItem.cloudType = CloudType.GoogleDrive;
+
+            UserInfo user = new UserInfo();
+            user = await userItem.GetUserAcountAsync();
+            userItem.userInfo = user;
+
+            Cloud.CloudLists.Add(userItem);
+            return true;
+        }
+
+        public async Task<bool> RemoveUser(GoogleDriveUserItem userIttem)
+        {
+           return await userIttem.RemoveUser();
+        }
+
+        #endregion
+    }
+}

+ 386 - 0
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/GoogleDriveUserItem.cs

@@ -0,0 +1,386 @@
+using Google.Apis.Auth.OAuth2;
+using Google.Apis.Download;
+using Google.Apis.Drive.v3;
+using Google.Apis.Drive.v3.Data;
+using Google.Apis.Services;
+using Google.Apis.Util.Store;
+using PDF_Office.Model.CloudDrive;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
+{
+
+    /// <summary>
+    /// 单个用户
+    /// </summary>
+    public class GoogleDriveUserItem: UserBaseItem
+    {
+       
+        public  DriveService Service { get; set; }//Google提供服务
+        private List<GoogleDriveFiles> FilesList = new List<GoogleDriveFiles>();//文件
+
+        public UserCredential CurrentCredential { get; set; }//当前用户访问令牌
+
+        public GoogleDriveUserItem()
+        {
+         //   User = new User();
+            
+        }
+      
+        #region   对用户账号处理
+
+        /// <summary>
+        /// 移除用户帐号
+        /// </summary>
+        /// <returns>移除后的状态</returns>
+        public async Task<bool> RemoveUser()
+        {
+            bool result = false;
+            if (CurrentCredential != null)
+            {
+                result = await CurrentCredential.RevokeTokenAsync(CancellationToken.None);
+            }
+            if (result == true)
+            {
+                CurrentCredential = null;
+                FilesList.Clear();
+            }
+               
+
+            return result;
+        }
+
+        /// <summary>
+        /// 获取帐号
+        /// </summary>
+        /// <returns>返回用户帐号地址</returns>
+        private async Task<UserInfo> GetUserAcount()
+        {
+            UserInfo userInfo = null;
+            if (Service != null)
+            {
+                userInfo = new UserInfo();
+                var about = Service.About.Get();
+                about.Fields = "user";
+                var uss = await about.ExecuteAsync();
+                User user = uss.User;
+                userInfo.UserAccount = user.EmailAddress;
+                userInfo.Name = user.DisplayName;
+            }
+
+            return userInfo;
+        }
+
+        /// <summary>
+        /// 获取帐号
+        /// </summary>
+        /// <returns>返回用户帐号地址</returns>
+        public async Task<UserInfo> GetUserAcountAsync()
+        {
+            return await GetUserAcount();
+        }
+
+
+        #endregion
+
+
+        #region   文件夹
+
+
+
+        #endregion
+
+        #region  文件
+
+        /// <summary>
+        /// 对单个用户,获取文件列表
+        /// </summary>
+        public async Task<List<GoogleDriveFiles>> GetDriveFiles(DriveService service = null)
+        {
+            if (service == null)
+                return null;
+
+            // define parameters of request.
+            FilesResource.ListRequest FileListRequest = service.Files.List(); 
+
+            //listRequest.PageSize = 10;
+            //listRequest.PageToken = 10;
+            FileListRequest.Fields = "nextPageToken, files(id, name, size, version, createdTime)";
+
+            //get file list.
+            IList<Google.Apis.Drive.v3.Data.File> files = FileListRequest.Execute().Files;
+            List<GoogleDriveFiles> FileList = new List<GoogleDriveFiles>();
+
+            if (files != null && files.Count > 0)
+            {
+                foreach (var file in files)
+                {
+                       GoogleDriveFiles File = new GoogleDriveFiles
+                    {
+                        Id = file.Id,
+                        Name = file.Name,
+                        Size = file.Size,
+                        Version = file.Version,
+                        CreatedTime = file.CreatedTime
+                    };
+                    FileList.Add(File);
+                }
+                this.FilesList = FileList;
+            }
+            return FileList;
+        }
+
+        /// <summary>
+        /// 上传文件
+        /// </summary>
+        /// <param name="filepath">本地文件路径</param>
+        public  async Task<bool> FileUpload(string filepath)
+        {
+            if (Service == null)
+                return false;
+
+            var FileMetaData = new Google.Apis.Drive.v3.Data.File();
+            var str = filepath.LastIndexOf("\\");
+            var str2 = filepath.Substring(str + 1, filepath.Length - str - 1);
+
+            FileMetaData.Name = str2;
+            FileMetaData.MimeType = "";
+
+            FilesResource.CreateMediaUpload request;
+            try
+            {
+                using (var stream = new System.IO.FileStream(filepath, System.IO.FileMode.Open))
+                {
+                    request = Service.Files.Create(FileMetaData, stream, FileMetaData.MimeType);
+                    request.Fields = "id";
+                    request.Upload();
+                }
+
+                return true;
+            }
+            catch
+            {
+               return false;
+            }
+
+        }
+
+
+        /// <summary>
+        /// Download file from Google Drive by fileId.
+        /// </summary>
+        /// <param name="googleDriveFiles"></param>
+        /// <param name="savePath"></param>
+        /// <returns></returns>
+        //
+        public  async Task<string> DownloadGoogleFile(GoogleDriveFiles googleDriveFiles, string savePath)
+        {
+            if (Service == null)
+                return "";
+
+            string fileId = googleDriveFiles.Id;
+            if (string.IsNullOrEmpty(fileId))
+                return "";
+
+            //fileId = DriveFiles[0].Id;
+
+            FilesResource.GetRequest request = Service.Files.Get(fileId);
+
+            string FileName = request.Execute().Name;
+            string FilePath = System.IO.Path.Combine(savePath, FileName);
+
+            MemoryStream stream = new MemoryStream();
+
+            // Add a handler which will be notified on progress changes.
+            // It will notify on each chunk download and when the
+            // download is completed or failed.
+            request.MediaDownloader.ProgressChanged += (Google.Apis.Download.IDownloadProgress progress) =>
+            {
+                switch (progress.Status)
+                {
+                    case DownloadStatus.Downloading:
+                        {
+                            Console.WriteLine(progress.BytesDownloaded);
+                            break;
+                        }
+                    case DownloadStatus.Completed:
+                        {
+                            Console.WriteLine("Download complete.");
+                            SaveStream(stream, FilePath);
+                            break;
+                        }
+                    case DownloadStatus.Failed:
+                        {
+                            Console.WriteLine("Download failed.");
+                            break;
+                        }
+                }
+            };
+            request.Download(stream);
+
+            if (string.IsNullOrEmpty(savePath) == false)
+            {
+
+            }
+            return FilePath;
+        }
+
+        private static void SaveStream(MemoryStream stream, string FilePath)
+        {
+            using (System.IO.FileStream file = new FileStream(FilePath, FileMode.Create, FileAccess.ReadWrite))
+            {
+                stream.WriteTo(file);
+            }
+        }
+
+        #endregion
+    }
+
+
+    public static class GoogleDriveStatic
+    {
+        public static string[] Scopes = { DriveService.Scope.Drive };
+        //Google Drive应用名称
+        private static readonly string GoogleDriveAppName = "PDF Office";
+        //请求应用进行身份验证的信息
+        public static string CredentialsPath { get; private set; }
+
+        //存放已通过身份验证的用户信息,以便下次不用登录便可使用云文档
+        public static string FilesPathTemp { get; private set; }
+        /// <summary>
+        ///  异步获取Google服务的包信息,避免UI线程卡死
+        /// </summary>
+        /// <param name="userInfoFile"></param>
+        [Obsolete]
+        public static async Task<Tuple<DriveService, UserCredential>> GetServiceAsync(string userInfoFile = "")
+        {
+            Tuple<DriveService, UserCredential> tuple = null;
+            await Task.Run(() =>
+            {
+                tuple = GetService(userInfoFile);
+            });
+            return tuple;
+        }
+
+        /// <summary>
+        /// 获取Google服务的包信息(包含访问令牌,App Key密钥等)
+        /// </summary>
+        /// <param name="FilePath">登录过的用户文件;若为空,则为新用户登录</param>
+        /// <returns></returns>
+        [Obsolete]
+        public static Tuple<DriveService, UserCredential> GetService(string FilePath = "")
+        {
+            Tuple<DriveService, UserCredential> tuple = null;
+            UserCredential credential;
+
+            if (FilePath == "")
+            {
+                var time = DateTime.Now.ToString("yyyyMMddHHmmss");
+                FilePath = System.IO.Path.Combine(FilesPathTemp, time + ".json");
+            }
+
+            try
+            {
+                using (var stream = new FileStream(CredentialsPath, FileMode.Open, FileAccess.Read))
+                {
+                    credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
+                        GoogleClientSecrets.Load(stream).Secrets,
+                        Scopes,
+                        "user",
+                        CancellationToken.None,
+                        new FileDataStore(FilePath, true)).Result;
+                }
+
+                //create Drive API service.
+                DriveService service = new DriveService(new BaseClientService.Initializer()
+                {
+                    HttpClientInitializer = credential,
+                    ApplicationName = GoogleDriveAppName
+                });
+
+                return tuple = new Tuple<DriveService, UserCredential>(service, credential);
+            }
+            catch (Exception e)
+            {
+                //网络连接失败的情况
+                return null;
+            }
+            
+        }
+
+
+        /// <summary>
+        /// 获取登录过的账号
+        /// </summary>
+        /// <returns>历史账号</returns>
+        public static async Task<List<Tuple<DriveService, UserCredential>>> GetHistoryService()
+        {
+            DirectoryInfo TheFolder = new DirectoryInfo(FilesPathTemp);
+            List<Tuple<DriveService, UserCredential>> DriveServices = new List<Tuple<DriveService, UserCredential>>();
+
+            foreach (var directorieItem in TheFolder.GetDirectories())
+            {
+                var driveServiceItem = await GetServiceAsync(directorieItem.Name);
+
+                if (driveServiceItem != null)
+                {
+                    DriveServices.Add(driveServiceItem);
+                }
+            }
+            return DriveServices;
+        }
+
+
+
+        #region  云文档的用户帐户缓存路径和身份验证文件
+
+        /// <summary>
+        /// 获取或创建缓存登录帐户信息
+        /// </summary>
+        public static string GetFilesPathTemp()
+        {
+            string str_1 = System.AppDomain.CurrentDomain.BaseDirectory;
+            String FolderPath = str_1 + "GoogleDriveUsers";
+
+            if (Directory.Exists(FolderPath) == false)
+                Directory.CreateDirectory(FolderPath);
+
+            FilesPathTemp = FolderPath;
+            return FolderPath;
+        }
+
+        public static bool ClearFilesPathTemp()
+        {
+            bool result = false;
+            string str_1 = System.AppDomain.CurrentDomain.BaseDirectory;
+            String FolderPath = str_1 + "GoogleDriveUsers";
+
+            if (Directory.Exists(FolderPath) == false)
+            {
+                Directory.Delete(FolderPath);
+                result = true;
+            }
+            return result;
+        }
+
+
+        /// <summary>
+        /// 获取本地身份验证文件
+        /// </summary>
+        public static string GetCredentialsPath()
+        {
+            string str_1 = System.AppDomain.CurrentDomain.BaseDirectory;
+            String filePath = str_1 + @"\credentials.json";
+            CredentialsPath = filePath;
+            return filePath;
+        }
+
+        #endregion
+    }
+}

+ 136 - 0
PDF Office/ViewModels/HomePanel/CloudDrive/CloudFilesContentViewModel.cs

@@ -0,0 +1,136 @@
+using PDF_Office.Model.CloudDrive;
+using PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType;
+using Prism.Commands;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive
+{
+    //各云盘事件
+    public class CloudFilesContentViewModel : BindableBase
+    {
+     
+        public GoogleDriveManager GoogleDrive => GoogleDriveManager.GoogleDrive;
+        public DropbBoxManager DropbBox => DropbBoxManager.DropbBox;
+        public DelegateCommand OpenCloudDriveCommand { get; set; }
+        public DelegateCommand CheckDriveUsersCommand { get; set; }
+
+        public DelegateCommand<CloudBoxItem> CheckDriveCommand { get; set; }
+        
+        public CloudFilesContentViewModel()
+        {
+            OpenCloudDriveCommand = new DelegateCommand(OpenCloudDrive_Click);
+            OpenCloudDriveCommand = new DelegateCommand(CheckDriveUsers);
+
+            CheckDriveCommand = new DelegateCommand<CloudBoxItem>(CheckDrive);
+        }
+
+        public async void CheckDrive(CloudBoxItem cloudDriveItem)
+        {
+            switch (cloudDriveItem.CloudDiskType)
+            {
+                case CloudType.GoogleDrive:
+                     await GoogleDrive.LoginUserCount();
+                    break;
+                case CloudType.DropBox:
+                     await DropbBox.LoginUser();
+                    break;
+            }
+        }
+
+        #region 云盘公用接口
+
+        public async void CheckDriveUsers()
+        {
+            //   var result = await GetHistoryUser();
+            //    isFoundUserHandler?.Invoke(null, result);
+         // await  GoogleDrive.LoginUderCount();
+
+        }
+
+        #endregion
+        public void OpenCloudDrive_Click()
+        {
+
+        }
+
+
+        #region 谷歌云盘
+
+        public void LoginUser_Click()
+        {
+
+        }
+
+        public async Task<bool> GetHistoryUser()
+        {
+            bool isFound = false;
+
+            //if (await GoogleDrive.GetHistoryUsers())
+            //{
+            //    isFound = true;
+            //}
+            return isFound;
+
+        }
+
+        #endregion
+
+
+
+
+        #region 用户帐号
+
+        /// <summary>
+        /// 登录
+        /// </summary>
+        public void LoginUser()
+        {
+           
+        }
+
+        /// <summary>
+        /// 移除用户
+        /// </summary>
+        public void RemoveUser()
+        {
+
+        }
+
+        /// <summary>
+        /// 切换用户
+        /// </summary>
+        public void SwitchUser()
+        {
+
+        }
+
+
+        #endregion
+
+
+        #region 文件
+        
+        public void GetFiles()
+        {
+
+        }
+
+        public void GetFolders()
+        {
+
+        }
+
+        public void UpLoad()
+        {
+
+        }
+        #endregion
+
+    }
+}

+ 30 - 1
PDF Office/ViewModels/HomePanel/HomeCloudContentViewModel.cs

@@ -1,4 +1,8 @@
-using Prism.Mvvm;
+using PDF_Office.Model.CloudDrive;
+using PDF_Office.ViewModels.HomePanel.CloudDrive;
+using PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType;
+using Prism.Commands;
+using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -9,8 +13,33 @@ namespace PDF_Office.ViewModels.HomePanel
 {
     public class HomeCloudContentViewModel:BindableBase
     {
+        public DelegateCommand<CloudBoxItem> OpenCloudDriveCommand { get; set; }
         public HomeCloudContentViewModel()
         {
+            OpenCloudDriveCommand = new DelegateCommand<CloudBoxItem>(OpenCloudDrive_Click);
+        }
+
+        public void OpenCloudDrive_Click(CloudBoxItem cloudDiskItem)
+        {
+            if (cloudDiskItem != null)
+            {
+
+                switch (cloudDiskItem.CloudDiskType)
+                {
+                    case CloudType.Box:
+                        break;
+                    case CloudType.DropBox:
+                        break;
+                    case CloudType.GoogleDrive:
+                        //    isSccuess = await googleDriveViewModel.LoginUser();
+                        break;
+                    case CloudType.OneDrive:
+                        break;
+                    default:
+                        break;
+                }
+
+            }
 
         }
     }

+ 31 - 10
PDF Office/ViewModels/HomePanel/HomeGuidContentViewModel.cs

@@ -2,6 +2,7 @@
 using ComPDFKitViewer.PdfViewer;
 using PDF_Office.CustomControl;
 using PDF_Office.Model;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
 using PDF_Office.Model.PDFTool;
 using PDF_Office.Views.HomePanel.PDFTools;
 using Prism.Commands;
@@ -29,22 +30,30 @@ namespace PDF_Office.ViewModels.HomePanel
 
         public void QuickTools_Click(ToolItem toolItem)
         {
-
-
             /*
              *设置这个对话框的起始保存路径
              */
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = false;
             dlg.Filter = "PDF|*.pdf;*.PDF;";
+            if (toolItem.Tag == PDFToolType.Compress || toolItem.Tag == PDFToolType.Security)
+            {
+                dlg.Multiselect = true;
+            }
+                if (toolItem.Tag == PDFToolType.Merge)
+            {
+                dlg.Multiselect = true;
+                dlg.Filter = "Picture|*.png;*.PNG;*.jpg;*.JPG;*bmp;*jpeg;*gif;*tiff;";
+            }
             if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 CPDFViewer viewer = new CPDFViewer();
-                viewer.InitDocument(dlg.FileName);
+                
                 switch (toolItem.Tag)
                 {
                     case PDFToolType.Split:
-                        Split_Click();
+                        
+                        viewer.InitDocument(dlg.FileName);
                         DialogParameters splitvalue = new DialogParameters();
                         splitvalue.Add(ParameterNames.PDFViewer, viewer);
                         splitvalue.Add(ParameterNames.FilePath, dlg.FileName);
@@ -52,6 +61,7 @@ namespace PDF_Office.ViewModels.HomePanel
                         break;
 
                     case PDFToolType.Extract:
+                        viewer.InitDocument(dlg.FileName);
                         DialogParameters extractvalue = new DialogParameters();
                         extractvalue.Add(ParameterNames.PDFViewer, viewer);
                         extractvalue.Add(ParameterNames.FilePath, dlg.FileName);
@@ -59,6 +69,7 @@ namespace PDF_Office.ViewModels.HomePanel
                         break;
 
                     case PDFToolType.Insert:
+                        viewer.InitDocument(dlg.FileName);
                         DialogParameters insertvalue = new DialogParameters();
                         insertvalue.Add(ParameterNames.PDFViewer, viewer);
                         insertvalue.Add(ParameterNames.FilePath, dlg.FileName);
@@ -66,29 +77,39 @@ namespace PDF_Office.ViewModels.HomePanel
                         break;
 
                     case PDFToolType.Compress:
+                        DialogParameters compresspdf = new DialogParameters();
+                        compresspdf.Add(ParameterNames.BatchProcessing_Name, "1");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 1;
+                        compresspdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, compresspdf, e => { });
                         break;
 
                     case PDFToolType.Merge:
+                        DialogParameters picturetopdf = new DialogParameters();
+                        picturetopdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePagePictureToPDFDialog, picturetopdf, e => { });
                         break;
 
                     case PDFToolType.Print:
                         DialogParameters printvalue = new DialogParameters();
-                        printvalue.Add(ParameterNames.PDFViewer, viewer); ;
                         printvalue.Add(ParameterNames.FilePath, dlg.FileName);
                         dialogs.ShowDialog(DialogNames.HomePagePrinterDialog, printvalue, e => { });
                         break;
 
                     case PDFToolType.Security:
+                        DialogParameters securitypdf = new DialogParameters();
+                        securitypdf.Add(ParameterNames.BatchProcessing_Name, "2");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 1;
+                        securitypdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, securitypdf, e => { });
+                        
                         break;
                 }
 
             }
         }
 
-        private void Split_Click()
-        {
-
-        }
-
     }
 }

+ 253 - 14
PDF Office/ViewModels/MainContentViewModel.cs

@@ -16,11 +16,14 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
-using System.Windows.Controls;
 using PDF_Office.Model;
 using System.ComponentModel;
 using PDF_Office.Helper;
 using PDFSettings.Settings;
+using System.Drawing;
+using System.IO;
+using System.Drawing.Imaging;
+using ComPDFKit.PDFDocument;
 
 namespace PDF_Office.ViewModels
 {
@@ -58,6 +61,8 @@ namespace PDF_Office.ViewModels
             set { SetProperty(ref fileChanged, value); }
         }
 
+        private bool isNewDocument = false;
+
         public CPDFViewer PDFViewer { get; set; }
 
 
@@ -113,6 +118,10 @@ namespace PDF_Office.ViewModels
         }
 
 
+        /// <summary>
+        /// 打开指定路径的PDF文件
+        /// </summary>
+        /// <param name="filePath"></param>
         public void OpenFile(string filePath)
         {
             var result = LoadFileFormPath(filePath);
@@ -122,28 +131,40 @@ namespace PDF_Office.ViewModels
             }
             FilePath = filePath;
 
-            NavigationParameters parameters = new NavigationParameters {
-                { ParameterNames.MainViewModel, this },
-                { ParameterNames.PDFViewer,PDFViewer}
-            };
-            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
-                {
-                    if (toolregion.Regions.ContainsRegionWithName(MainContentRegionName))
-                        toolregion.RequestNavigate(MainContentRegionName, "ViewContent", parameters);
-                }));
+            NavigateToViewContent();
 
             //检查是否是新文档
             OpenFileInfo isnew = SettingHelper.GetFileInfo(filePath);
             if (isnew == null)
             {
                 isNewDocument = true;
-                if(App.OpenedFileList.Contains(filePath) == false)
+                if (App.OpenedFileList.Contains(filePath) == false)
+                {
                     App.OpenedFileList.Add(filePath);
-                SettingHelper.SortRecentOpenFiles(filePath);
-            } 
+                }
+         
+            }
+            //打开文件后,不管是新文件还是旧文件都需要更新排序
+            SettingHelper.SortRecentOpenFiles(filePath);
+        }
+
+        /// <summary>
+        /// 创建PDFviewer对象后导航到ViewContent
+        /// </summary>
+        private void NavigateToViewContent()
+        {
+            NavigationParameters parameters = new NavigationParameters {
+                { ParameterNames.MainViewModel, this },
+                { ParameterNames.PDFViewer,PDFViewer}
+            };
+            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+            {
+                if (toolregion.Regions.ContainsRegionWithName(MainContentRegionName))
+                    toolregion.RequestNavigate(MainContentRegionName, "ViewContent", parameters);
+            }));
 
         }
-        private bool isNewDocument = false;
+
         /// <summary>
         /// 从文件路径创建PDFViewer对象,已包含文档解密逻辑
         /// </summary>
@@ -195,6 +216,213 @@ namespace PDF_Office.ViewModels
             return true;
         }
 
+        /// <summary>
+        /// 创建文件,路径为空时表示创建空白文档
+        /// 否则表示从图片路径创建PDf
+        /// </summary>
+        /// <param name="imagePath"></param>
+        /// <returns></returns>
+        public bool CreateFile(string imagePath = null)
+        {
+            PDFViewer = new CPDFViewer();
+            PDFViewer.CreateDocument();
+            PDFViewer.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+            if (PDFViewer.Document == null)
+            {
+                AlertsMessage alertsMessage = new AlertsMessage();
+                alertsMessage.ShowDialog("","创建文件失败.","OK");
+                return false;
+            }
+
+            if (string.IsNullOrEmpty(imagePath))
+            {
+                FileName = "Blank Page.pdf";
+                //默认插入595*842 大小的页面
+                PDFViewer.Document.InsertPage(0, 595, 842, null);
+            }
+            else
+            {
+                FileName = imagePath.Substring(imagePath.LastIndexOf("\\") + 1, imagePath.LastIndexOf(".") - imagePath.LastIndexOf("\\") - 1) + ".pdf";
+                Bitmap pic = new Bitmap(imagePath);
+                int width = pic.Size.Width;
+                int height = pic.Size.Height;
+
+                string ex = System.IO.Path.GetExtension(imagePath);
+                //其他格式或者名称中含空格的图片 在本地先转存一下
+                if ((ex != ".jpg" && ex != ".jpeg") || !Uri.IsWellFormedUriString(imagePath, UriKind.Absolute))
+                {
+                    //将其他格式图片转换成jpg
+                    string folderPath = Path.GetTempPath();
+                    if (File.Exists(folderPath))
+                    {
+                        File.Delete(folderPath);
+                    }
+                    DirectoryInfo tempfolder = new DirectoryInfo(folderPath);
+                    if (!tempfolder.Exists)
+                    {
+                        tempfolder.Create();
+                    }
+                    string targetPath = System.IO.Path.Combine(folderPath, Guid.NewGuid().ToString());
+                    imagePath = targetPath;
+                    pic.Save(targetPath, ImageFormat.Jpeg);
+                }
+                pic.Dispose();
+
+                var result = PDFViewer.Document.InsertPage(0, width, height, imagePath);
+                if (!result)
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                    alertsMessage.ShowDialog("", "创建文件失败.", "OK");
+                    return false;
+                }
+            }
+
+            //设置背景色
+            ////PDFViewer.SetBackgroundBrush(new SolidColorBrush((Color)System.Windows.Media.ColorConverter.ConvertFromString(Settings.Default.AppProperties.InitialVIew.Background)));
+            PDFViewer.Load();
+            PDFViewer.UndoManager.CanSave = true;
+            FileChanged = Visibility.Visible;
+            PDFViewer.SetFormFieldHighlight(true);
+
+            NavigateToViewContent();
+            return true;
+        }
+
+        /// <summary>
+        /// 从office文件转换成PDF
+        /// </summary>
+        /// <param name="sourcepath"></param>
+        /// <returns></returns>
+        public async Task<bool> CreateFileFromOffice(string sourcepath)
+        {
+            try
+            {
+                string folderPath = Path.GetTempPath();
+                if (File.Exists(folderPath))
+                {
+                    File.Delete(folderPath);
+                }
+                DirectoryInfo tempfolder = new DirectoryInfo(folderPath);
+                if (!tempfolder.Exists)
+                {
+                    tempfolder.Create();
+                }
+                string targetPath = System.IO.Path.Combine(folderPath, Guid.NewGuid().ToString() + ".pdf");
+
+                string ex = System.IO.Path.GetExtension(sourcepath);
+
+                switch (ex)
+                {
+
+                    case ".doc":
+                    case ".docx":
+                    case "docm":
+                    case ".dot":
+                    case ".dotx":
+                    case ".dotm":
+                    case ".txt":
+                        await Task.Run(() =>
+                        {
+
+                            Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
+                            Microsoft.Office.Interop.Word.Document document = null;
+
+                            word.Visible = false;
+                            word.ShowWindowsInTaskbar = true;
+                            document = word.Documents.Open(sourcepath);
+                            document?.ExportAsFixedFormat(targetPath, Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF);
+                            document?.Close();
+                            word?.Quit();
+                        });
+                        break;
+                    case ".xls":
+                    case ".xlsx":
+                    case ".xlsm":
+                    case ".xlsb":
+                    case ".xlam":
+                    case ".xltx":
+                    case ".xlt":
+                        await Task.Run(() =>
+                        {
+                            Microsoft.Office.Interop.Excel.Application excele = new Microsoft.Office.Interop.Excel.Application();
+                            Microsoft.Office.Interop.Excel.Workbook workbook = null;
+
+                            excele.Visible = false;
+                            try
+                            {
+                                workbook = excele.Workbooks.Open(sourcepath);
+                            }
+                            catch (Exception e)
+                            {
+                                workbook = excele.Workbooks.Open(sourcepath, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "t", false, false, 0, true, 1, Microsoft.Office.Interop.Excel.XlCorruptLoad.xlRepairFile);
+                            }
+
+
+                            workbook?.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, targetPath);
+                            workbook?.Close();
+                            excele?.Quit();
+                        });
+                        break;
+                    case ".ppt":
+                    case ".pptx":
+                    case ".pptm":
+                    case ".pptsx":
+                    case ".pps":
+                    case ".pptsm":
+                    case ".pot":
+                    case ".potm":
+                        await Task.Run(() =>
+                        {
+                            Microsoft.Office.Interop.PowerPoint.Application ppt = new Microsoft.Office.Interop.PowerPoint.Application();
+                            Microsoft.Office.Interop.PowerPoint.Presentation presentation = null;
+
+                            ppt.Visible = Microsoft.Office.Core.MsoTriState.msoCTrue;
+                            presentation = ppt.Presentations.Open(sourcepath);
+
+                            presentation.ExportAsFixedFormat(targetPath, Microsoft.Office.Interop.PowerPoint.PpFixedFormatType.ppFixedFormatTypePDF);
+                            presentation?.Close();
+                            ppt?.Quit();
+                        });
+                        break;
+                }
+
+                PDFViewer = new CPDFViewer();
+                PDFViewer.CreateDocument();
+
+                if (PDFViewer.Document == null)
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                    alertsMessage.ShowDialog("","创建PDF失败","OK");
+                    return false;
+                }
+
+                FileName = sourcepath.Substring(sourcepath.LastIndexOf("\\") + 1, sourcepath.LastIndexOf(".") - sourcepath.LastIndexOf("\\") - 1) + ".pdf";
+
+                var tempdoc = CPDFDocument.InitWithFilePath(targetPath);
+                if (tempdoc == null)
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                    alertsMessage.ShowDialog("", "创建PDF失败", "OK");
+                    return false;
+                }
+
+                PDFViewer.Document.ImportPages(tempdoc, "");
+
+                //PDFViewer.SetBackgroundBrush(new SolidColorBrush((Color)System.Windows.Media.ColorConverter.ConvertFromString(Settings.Default.AppProperties.InitialVIew.Background)));
+                PDFViewer.Load();
+                PDFViewer.UndoManager.CanSave = true;
+
+
+                return true;
+            }
+            catch (Exception ex)
+            {
+                AlertsMessage alertsMessage = new AlertsMessage();
+                alertsMessage.ShowDialog("", "没有安装Office", "OK");
+                return false;
+            }
+        }
+
         private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
         {
             if (e.PropertyName == "CanSave")
@@ -203,9 +431,19 @@ namespace PDF_Office.ViewModels
                 {
                     FileChanged = Visibility.Visible;
                 }
+                else
+                {
+                    FileChanged = Visibility.Collapsed;
+                }
+
+                if (!string.IsNullOrEmpty(PDFViewer.Document.FileName))
+                {
+                    FileName = PDFViewer.Document.FileName;
+                }
             }
         }
 
+        #region Navigation
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             if (navigationContext.Parameters.Count <= 0)
@@ -225,5 +463,6 @@ namespace PDF_Office.ViewModels
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
         }
+        #endregion
     }
 }

+ 92 - 0
PDF Office/ViewModels/Tools/ConverterBarContentViewModel.cs

@@ -0,0 +1,92 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Controls;
+
+namespace PDF_Office.ViewModels.Tools
+{
+    public class ConverterBarContentViewModel : BindableBase, INavigationAware
+    {
+        private bool isFirstLoad = true;
+
+        private CPDFViewer PDFViewer;
+
+        public IDialogService dialogs;
+
+        private ViewContentViewModel viewContentViewModel;
+
+        public DelegateCommand<object> ToConverterCommand { get; set; }
+
+        public ConverterBarContentViewModel(IDialogService dialogService)
+        {
+            dialogs = dialogService;
+            ToConverterCommand = new DelegateCommand<object>(toconverter);
+        }
+
+        private void toconverter(object sender)
+        {
+            var args = sender as Button;
+            if (args != null)
+            {
+                DialogParameters value = new DialogParameters();
+                value.Add(ParameterNames.PDFViewer, PDFViewer);
+                switch (args.Name) {
+                    case "ConverterWordBtn":
+                        dialogs.ShowDialog(DialogNames.ConverterWordDialog, value, e => { });
+                        break;
+                    case "ConverterExcelBtn":
+                        dialogs.ShowDialog(DialogNames.ConverterExcelDialog, value, e => { });
+                        break;
+                    case "ConverterPPTBtn":
+                        dialogs.ShowDialog(DialogNames.ConverterPPTDialog, value, e => { });
+                        break;
+                    case "ConverterRTFBtn":
+                        dialogs.ShowDialog(DialogNames.ConverterRTFDialog, value, e => { });
+                        break;
+                    case "ConverterCSVBtn":
+                        dialogs.ShowDialog(DialogNames.ConverterCSVDialog, value, e => { });
+                        break;
+                    case "ConverterHTMLBtn":
+                        dialogs.ShowDialog(DialogNames.ConverterHTMLDialog, value, e => { });
+                        break;
+                    case "ConverterTextBtn":
+                        dialogs.ShowDialog(DialogNames.ConverterTextDialog, value, e => { });
+                        break;
+                    case "ConverterImgBtn":
+                        dialogs.ShowDialog(DialogNames.ConverterImgDialog, value, e => { });
+                        break;
+                    default:
+                        break;
+
+
+                }
+            }
+            }
+
+            public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            if (PDFViewer != null)
+            {
+                isFirstLoad = false;
+            }
+        }
+    }
+}

+ 358 - 33
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -15,6 +15,7 @@ using PDF_Office.CustomControl;
 using PDF_Office.Model;
 using System.Windows;
 using System.Windows.Controls;
+using System.IO;
 
 namespace PDF_Office.ViewModels
 {
@@ -40,6 +41,16 @@ namespace PDF_Office.ViewModels
 
         public string ToolsBarContentRegionName { get; set; }
 
+        public string ConverterBarContentRegionName { get; set; }
+
+        /// <summary>
+        /// 是否处于页面编辑模式,用于执行undo redo 的具体操作
+        /// </summary>
+        public bool isInPageEdit = false;
+
+        public Action PageEditUndo { get; set; }
+
+        public Action PageEditRedo { get; set; }
 
 
         private int gridToolRow = 1;
@@ -94,6 +105,20 @@ namespace PDF_Office.ViewModels
                 SetProperty(ref isLoading, value);
             }
         }
+        
+        private Visibility converterBarContentVisible = Visibility.Collapsed;
+        /// <summary>
+        /// 控制ToolsBarContent的显示
+        /// 留意:显示前需要先注入内容、设置好行和跨行数
+        /// </summary>
+        public Visibility ConverterBarContentVisible
+        {
+            get { return converterBarContentVisible; }
+            set
+            {
+                SetProperty(ref converterBarContentVisible, value);
+            }
+        }
 
         private Visibility toolsbarContentVisible = Visibility.Collapsed;
         /// <summary>
@@ -109,6 +134,41 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        private bool canSave;
+        /// <summary>
+        /// 是否可以保存
+        /// </summary>
+        public bool CanSave
+        {
+            get { return canSave; }
+            set
+            {
+                SetProperty(ref canSave, value);
+            }
+        }
+
+        private bool canUndo;
+
+        public bool CanUndo
+        {
+            get { return canUndo; }
+            set
+            {
+                SetProperty(ref canUndo, value);
+            }
+        }
+
+        private bool canRedo;
+
+        public bool CanRedo
+        {
+            get { return canRedo; }
+            set
+            {
+                SetProperty(ref canRedo, value);
+            }
+        }
+
 
         private Dictionary<string, string> regionNameByTabItem;
 
@@ -118,8 +178,6 @@ namespace PDF_Office.ViewModels
 
         private string currentBar = "";
 
-
-
         /// <summary>
         /// 用来避免重复触发导航事件的标志符
         /// </summary>
@@ -138,6 +196,14 @@ namespace PDF_Office.ViewModels
         public DelegateCommand Load { get; set; }
 
         public DelegateCommand<object> TabControlSelectionChangedCommand { get; set; }
+
+        public DelegateCommand SaveFile { get; set; }
+
+        public DelegateCommand SaveAsFile { get; set; }
+
+        public DelegateCommand UndoCommand { get; set; }
+
+        public DelegateCommand RedoCommand { get; set; }
         #endregion
 
         public ViewContentViewModel(IRegionManager regionManager, IDialogService dialogService)
@@ -147,8 +213,11 @@ namespace PDF_Office.ViewModels
 
             LoadFile = new DelegateCommand(loadFile);
             Load = new DelegateCommand(LoadControl);
+            SaveFile = new DelegateCommand(()=> { saveFile(); });
+            SaveAsFile = new DelegateCommand(() => { saveAsFile(); });
+            UndoCommand = new DelegateCommand(Undo);
+            RedoCommand = new DelegateCommand(Redo);
             TabControlSelectionChangedCommand = new DelegateCommand<object>(TabControlSelectonChangedEvent);
-
             ViwerRegionName = Guid.NewGuid().ToString();
             BOTARegionName = Guid.NewGuid().ToString();
             PropertyRegionName = Guid.NewGuid().ToString();
@@ -157,6 +226,7 @@ namespace PDF_Office.ViewModels
             ToolContentVisible = Visibility.Visible;
             ToolContentRegionName = Guid.NewGuid().ToString();
             ToolsBarContentRegionName = Guid.NewGuid().ToString();
+            ConverterBarContentRegionName = Guid.NewGuid().ToString();
 
             ToolContentVisible = Visibility.Collapsed;
             ToolsBarContentVisible = Visibility.Collapsed;
@@ -172,7 +242,7 @@ namespace PDF_Office.ViewModels
             dictionary.Add("TabItemTool", ToolsBarContentRegionName);
             //其他工具菜单栏共用一个ToolsBarContentRegionName
             dictionary.Add("TabItemAnnotation", ToolsBarContentRegionName);
-            dictionary.Add("TabItemConvert", ToolsBarContentRegionName);
+            dictionary.Add("TabItemConvert", ConverterBarContentRegionName);
             dictionary.Add("TabItemScan", ToolsBarContentRegionName);
             dictionary.Add("TabItemEdit", ToolsBarContentRegionName);
             dictionary.Add("TabItemForm", ToolsBarContentRegionName);
@@ -183,31 +253,50 @@ namespace PDF_Office.ViewModels
         {
             dictionary.Add("TabItemPageEdit", "PageEditContent");
             dictionary.Add("TabItemTool", "ToolsBarContent");
-            dictionary.Add("TabItemAnnotation", "");
-            dictionary.Add("TabItemConvert", "");
+            dictionary.Add("TabItemAnnotation", "AnnotToolContent");
+            dictionary.Add("TabItemConvert", "ConverterBarContent");
             dictionary.Add("TabItemScan", "");
             dictionary.Add("TabItemEdit", "");
             dictionary.Add("TabItemForm", "");
             dictionary.Add("TabItemFill", "");
         }
 
-        private void LoadControl()
+        private void UpdateShowContent(string currentBar) {
+
+            ToolContentVisible = Visibility.Collapsed;
+            ToolsBarContentVisible = Visibility.Collapsed;
+            ConverterBarContentVisible = Visibility.Collapsed;
+            switch (currentBar) {
+                case "TabItemTool":
+                    ToolsBarContentVisible = Visibility.Visible;
+                    break;
+                case "TabItemConvert":
+                    ConverterBarContentVisible = Visibility.Visible;
+                    break;
+                case "TabItemPageEdit":
+                    ToolContentVisible = Visibility.Visible;
+                    break;
+                default:
+                    break;
+
+
+            }
+        }
+
+        private void UndoManager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
         {
-            //在构造函数中使用Region需要借助Dispatcher 确保UI已经加载完成,加载BOTA区域
-            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+            if (e.PropertyName == "CanSave")
             {
-                region.RequestNavigate(BOTARegionName, "BOTAContent");
+                CanSave = PDFViewer.UndoManager.CanSave;
+            }
+            if(e.PropertyName == "CanUndo")
+            {
+                CanUndo = PDFViewer.UndoManager.CanUndo;
+            }
+            if(e.PropertyName =="CanRedo")
+            {
+                CanRedo = PDFViewer.UndoManager.CanRedo;
             }
-            ));
-        }
-
-        /// <summary>
-        /// 将PDFViwer添加到Region
-        /// </summary>
-        private void loadFile()
-        {
-            PDFViewer.MouseWheelZoomHandler += PdfViewer_MouseWheelZoomHandler;
-            region.AddToRegion(ViwerRegionName, PDFViewer);
         }
 
         /// <summary>
@@ -223,15 +312,17 @@ namespace PDF_Office.ViewModels
                 currentBar = item.Name;
                 if (previousBar != currentBar)
                 {
-                        if(currentBar== "TabItemPageEdit")//如果是页面编辑则进入页面编辑模式
-                        {
-                            EnterToolMode(barContentByTabItem[currentBar]);
-                        }
-                        else//其余情况直接导航至对应的工具栏即可,不需要清空之前的content,region里是单例模式
-                        {
-                            EnterSelectedBar(currentBar);
-                        }
-                        previousBar = currentBar;
+                    if(currentBar== "TabItemPageEdit")//如果是页面编辑则进入页面编辑模式
+                    {
+                        EnterToolMode(barContentByTabItem[currentBar]);
+                        isInPageEdit = true;
+                    }
+                    else//其余情况直接导航至对应的工具栏即可,不需要清空之前的content,region里是单例模式
+                    {
+                        EnterSelectedBar(currentBar);
+                        isInPageEdit = false;
+                    }
+                    previousBar = currentBar;
                 }
             }
         }
@@ -307,6 +398,241 @@ namespace PDF_Office.ViewModels
         #endregion
 
         #region 方法
+        private void Undo()
+        {
+            if(isInPageEdit)
+            {
+                //执行页面编辑的Undo
+                PageEditUndo?.Invoke();
+            }
+            else
+            {
+                PDFViewer.UndoManager.Undo();
+            }
+        }
+
+        private void Redo()
+        {
+            if(isInPageEdit)
+            {
+                //执行页面编辑的Redo
+                PageEditRedo?.Invoke();
+            }
+            else
+            {
+                PDFViewer.UndoManager.Redo();
+            }
+        }
+
+        private void LoadControl()
+        {
+            //在构造函数中使用Region需要借助Dispatcher 确保UI已经加载完成,加载BOTA区域
+            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+            {
+                NavigationParameters parameters = new NavigationParameters();
+                parameters.Add(ParameterNames.PDFViewer, PDFViewer);
+                parameters.Add(ParameterNames.ViewContentViewModel, this);
+                region.RequestNavigate(BOTARegionName, "BOTAContent",parameters);
+            }
+            ));
+        }
+
+        /// <summary>
+        /// 将PDFViwer添加到Region
+        /// </summary>
+        private void loadFile()
+        {
+            PDFViewer.MouseWheelZoomHandler += PdfViewer_MouseWheelZoomHandler;
+            PDFViewer.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+            CanSave = PDFViewer.UndoManager.CanSave;
+            CanUndo = PDFViewer.UndoManager.CanUndo;
+            CanRedo = PDFViewer.UndoManager.CanRedo;
+            region.AddToRegion(ViwerRegionName, PDFViewer);
+        }
+
+        /// <summary>
+        /// 已有路径文档的保存逻辑
+        /// </summary>
+        private bool saveFile()
+        {
+            try
+            {
+                if (string.IsNullOrEmpty(PDFViewer.Document.FilePath))
+                    return saveAsFile();
+
+                //文档已被修复时 提示另存为
+                if (PDFViewer.Document.HasRepaired)
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                    alertsMessage.ShowDialog("", "文件已被修复,建议另存为", "Cancel", "OK");
+                    if (alertsMessage.result == ContentResult.Ok)
+                        return saveAsFile();
+                    else
+                        return false;
+                }
+
+                //文件路径无法存在时
+                if (!File.Exists(PDFViewer.Document.FilePath))
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                    alertsMessage.ShowDialog("", "文件路径不存在,需要另存为", "Cancel", "OK");
+                    if (alertsMessage.result == ContentResult.Ok)
+                        return saveAsFile();
+                    else
+                        return false;
+                }
+
+                //只读文件无法写入时,提示另存为
+                FileInfo fileInfo = new FileInfo(PDFViewer.Document.FilePath);
+                if (fileInfo.IsReadOnly)
+                {
+                    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)
+                {
+                    PDFViewer.UndoManager.CanSave = false;
+                    App.Current.Dispatcher.Invoke(() =>
+                    {
+                        //TODO:更新缩略图
+                        //OpenFileInfo info = SettingHelper.GetFileInfo(PdfViewer.Document.FilePath);
+                        //try
+                        //{
+                        //    if (!string.IsNullOrEmpty(info.ThumbImgPath) && !PdfViewer.Document.IsEncrypted)//加密的文档不获取缩略图
+                        //    {
+                        //        var size = PdfViewer.Document.GetPageSize(0);
+                        //        System.Drawing.Bitmap bitmap = ToolMethod.RenderPageBitmapNoWait(PdfViewer.Document, (int)size.Width, (int)size.Height, 0, true, true);
+                        //        string folderPath = System.IO.Path.Combine(App.CurrentPath, "CoverImage");
+                        //        if (File.Exists(folderPath))
+                        //            File.Delete(folderPath);
+                        //        DirectoryInfo folder = new DirectoryInfo(folderPath);
+                        //        if (!folder.Exists)
+                        //            folder.Create();
+                        //        string imagePath = info.ThumbImgPath;
+                        //        if (!File.Exists(imagePath))//由加密文档变为非加密文档时 新建一个路径
+                        //        {
+                        //            string imageName = Guid.NewGuid().ToString();
+                        //            imagePath = System.IO.Path.Combine(folderPath, imageName);
+                        //            using (FileStream stream = new FileStream(imagePath, FileMode.Create))
+                        //            {
+                        //                bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
+                        //            }
+                        //        }
+                        //        else
+                        //        {
+                        //            using (FileStream stream = new FileStream(imagePath, FileMode.Open))
+                        //            {
+                        //                bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
+                        //            }
+                        //        }
+                        //        info.ThumbImgPath = imagePath;
+                        //        SettingHelper.SetFileInfo(info);
+                        //    }
+                        //}
+                        //catch
+                        //{
+                        //    info.ThumbImgPath = null;
+                        //    SettingHelper.SetFileInfo(info);
+                        //}
+                    });
+                }
+                else
+                {
+                    //文件被占用 保存失败时
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                    alertsMessage.ShowDialog("", "文件被占用,需要另存为", "Cancel", "OK");
+                    if (alertsMessage.result == ContentResult.Ok)
+                        return saveAsFile();
+                    else
+                        return false;
+                }
+
+                return result;
+            }
+            catch { return false; }
+        }
+
+        /// <summary>
+        /// 另存为或新文档保存逻辑
+        /// </summary>
+        private bool saveAsFile()
+        {
+            var dlg = new SaveFileDialog();
+            dlg.Filter = Properties.Resources.OpenDialogFilter;
+            dlg.FileName = PDFViewer.Document.FileName;
+            if (dlg.ShowDialog() == true && !string.IsNullOrEmpty(dlg.FileName))
+            {
+                bool result = false;
+                if (App.OpenedFileList.Contains(dlg.FileName))
+                {
+                    //提示文件已经被打开
+                }
+                else
+                {
+                    result = PDFViewer.Document.WriteToFilePath(dlg.FileName);
+                    if (result)
+                    {
+                        DoAfterSaveAs(dlg.FileName);
+                    }
+                    else
+                    {
+                        //提示文件被其他软件占用 无法保存
+                        //MessageBoxEx.Show(App.MainPageLoader.GetString("Main_TheFileOccupiedWarning"), "", Winform.MessageBoxButtons.OKCancel, new string[] { App.MainPageLoader.GetString("Main_SaveAs"), App.MainPageLoader.GetString("Main_Cancel") })
+                    }
+                      ;
+                }
+                return result;
+            }
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 另存为后进行的操作
+        /// 重新打开新文档
+        /// </summary>
+        /// <param name="targetPath"></param>
+        public void DoAfterSaveAs(string targetPath)
+        {
+            App.OpenedFileList.Remove(targetPath);
+            string oldFilePath = targetPath;
+
+            PDFViewer.UndoManager.CanSave = false;
+
+            mainViewModel.OpenFile(targetPath);
+            //TODO:通知各模块更新PDFview对象
+            //var result = OpenFile(targetPath, true);
+
+            //if (result)
+            //{
+            //    FileChanged.Invoke(this, null);
+            //    Zoomer.PdfViewer = PdfViewer;
+            //    PageSelector.PdfViewer = PdfViewer;
+            //    ViewModeSelector.PdfViewer = PdfViewer;
+
+            //    OpenFileInfo fileInfo = SettingHelper.GetFileInfo(oldFilePath);
+            //    if (fileInfo != null)
+            //    {
+            //        PdfViewer.ChangeViewMode(fileInfo.LastViewMode);
+            //        PdfViewer.ChangeFitMode(fileInfo.LastFitMode);
+            //        if (fileInfo.LastFitMode == FitMode.FitFree)
+            //            PdfViewer.Zoom(fileInfo.LastZoom);
+
+            //        PdfViewer.GoToPage(fileInfo.LastPageIndex);
+            //        if (fileInfo.LastDrawMode == DrawModes.Draw_Mode_Custom && fileInfo.LastFillColor != 0)
+            //            PdfViewer.SetDrawMode(fileInfo.LastDrawMode, fileInfo.LastFillColor);
+            //        else
+            //            PdfViewer.SetDrawMode(fileInfo.LastDrawMode);
+            //    }
+            //}
+        }
+
         /// <summary>
         /// 显示前添加内容到Region
         /// </summary>
@@ -341,8 +667,8 @@ namespace PDF_Office.ViewModels
                     }
                 }
                 //ToolContent的visible跟toolsbarContent 的visible是互斥的
-                ToolContentVisible = Visibility.Visible;
-                ToolsBarContentVisible = Visibility.Collapsed;
+                UpdateShowContent(currentBar);
+
             }
             else
             {
@@ -350,8 +676,7 @@ namespace PDF_Office.ViewModels
                 {
                     GridToolRow = 1;
                 }
-                ToolContentVisible = Visibility.Collapsed;
-                ToolsBarContentVisible = Visibility.Visible;
+                UpdateShowContent(currentBar);
             }
         }
 

+ 66 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterCSVDialog.xaml

@@ -0,0 +1,66 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.ConverterDialogs.ConverterCSVDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:pageeditdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.PageEditDialogs"
+             xmlns:prism="http://prismlibrary.com/"           
+             Width="529"
+             Height="416"
+             d:DataContext="{d:DesignInstance Type=pageeditdialogs:ExtractDialogViewModel}"
+             d:DesignHeight="416"
+             d:DesignWidth="529"
+             prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d">
+    <cus:DialogContent Header="PDF转CSV">
+        <cus:DialogContent.Content>
+            <Grid Grid.Row="1">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="212"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0">
+                    <cus:PageTurningPreview x:Name="ConverterPreview" Loaded="ConverterPreview_Loaded"></cus:PageTurningPreview>
+                </Grid>
+                <Grid Grid.Column="1">
+                    <StackPanel Margin="18,16,0,0">
+                        <StackPanel>
+                            <RadioButton Name="ForEachPageRadioBtn" Command="{Binding RadioButtonCommand}" CommandParameter="{Binding ElementName=ForEachPageRadioBtn,Path=Name}">
+                                <TextBlock Text="将每个页面转换为一个单独的文档"/>
+                            </RadioButton>
+                            <RadioButton Margin="0,6,0,0" Name="OnlyTableRadioBtn" Command="{Binding RadioButtonCommand}" CommandParameter="{Binding ElementName=ForTheDocRadioBtn,Path=Name}">
+                                <TextBlock Text="只提取表格"/>
+                            </RadioButton>
+                        </StackPanel>
+                        <StackPanel Orientation="Vertical" Margin="0,14,0,0">
+                            <TextBlock Text="页面范围" Height="20" Width="48" HorizontalAlignment="Left"/>
+                            <cus:WritableComboBox x:Name="PageRangeComboBox" Margin="0,4,0,0" Width="228" Height="28.55" HorizontalAlignment="Left" IsCurrentPage="True" Text="{Binding PageRangeText, Mode=TwoWay}"  SelectedIndex="{Binding PageRangeSelectIndex, Mode=TwoWay}" Loaded="PageRangeComboBox_Loaded">
+                            </cus:WritableComboBox>
+                        </StackPanel>
+                    </StackPanel>
+                </Grid>
+            </Grid>
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="0,0,124,0"
+                    HorizontalAlignment="Right"
+                    Content="取消" 
+                    Command="{Binding CancelCommand}"/>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Content="转换" 
+                    Command = "{Binding ConverterCommnad}"/>
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
+</UserControl>

+ 111 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterCSVDialog.xaml.cs

@@ -0,0 +1,111 @@
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.ViewModels.Dialog.ConverterDialogs;
+using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs;
+using System.Diagnostics;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.ConverterDialogs
+{
+    /// <summary>
+    /// Interaction logic for ConverterCSVDialog
+    /// </summary>
+    public partial class ConverterCSVDialog : UserControl
+    {
+        public ConverterCSVDialog()
+        {
+            InitializeComponent();
+        }
+        private void ConverterPreview_Loaded(object sender, System.Windows.RoutedEventArgs e)
+        {
+            ConverterPreview.document = ((ConverterCSVDialogViewModel)this.DataContext).currentViewer.Document;
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, "1-" + ConverterPreview.document.PageCount.ToString(), ConverterPreview.document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            ConverterPreview.PageIndex.Text = ConverterPreview.document.PageCount.ToString();
+        }
+        private void PageRangeComboBox_Loaded(object sender, RoutedEventArgs e)
+        {
+            PageRangeComboBox.CurrentPage = true;
+            if (PageRangeComboBox.CurrentPage)
+            {
+                ComboBoxItem comboBoxItem = new ComboBoxItem();
+                comboBoxItem.Content = "当前页面";
+                PageRangeComboBox.writableComboBox.Items.Insert(1, comboBoxItem);
+                
+            }
+            PageRangeComboBox.writableComboBox.SelectionChanged += PageRangeComboBox_SelectionChanged;
+            PageRangeComboBox.writableTextBox.TextChanged += WritableTextBox_TextChanged;
+        }
+
+        private void WritableTextBox_TextChanged(object sender, TextChangedEventArgs e)
+        {
+
+            string PageRangeSelectIndex = ((ConverterCSVDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterCSVDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText = ((ConverterCSVDialogViewModel)this.DataContext).PageRangeText;
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+           
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                ConverterPreview.PageIndexLists.Add(0);
+
+                return;
+            }
+            else {
+                ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+                ConverterPreview.CurrentIndex = 0;
+                ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+                ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            }
+            
+        }
+
+        private void PageRangeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) {
+            
+            string PageRangeSelectIndex = ((ConverterCSVDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterCSVDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText=((ConverterCSVDialogViewModel)this.DataContext).PageRangeText;
+            if (PageRangeSelectIndex == "0" || PageRangeSelectIndex == "2" || PageRangeSelectIndex == "3")
+            {
+                HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+                
+            }
+            if (PageRangeSelectIndex == "1") {
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex]+1).ToString(), currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+               ((ConverterCSVDialogViewModel)this.DataContext).CurrentPageIndex= (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            }
+            ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            ConverterPreview.CurrentIndex = 0;
+            ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+        }
+    }
+}

+ 87 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterExcelDialog.xaml

@@ -0,0 +1,87 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.ConverterDialogs.ConverterExcelDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:pageeditdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.PageEditDialogs"
+             xmlns:prism="http://prismlibrary.com/"           
+             Width="529"
+             Height="416"
+             d:DataContext="{d:DesignInstance Type=pageeditdialogs:ExtractDialogViewModel}"
+             d:DesignHeight="416"
+             d:DesignWidth="529"
+             prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d">
+    <cus:DialogContent Header="PDF转Excel">
+        <cus:DialogContent.Content>
+            <Grid Grid.Row="1">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="212"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0">
+                    <cus:PageTurningPreview x:Name="ConverterPreview" Loaded="ConverterPreview_Loaded"></cus:PageTurningPreview>
+                </Grid>
+                <Grid Grid.Column="1">
+                    <StackPanel Orientation="Vertical" Margin="18,16,0,0">
+                        <StackPanel Orientation="Vertical">
+                            <TextBlock Text="Excel工作簿设置:" Height="20"/>
+                            <StackPanel Orientation="Vertical" Margin="0,7,0,0">
+                                <RadioButton Name="ForEachPageRadioBtn" Command="{Binding RadioButtonCommand}" CommandParameter="{Binding ElementName=ForEachPageRadioBtn,Path=Name}">
+                                    <TextBlock Text="将每个页面转换为一个单独的工作表"/>
+                                </RadioButton>
+                                <RadioButton Margin="0,6,0,0" Name="ForTheDocRadioBtn" Command="{Binding RadioButtonCommand}" CommandParameter="{Binding ElementName=ForTheDocRadioBtn,Path=Name}">
+                                    <TextBlock Text="将所有页面转换为一个工作表格式"/>
+                                </RadioButton>
+                                <RadioButton Margin="0,10,0,0" Name="OnlyTableRadioBtn" Command="{Binding RadioButtonCommand}" CommandParameter="{Binding ElementName=OnlyTableRadioBtn,Path=Name}">
+                                    <TextBlock Text="只提取表格"/>
+                                </RadioButton>
+                                <ComboBox Name="OnlyTableComboBox" Margin="0,8,0,0" Width="258" Height="32" IsEnabled="{Binding ElementName=OnlyTableRadioBtn,Path=IsChecked}" SelectionChanged="OnlyTableComboBox_SelectionChanged">
+                                    <ComboBoxItem Content="支持一个表格提取到单独的工作表"/>
+                                    <ComboBoxItem Content="支持按页面提取表格到单独的工作表"/>
+                                    <ComboBoxItem Content="支持将所有表格提取到一个工作表"/>
+                                </ComboBox>
+                            </StackPanel>
+                        </StackPanel>
+                        <StackPanel Orientation="Vertical"  Margin="0,16,0,0">
+                            <StackPanel Orientation="Vertical">
+                                <TextBlock Text="文本识别设置:" HorizontalAlignment="Left" Width="84" Height="20"/>
+                                <CheckBox Name="OCRCheckBox"  Margin="0,5,0,0">
+                                    <TextBlock Text="在需要时识别文本"/>
+                                </CheckBox>
+                                <ComboBox IsEnabled="{Binding ElementName=OCRCheckBox,Path=IsChecked}"  Margin="0,6,0,0" Width="228" Height="28.55" HorizontalAlignment="Left">
+                                </ComboBox>
+                            </StackPanel>
+                            <StackPanel Orientation="Vertical" Margin="0,14,0,0">
+                                <TextBlock Text="页面范围" Height="20" Width="48" HorizontalAlignment="Left"/>
+                                <cus:WritableComboBox x:Name="PageRangeComboBox" Margin="0,4,0,0" Width="228" Height="28.55" HorizontalAlignment="Left" IsCurrentPage="True" Text="{Binding PageRangeText, Mode=TwoWay}"  SelectedIndex="{Binding PageRangeSelectIndex, Mode=TwoWay}" Loaded="PageRangeComboBox_Loaded">
+                                </cus:WritableComboBox>
+                            </StackPanel>
+                        </StackPanel>
+                    </StackPanel>
+                </Grid>
+            </Grid>
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="0,0,124,0"
+                    HorizontalAlignment="Right"
+                    Content="取消" 
+                    Command="{Binding CancelCommand}"/>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Content="转换" 
+                    Command = "{Binding ConverterCommnad}"/>
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
+</UserControl>

+ 131 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterExcelDialog.xaml.cs

@@ -0,0 +1,131 @@
+using ComPDFKit_Conversion.Options;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.ViewModels.Dialog.ConverterDialogs;
+using System.Diagnostics;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.ConverterDialogs
+{
+    /// <summary>
+    /// Interaction logic for ConverterExcelDialog
+    /// </summary>
+    public partial class ConverterExcelDialog : UserControl
+    {
+        public ConverterExcelDialog()
+        {
+            InitializeComponent();
+        }
+        private void ConverterPreview_Loaded(object sender, System.Windows.RoutedEventArgs e)
+        {
+            ConverterPreview.document = ((ConverterExcelDialogViewModel)this.DataContext).currentViewer.Document;
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, "1-" + ConverterPreview.document.PageCount.ToString(), ConverterPreview.document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            ConverterPreview.PageIndex.Text = ConverterPreview.document.PageCount.ToString();
+        }
+        private void PageRangeComboBox_Loaded(object sender, RoutedEventArgs e)
+        {
+            PageRangeComboBox.CurrentPage = true;
+            if (PageRangeComboBox.CurrentPage)
+            {
+                ComboBoxItem comboBoxItem = new ComboBoxItem();
+                comboBoxItem.Content = "当前页面";
+                PageRangeComboBox.writableComboBox.Items.Insert(1, comboBoxItem);
+
+            }
+            PageRangeComboBox.writableComboBox.SelectionChanged += PageRangeComboBox_SelectionChanged;
+            PageRangeComboBox.writableTextBox.TextChanged += WritableTextBox_TextChanged;
+        }
+
+        private void WritableTextBox_TextChanged(object sender, TextChangedEventArgs e)
+        {
+
+            string PageRangeSelectIndex = ((ConverterExcelDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterExcelDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText = ((ConverterExcelDialogViewModel)this.DataContext).PageRangeText;
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                ConverterPreview.PageIndexLists.Add(0);
+
+                return;
+            }
+            else
+            {
+                ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+                ConverterPreview.CurrentIndex = 0;
+                ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+                ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            }
+
+        }
+
+        private void PageRangeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+
+            string PageRangeSelectIndex = ((ConverterExcelDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterExcelDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText = ((ConverterExcelDialogViewModel)this.DataContext).PageRangeText;
+            if (PageRangeSelectIndex == "0" || PageRangeSelectIndex == "2" || PageRangeSelectIndex == "3")
+            {
+                HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+
+            }
+            if (PageRangeSelectIndex == "1")
+            {
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString(), currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+               ((ConverterExcelDialogViewModel)this.DataContext).CurrentPageIndex = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            }
+            ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            ConverterPreview.CurrentIndex = 0;
+            ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+        }
+
+        private void OnlyTableComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            switch (OnlyTableComboBox.SelectedIndex) { 
+                case 0:
+                    ((ConverterExcelDialogViewModel)this.DataContext).ConverterExcelModel.excelOption = ((ConverterExcelDialogViewModel)this.DataContext).ConverterExcelModel.ExcelOptions(WorksheetOptions.ForEachTable, ContentOptions.OnlyTable);
+                    break;
+                case 1:
+                    ((ConverterExcelDialogViewModel)this.DataContext).ConverterExcelModel.excelOption = ((ConverterExcelDialogViewModel)this.DataContext).ConverterExcelModel.ExcelOptions(WorksheetOptions.ForEachPage, ContentOptions.OnlyTable);
+                    break;
+                case 2:
+                    ((ConverterExcelDialogViewModel)this.DataContext).ConverterExcelModel.excelOption = ((ConverterExcelDialogViewModel)this.DataContext).ConverterExcelModel.ExcelOptions(WorksheetOptions.ForTheDocument, ContentOptions.OnlyTable);
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+}

+ 66 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterHTMLDialog.xaml

@@ -0,0 +1,66 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.ConverterDialogs.ConverterHTMLDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:pageeditdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.PageEditDialogs"
+             xmlns:prism="http://prismlibrary.com/"           
+             Width="480"
+             Height="416"
+             d:DataContext="{d:DesignInstance Type=pageeditdialogs:ExtractDialogViewModel}"
+             d:DesignHeight="416"
+             d:DesignWidth="480"
+             prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d">
+    <cus:DialogContent Header="PDF转HTML">
+        <cus:DialogContent.Content>
+            <Grid Grid.Row="1">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="212"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0">
+                    <cus:PageTurningPreview x:Name="ConverterPreview" Loaded="ConverterPreview_Loaded"></cus:PageTurningPreview>
+                </Grid>
+                <Grid Grid.Column="1">
+                    <StackPanel Orientation="Vertical"  Margin="18,16,0,0">
+                        <StackPanel Orientation="Vertical">
+                            <TextBlock Text="文本识别设置:" HorizontalAlignment="Left" Width="84" Height="20"/>
+                            <CheckBox Name="OCRCheckBox"  Margin="0,5,0,0">
+                                <TextBlock Text="在需要时识别文本"/>
+                            </CheckBox>
+                            <ComboBox IsEnabled="{Binding ElementName=OCRCheckBox,Path=IsChecked}"  Margin="0,6,0,0" Width="228" Height="28.55" HorizontalAlignment="Left">
+                            </ComboBox>
+                        </StackPanel>
+                        <StackPanel Orientation="Vertical" Margin="0,14,0,0">
+                            <TextBlock Text="页面范围" Height="20" Width="48" HorizontalAlignment="Left"/>
+                            <cus:WritableComboBox x:Name="PageRangeComboBox" Margin="0,4,0,0" Width="228" Height="28.55" HorizontalAlignment="Left" IsCurrentPage="True" Text="{Binding PageRangeText, Mode=TwoWay}"  SelectedIndex="{Binding PageRangeSelectIndex, Mode=TwoWay}" Loaded="PageRangeComboBox_Loaded">
+                            </cus:WritableComboBox>
+                        </StackPanel>
+                    </StackPanel>
+                </Grid>
+            </Grid>
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="0,0,124,0"
+                    HorizontalAlignment="Right"
+                    Content="取消" 
+                    Command="{Binding CancelCommand}"/>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Content="转换" 
+                    Command = "{Binding ConverterCommnad}"/>
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
+</UserControl>

+ 114 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterHTMLDialog.xaml.cs

@@ -0,0 +1,114 @@
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.ViewModels.Dialog.ConverterDialogs;
+using System.Diagnostics;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.ConverterDialogs
+{
+    /// <summary>
+    /// Interaction logic for ConverterHTMLDialog
+    /// </summary>
+    public partial class ConverterHTMLDialog : UserControl
+    {
+        public ConverterHTMLDialog()
+        {
+            InitializeComponent();
+        }
+        private void ConverterPreview_Loaded(object sender, System.Windows.RoutedEventArgs e)
+        {
+            ConverterPreview.document = ((ConverterHTMLDialogViewModel)this.DataContext).currentViewer.Document;
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, "1-" + ConverterPreview.document.PageCount.ToString(), ConverterPreview.document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            ConverterPreview.PageIndex.Text = ConverterPreview.document.PageCount.ToString();
+        }
+
+        private void PageRangeComboBox_Loaded(object sender, RoutedEventArgs e)
+        {
+            PageRangeComboBox.CurrentPage = true;
+            if (PageRangeComboBox.CurrentPage)
+            {
+                ComboBoxItem comboBoxItem = new ComboBoxItem();
+                comboBoxItem.Content = "当前页面";
+                PageRangeComboBox.writableComboBox.Items.Insert(1, comboBoxItem);
+
+            }
+            PageRangeComboBox.writableComboBox.SelectionChanged += PageRangeComboBox_SelectionChanged;
+            PageRangeComboBox.writableTextBox.TextChanged += WritableTextBox_TextChanged;
+        }
+
+        private void WritableTextBox_TextChanged(object sender, TextChangedEventArgs e)
+        {
+
+            string PageRangeSelectIndex = ((ConverterHTMLDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterHTMLDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText = ((ConverterHTMLDialogViewModel)this.DataContext).PageRangeText;
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                ConverterPreview.PageIndexLists.Add(0);
+
+                return;
+            }
+            else
+            {
+                ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+                ConverterPreview.CurrentIndex = 0;
+                ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+                ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            }
+
+        }
+
+        private void PageRangeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+
+            string PageRangeSelectIndex = ((ConverterHTMLDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterHTMLDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText = ((ConverterHTMLDialogViewModel)this.DataContext).PageRangeText;
+            if (PageRangeSelectIndex == "0" || PageRangeSelectIndex == "2" || PageRangeSelectIndex == "3")
+            {
+                HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+
+            }
+            if (PageRangeSelectIndex == "1")
+            {
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString(), currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+               ((ConverterHTMLDialogViewModel)this.DataContext).CurrentPageIndex = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            }
+            ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            ConverterPreview.CurrentIndex = 0;
+            ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+        }
+    }
+}

+ 63 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterImgDialog.xaml

@@ -0,0 +1,63 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.ConverterDialogs.ConverterImgDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:pageeditdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.PageEditDialogs"
+             xmlns:prism="http://prismlibrary.com/"           
+             Width="480"
+             Height="416"
+             d:DataContext="{d:DesignInstance Type=pageeditdialogs:ExtractDialogViewModel}"
+             d:DesignHeight="416"
+             d:DesignWidth="480"
+             prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d">
+    <cus:DialogContent Header="PDF转图片">
+        <cus:DialogContent.Content>
+            <Grid Grid.Row="1">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="212"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0">
+                    <cus:PageTurningPreview x:Name="ConverterPreview" Loaded="ConverterPreview_Loaded"></cus:PageTurningPreview>
+                </Grid>
+                <Grid Grid.Column="1">
+                    <StackPanel Margin="18,16,0,0">
+                        <StackPanel>
+                            <TextBlock Text="文件类型" Height="20" Width="48" HorizontalAlignment="Left" />
+                            <ComboBox Name="ImageTypeComboBox" Height="32" Width="228" HorizontalAlignment="Left" Margin="0,8,0,0" ItemsSource="{Binding ImageTypeFamily}" SelectedIndex="0" SelectionChanged="ImageTypeComboBox_SelectionChanged"></ComboBox>
+                            <ComboBox Name="ImageDPIComboBox" Height="32" Width="228" HorizontalAlignment="Left" Margin="0,8,0,0" ItemsSource="{Binding ImageDPIFamily}" SelectedIndex="0" SelectionChanged="ImageDPIComboBox_SelectionChanged"></ComboBox>
+                        </StackPanel>
+                        <StackPanel Margin="0,16,0,0">
+                            <TextBlock Text="页面范围" Height="20" Width="48" HorizontalAlignment="Left"/>
+                            <cus:WritableComboBox x:Name="PageRangeComboBox" Margin="0,4,0,0" Width="228" Height="32" HorizontalAlignment="Left" IsCurrentPage="True" Text="{Binding PageRangeText, Mode=TwoWay}"  SelectedIndex="{Binding PageRangeSelectIndex, Mode=TwoWay}" Loaded="PageRangeComboBox_Loaded">
+                            </cus:WritableComboBox>
+                        </StackPanel>
+                    </StackPanel>
+                </Grid>
+            </Grid> 
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="0,0,124,0"
+                    HorizontalAlignment="Right"
+                    Content="取消" 
+                    Command="{Binding CancelCommand}"/>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Content="转换" 
+                    Command = "{Binding ConverterCommnad}"/>
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
+</UserControl>

+ 174 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterImgDialog.xaml.cs

@@ -0,0 +1,174 @@
+using ComPDFKit_Conversion.Converter;
+using ComPDFKit_Conversion.Options;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.ViewModels.Dialog.ConverterDialogs;
+using System.Diagnostics;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.ConverterDialogs
+{
+    /// <summary>
+    /// Interaction logic for ConverterImgDialog
+    /// </summary>
+    public partial class ConverterImgDialog : UserControl
+    {
+        public ConverterImgDialog()
+        {
+            InitializeComponent();
+        }
+        private void ConverterPreview_Loaded(object sender, System.Windows.RoutedEventArgs e)
+        {
+            ConverterPreview.document = ((ConverterImgDialogViewModel)this.DataContext).currentViewer.Document;
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, "1-" + ConverterPreview.document.PageCount.ToString(), ConverterPreview.document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            ConverterPreview.PageIndex.Text = ConverterPreview.document.PageCount.ToString();
+        }
+        private void PageRangeComboBox_Loaded(object sender, RoutedEventArgs e)
+        {
+            PageRangeComboBox.CurrentPage = true;
+            if (PageRangeComboBox.CurrentPage)
+            {
+                ComboBoxItem comboBoxItem = new ComboBoxItem();
+                comboBoxItem.Content = "当前页面";
+                PageRangeComboBox.writableComboBox.Items.Insert(1, comboBoxItem);
+
+            }
+            PageRangeComboBox.writableComboBox.SelectionChanged += PageRangeComboBox_SelectionChanged;
+            PageRangeComboBox.writableTextBox.TextChanged += WritableTextBox_TextChanged;
+        }
+
+        private void WritableTextBox_TextChanged(object sender, TextChangedEventArgs e)
+        {
+
+            string PageRangeSelectIndex = ((ConverterImgDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterImgDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText = ((ConverterImgDialogViewModel)this.DataContext).PageRangeText;
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                ConverterPreview.PageIndexLists.Add(0);
+
+                return;
+            }
+            else
+            {
+                ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+                ConverterPreview.CurrentIndex = 0;
+                ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+                ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            }
+
+        }
+
+        private void PageRangeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+
+            string PageRangeSelectIndex = ((ConverterImgDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterImgDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText = ((ConverterImgDialogViewModel)this.DataContext).PageRangeText;
+            if (PageRangeSelectIndex == "0" || PageRangeSelectIndex == "2" || PageRangeSelectIndex == "3")
+            {
+                HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+
+            }
+            if (PageRangeSelectIndex == "1")
+            {
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString(), currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+               ((ConverterImgDialogViewModel)this.DataContext).CurrentPageIndex = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            }
+            ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            ConverterPreview.CurrentIndex = 0;
+            ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+        }
+
+        private void ImageTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            switch (ImageTypeComboBox.SelectedIndex)
+            {
+                case 0:
+                    ((ConverterImgDialogViewModel)this.DataContext).ConverterImgModel.Type = ImgType.JPEG;
+                    break;
+                case 1:
+                    ((ConverterImgDialogViewModel)this.DataContext).ConverterImgModel.Type = ImgType.JPEG;
+                    break;
+                case 2:
+                    ((ConverterImgDialogViewModel)this.DataContext).ConverterImgModel.Type = ImgType.PNG;
+                    break;
+                case 3:
+                    ((ConverterImgDialogViewModel)this.DataContext).ConverterImgModel.Type = ImgType.JPEG;
+                    break;
+                case 4:
+                    ((ConverterImgDialogViewModel)this.DataContext).ConverterImgModel.Type = ImgType.JPEG;
+                    break;
+                case 5:
+                    ((ConverterImgDialogViewModel)this.DataContext).ConverterImgModel.Type = ImgType.JPEG;
+                    break;
+                case 6:
+                    ((ConverterImgDialogViewModel)this.DataContext).ConverterImgModel.Type = ImgType.JPEG;
+                    break;
+                case 7:
+                    ((ConverterImgDialogViewModel)this.DataContext).ConverterImgModel.Type = ImgType.JPEG;
+                    break;
+                default:
+                    break;
+            }
+        }
+        private void ImageDPIComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            switch (ImageDPIComboBox.SelectedIndex)
+            {
+                case 0:
+                    Trace.WriteLine("50");
+                    break;
+                case 1:
+                    Trace.WriteLine("72");
+                    break;
+                case 2:
+                    Trace.WriteLine("96");
+                    break;
+                case 3:
+                    Trace.WriteLine("150");
+                    break;
+                case 4:
+                    Trace.WriteLine("300");
+                    break;
+                case 5:
+                    Trace.WriteLine("600");
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+}

+ 66 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterPPTDialog.xaml

@@ -0,0 +1,66 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.ConverterDialogs.ConverterPPTDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:pageeditdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.PageEditDialogs"
+             xmlns:prism="http://prismlibrary.com/"           
+             Width="480"
+             Height="416"
+             d:DataContext="{d:DesignInstance Type=pageeditdialogs:ExtractDialogViewModel}"
+             d:DesignHeight="416"
+             d:DesignWidth="480"
+             prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d">
+    <cus:DialogContent Header="PDF转PPT">
+        <cus:DialogContent.Content>
+            <Grid Grid.Row="1">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="212"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0">
+                    <cus:PageTurningPreview x:Name="ConverterPreview" Loaded="ConverterPreview_Loaded"></cus:PageTurningPreview>
+                </Grid>
+                <Grid Grid.Column="1">
+                    <StackPanel Orientation="Vertical"  Margin="18,16,0,0">
+                        <StackPanel Orientation="Vertical">
+                            <TextBlock Text="文本识别设置:" HorizontalAlignment="Left" Width="84" Height="20"/>
+                            <CheckBox Name="OCRCheckBox"  Margin="0,5,0,0">
+                                <TextBlock Text="在需要时识别文本"/>
+                            </CheckBox>
+                            <ComboBox IsEnabled="{Binding ElementName=OCRCheckBox,Path=IsChecked}"  Margin="0,6,0,0" Width="228" Height="28.55" HorizontalAlignment="Left">
+                            </ComboBox>
+                        </StackPanel>
+                        <StackPanel Orientation="Vertical" Margin="0,14,0,0">
+                            <TextBlock Text="页面范围" Height="20" Width="48" HorizontalAlignment="Left"/>
+                            <cus:WritableComboBox x:Name="PageRangeComboBox" Margin="0,4,0,0" Width="228" Height="28.55" HorizontalAlignment="Left" IsCurrentPage="True" Text="{Binding PageRangeText, Mode=TwoWay}"  SelectedIndex="{Binding PageRangeSelectIndex, Mode=TwoWay}" Loaded="PageRangeComboBox_Loaded">
+                            </cus:WritableComboBox>
+                        </StackPanel>
+                    </StackPanel>
+                </Grid>
+            </Grid>
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="0,0,124,0"
+                    HorizontalAlignment="Right"
+                    Content="取消" 
+                    Command="{Binding CancelCommand}"/>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Content="转换" 
+                    Command = "{Binding ConverterCommnad}"/>
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
+</UserControl>

+ 114 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterPPTDialog.xaml.cs

@@ -0,0 +1,114 @@
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.ViewModels.Dialog.ConverterDialogs;
+using System.Diagnostics;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.ConverterDialogs
+{
+    /// <summary>
+    /// Interaction logic for ConverterPPT
+    /// </summary>
+    public partial class ConverterPPTDialog : UserControl
+    {
+        public ConverterPPTDialog()
+        {
+            InitializeComponent();
+        }
+        private void ConverterPreview_Loaded(object sender, System.Windows.RoutedEventArgs e)
+        {
+            ConverterPreview.document = ((ConverterPPTDialogViewModel)this.DataContext).currentViewer.Document;
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, "1-" + ConverterPreview.document.PageCount.ToString(), ConverterPreview.document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            ConverterPreview.PageIndex.Text = ConverterPreview.document.PageCount.ToString();
+        }
+
+        private void PageRangeComboBox_Loaded(object sender, RoutedEventArgs e)
+        {
+            PageRangeComboBox.CurrentPage = true;
+            if (PageRangeComboBox.CurrentPage)
+            {
+                ComboBoxItem comboBoxItem = new ComboBoxItem();
+                comboBoxItem.Content = "当前页面";
+                PageRangeComboBox.writableComboBox.Items.Insert(1, comboBoxItem);
+
+            }
+            PageRangeComboBox.writableComboBox.SelectionChanged += PageRangeComboBox_SelectionChanged;
+            PageRangeComboBox.writableTextBox.TextChanged += WritableTextBox_TextChanged;
+        }
+
+        private void WritableTextBox_TextChanged(object sender, TextChangedEventArgs e)
+        {
+
+            string PageRangeSelectIndex = ((ConverterPPTDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterPPTDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText = ((ConverterPPTDialogViewModel)this.DataContext).PageRangeText;
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                ConverterPreview.PageIndexLists.Add(0);
+
+                return;
+            }
+            else
+            {
+                ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+                ConverterPreview.CurrentIndex = 0;
+                ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+                ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            }
+
+        }
+
+        private void PageRangeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+
+            string PageRangeSelectIndex = ((ConverterPPTDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterPPTDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText = ((ConverterPPTDialogViewModel)this.DataContext).PageRangeText;
+            if (PageRangeSelectIndex == "0" || PageRangeSelectIndex == "2" || PageRangeSelectIndex == "3")
+            {
+                HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+
+            }
+            if (PageRangeSelectIndex == "1")
+            {
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString(), currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+               ((ConverterPPTDialogViewModel)this.DataContext).CurrentPageIndex = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            }
+            ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            ConverterPreview.CurrentIndex = 0;
+            ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+        }
+    }
+}

+ 19 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterProgressBarDialog.xaml

@@ -0,0 +1,19 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.ConverterDialogs.ConverterProgressBarDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             d:DesignHeight="40"
+             d:DesignWidth="220"
+             mc:Ignorable="d">
+    <Grid Height="40" Width="220">
+        <StackPanel>
+            <StackPanel Orientation="Horizontal" Margin="13,5,0,10">
+                <TextBlock Text="Converte  .  .  . "></TextBlock>
+            </StackPanel>
+            <ProgressBar Minimum="0" Maximum="{Binding PageNumber}" Value="{Binding PageIndex}"  Height="4" Width="194"/>
+        </StackPanel>
+    </Grid>
+</UserControl>

+ 15 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterProgressBarDialog.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.ConverterDialogs
+{
+    /// <summary>
+    /// Interaction logic for ConverterProgressBarDialog
+    /// </summary>
+    public partial class ConverterProgressBarDialog : UserControl
+    {
+        public ConverterProgressBarDialog()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 66 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterRTFDialog.xaml

@@ -0,0 +1,66 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.ConverterDialogs.ConverterRTFDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:pageeditdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.PageEditDialogs"
+             xmlns:prism="http://prismlibrary.com/"           
+             Width="480"
+             Height="416"
+             d:DataContext="{d:DesignInstance Type=pageeditdialogs:ExtractDialogViewModel}"
+             d:DesignHeight="416"
+             d:DesignWidth="480"
+             prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d">
+    <cus:DialogContent Header="PDF转RTF">
+        <cus:DialogContent.Content>
+            <Grid Grid.Row="1">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="212"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0" >
+                    <cus:PageTurningPreview x:Name="ConverterPreview" Loaded="ConverterPreview_Loaded"></cus:PageTurningPreview>
+                </Grid>
+                <Grid Grid.Column="1">
+                    <StackPanel Orientation="Vertical"  Margin="18,16,0,0">
+                        <StackPanel Orientation="Vertical">
+                            <TextBlock Text="文本识别设置:" HorizontalAlignment="Left" Width="84" Height="20"/>
+                            <CheckBox Name="OCRCheckBox"  Margin="0,5,0,0">
+                                <TextBlock Text="在需要时识别文本"/>
+                            </CheckBox>
+                            <ComboBox IsEnabled="{Binding ElementName=OCRCheckBox,Path=IsChecked}"  Margin="0,6,0,0" Width="228" Height="28.55" HorizontalAlignment="Left">
+                            </ComboBox>
+                        </StackPanel>
+                        <StackPanel Orientation="Vertical" Margin="0,14,0,0">
+                            <TextBlock Text="页面范围" Height="20" Width="48" HorizontalAlignment="Left"/>
+                            <cus:WritableComboBox x:Name="PageRangeComboBox" Margin="0,4,0,0" Width="228" Height="28.55" HorizontalAlignment="Left" IsCurrentPage="True" Text="{Binding PageRangeText, Mode=TwoWay}"  SelectedIndex="{Binding PageRangeSelectIndex, Mode=TwoWay}" Loaded="PageRangeComboBox_Loaded">
+                            </cus:WritableComboBox>
+                        </StackPanel>
+                    </StackPanel>
+                </Grid>
+            </Grid>
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="0,0,124,0"
+                    HorizontalAlignment="Right"
+                    Content="取消" 
+                    Command="{Binding CancelCommand}"/>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Content="转换" 
+                    Command = "{Binding ConverterCommnad}"/>
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
+</UserControl>

+ 113 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterRTFDialog.xaml.cs

@@ -0,0 +1,113 @@
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.ViewModels.Dialog.ConverterDialogs;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.ConverterDialogs
+{
+    /// <summary>
+    /// Interaction logic for ConverterRTFDialog
+    /// </summary>
+    public partial class ConverterRTFDialog : UserControl
+    {
+        public ConverterRTFDialog()
+        {
+            InitializeComponent();
+        }
+        private void ConverterPreview_Loaded(object sender, System.Windows.RoutedEventArgs e)
+        {
+            ConverterPreview.document = ((ConverterRTFDialogViewModel)this.DataContext).currentViewer.Document;
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, "1-" + ConverterPreview.document.PageCount.ToString(), ConverterPreview.document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            ConverterPreview.PageIndex.Text = ConverterPreview.document.PageCount.ToString();
+        }
+
+        private void PageRangeComboBox_Loaded(object sender, RoutedEventArgs e)
+        {
+            PageRangeComboBox.CurrentPage = true;
+            if (PageRangeComboBox.CurrentPage)
+            {
+                ComboBoxItem comboBoxItem = new ComboBoxItem();
+                comboBoxItem.Content = "当前页面";
+                PageRangeComboBox.writableComboBox.Items.Insert(1, comboBoxItem);
+
+            }
+            PageRangeComboBox.writableComboBox.SelectionChanged += PageRangeComboBox_SelectionChanged;
+            PageRangeComboBox.writableTextBox.TextChanged += WritableTextBox_TextChanged;
+        }
+
+        private void WritableTextBox_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            
+            string PageRangeSelectIndex = ((ConverterRTFDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterRTFDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText = ((ConverterRTFDialogViewModel)this.DataContext).PageRangeText;
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                ConverterPreview.PageIndexLists.Add(0);
+                return;
+            }
+            else
+            {
+                ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+                ConverterPreview.CurrentIndex = 0;
+                ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+                ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+            }
+
+        }
+
+        private void PageRangeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+
+            string PageRangeSelectIndex = ((ConverterRTFDialogViewModel)this.DataContext).PageRangeSelectIndex;
+            var currentViewer = ((ConverterRTFDialogViewModel)this.DataContext).currentViewer;
+            string PageRange = "";
+            var PageRangeText = ((ConverterRTFDialogViewModel)this.DataContext).PageRangeText;
+            if (PageRangeSelectIndex == "0" || PageRangeSelectIndex == "2" || PageRangeSelectIndex == "3")
+            {
+                HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref PageRange, PageRangeText, true);
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+
+            }
+            if (PageRangeSelectIndex == "1")
+            {
+                char[] enumerationSeparator = new char[] { ',' };
+                char[] rangeSeparator = new char[] { '-' };
+                if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString(), currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+                { //TODO
+                    Trace.WriteLine("输入不对");
+                    MessageBoxEx.Show("输入不对");
+                    return;
+                }
+               ((ConverterRTFDialogViewModel)this.DataContext).CurrentPageIndex = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            }
+            ConverterPreview.PageIndex.Text = (ConverterPreview.PageIndexLists.Last<int>() + 1).ToString();
+            ConverterPreview.CurrentIndex = 0;
+            ConverterPreview.CurrentPage.Text = (ConverterPreview.PageIndexLists[ConverterPreview.CurrentIndex] + 1).ToString();
+            ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
+        }
+    }
+}

+ 66 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterTextDialog.xaml

@@ -0,0 +1,66 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.ConverterDialogs.ConverterTextDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:pageeditdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.PageEditDialogs"
+             xmlns:prism="http://prismlibrary.com/"           
+             Width="480"
+             Height="416"
+             d:DataContext="{d:DesignInstance Type=pageeditdialogs:ExtractDialogViewModel}"
+             d:DesignHeight="416"
+             d:DesignWidth="480"
+             prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d">
+    <cus:DialogContent Header="PDF转Text">
+        <cus:DialogContent.Content>
+            <Grid Grid.Row="1">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="212"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0">
+                    <cus:PageTurningPreview x:Name="ConverterPreview" Loaded="ConverterPreview_Loaded"></cus:PageTurningPreview>
+                </Grid>
+                <Grid Grid.Column="1">
+                    <StackPanel Orientation="Vertical"  Margin="18,16,0,0">
+                        <StackPanel Orientation="Vertical">
+                            <TextBlock Text="文本识别设置:" HorizontalAlignment="Left" Width="84" Height="20"/>
+                            <CheckBox Name="OCRCheckBox"  Margin="0,5,0,0">
+                                <TextBlock Text="在需要时识别文本"/>
+                            </CheckBox>
+                            <ComboBox IsEnabled="{Binding ElementName=OCRCheckBox,Path=IsChecked}"  Margin="0,6,0,0" Width="228" Height="28.55" HorizontalAlignment="Left">
+                            </ComboBox>
+                        </StackPanel>
+                        <StackPanel Orientation="Vertical" Margin="0,14,0,0">
+                            <TextBlock Text="页面范围" Height="20" Width="48" HorizontalAlignment="Left"/>
+                            <cus:WritableComboBox x:Name="PageRangeComboBox" Margin="0,4,0,0" Width="228" Height="28.55" HorizontalAlignment="Left" IsCurrentPage="True" Text="{Binding PageRangeText, Mode=TwoWay}"  SelectedIndex="{Binding PageRangeSelectIndex, Mode=TwoWay}" Loaded="PageRangeComboBox_Loaded">
+                            </cus:WritableComboBox>
+                        </StackPanel>
+                    </StackPanel>
+                </Grid>
+            </Grid>
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="0,0,124,0"
+                    HorizontalAlignment="Right"
+                    Content="取消" 
+                    Command="{Binding CancelCommand}"/>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Content="转换" 
+                    Command = "{Binding ConverterCommnad}"/>
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
+</UserControl>

+ 0 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterTextDialog.xaml.cs


Some files were not shown because too many files changed in this diff