Browse Source

背景水印UI-整理代码

liyijie 2 years ago
parent
commit
6661a93091
37 changed files with 814 additions and 537 deletions
  1. 4 0
      PDF Office/App.xaml.cs
  2. 4 0
      PDF Office/EventAggregators/EditToolsEvent.cs
  3. 8 8
      PDF Office/PDF Office.csproj
  4. 14 8
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterCSVDialogViewModel.cs
  5. 14 10
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterExcelDialogViewModel.cs
  6. 13 7
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterHTMLDialogViewModel.cs
  7. 15 7
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterImgDialogViewModel.cs
  8. 14 7
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterPPTDialogViewModel.cs
  9. 11 5
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterProgressBarDialogViewModel.cs
  10. 14 8
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterRTFDialogViewModel.cs
  11. 15 7
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterTextDialogViewModel.cs
  12. 14 8
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterWordDialogViewModel.cs
  13. 10 2
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBatchProcessingDialogViewModel.cs
  14. 11 2
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageCompressDialogViewModel.cs
  15. 6 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterCSVViewModel.cs
  16. 15 2
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterDialogViewModel.cs
  17. 10 2
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterExcelViewModel.cs
  18. 4 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterImgViewModel.cs
  19. 83 73
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageSetPasswordDialogViewModel.cs
  20. 5 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogViewModel.cs
  21. 0 16
      PDF Office/ViewModels/EditTools/Background/BackgroundBarContentViewModel.cs
  22. 28 0
      PDF Office/ViewModels/EditTools/Background/BackgroundContentViewModel.cs
  23. 0 16
      PDF Office/ViewModels/EditTools/Background/BackgroundTemplateContentViewModel.cs
  24. 28 0
      PDF Office/ViewModels/EditTools/Watermark/WatermarkContentViewModel.cs
  25. 2 2
      PDF Office/ViewModels/HomePanel/HomeGuidContentViewModel.cs
  26. 11 4
      PDF Office/ViewModels/Tools/ToolsBarContentViewModel.cs
  27. 47 21
      PDF Office/ViewModels/ViewContentViewModel.cs
  28. 1 1
      PDF Office/Views/Dialog/ConverterDialogs/ConverterExcelDialog.xaml
  29. 0 56
      PDF Office/Views/EditTools/Background/BackgroundBarContent.xaml
  30. 93 0
      PDF Office/Views/EditTools/Background/BackgroundContent.xaml
  31. 2 2
      PDF Office/Views/EditTools/Background/BackgroundBarContent.xaml.cs
  32. 0 31
      PDF Office/Views/EditTools/Background/BackgroundTemplateContent.xaml
  33. 0 15
      PDF Office/Views/EditTools/Background/BackgroundTemplateContent.xaml.cs
  34. 92 0
      PDF Office/Views/EditTools/Watermark/WatermarkContent.xaml
  35. 15 0
      PDF Office/Views/EditTools/Watermark/WatermarkContent.xaml.cs
  36. 153 153
      PDF Office/Views/Tools/ToolsBarContent.xaml
  37. 58 64
      PDF Office/Views/ViewContent.xaml

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

@@ -33,6 +33,8 @@ using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
 using PDF_Office.Views.Dialog.ConverterDialogs;
 using PDF_Office.Helper;
 using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageConverter;
+using PDF_Office.Views.EditTools.Watermark;
+using PDF_Office.Views.EditTools.Background;
 
 namespace PDF_Office
 {
@@ -116,6 +118,8 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<HomePageConverterImg>();
             containerRegistry.RegisterForNavigation<HomePageConverterWord>();
             containerRegistry.RegisterForNavigation<HomePageConverterExcel>();
+            containerRegistry.RegisterForNavigation<WatermarkContent>();
+            containerRegistry.RegisterForNavigation<BackgroundContent>();
 
             //注册弹窗
             containerRegistry.RegisterDialog<VerifyPassWordDialog>(DialogNames.VerifyPassWordDialog);

+ 4 - 0
PDF Office/EventAggregators/EditToolsEvent.cs

@@ -10,4 +10,8 @@ namespace PDF_Office.EventAggregators
     public class EditToolsEvent:PubSubEvent<string>
     {
     }
+
+    public class CloseEditToolEvent : PubSubEvent
+    {
+    }
 }

+ 8 - 8
PDF Office/PDF Office.csproj

@@ -274,8 +274,7 @@
       <DesignTime>True</DesignTime>
       <AutoGen>True</AutoGen>
     </Compile>
-    <Compile Include="ViewModels\EditTools\Background\BackgroundBarContentViewModel.cs" />
-    <Compile Include="ViewModels\EditTools\Background\BackgroundTemplateContentViewModel.cs" />
+    <Compile Include="ViewModels\EditTools\Background\BackgroundContentViewModel.cs" />
     <Compile Include="ViewModels\BOTA\BOTAContentViewModel.cs" />
     <Compile Include="ViewModels\BottomToolContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ConverterDialogs\ConverterProgressBarDialogViewModel.cs" />
@@ -331,6 +330,7 @@
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageInsertDialogViewModel.cs" />
     <Compile Include="ViewModels\PageEdit\PageEditContentViewModel.cs" />
     <Compile Include="ViewModels\Tools\ToolsBarContentViewModel.cs" />
+    <Compile Include="ViewModels\EditTools\Watermark\WatermarkContentViewModel.cs" />
     <Compile Include="Views\BOTA\BOTAContent.xaml.cs">
       <DependentUpon>BOTAContent.xaml</DependentUpon>
     </Compile>
@@ -448,11 +448,11 @@
     <Compile Include="Views\Dialog\VerifyPassWordDialog.xaml.cs">
       <DependentUpon>VerifyPassWordDialog.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\EditTools\Background\BackgroundBarContent.xaml.cs">
-      <DependentUpon>BackgroundBarContent.xaml</DependentUpon>
+    <Compile Include="Views\EditTools\Background\BackgroundContent.xaml.cs">
+      <DependentUpon>BackgroundContent.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\EditTools\Background\BackgroundTemplateContent.xaml.cs">
-      <DependentUpon>BackgroundTemplateContent.xaml</DependentUpon>
+    <Compile Include="Views\EditTools\Watermark\WatermarkContent.xaml.cs">
+      <DependentUpon>WatermarkContent.xaml</DependentUpon>
     </Compile>
     <Compile Include="Views\HomePanel\CloudDrive\CloudDriveContent.xaml.cs">
       <DependentUpon>CloudDriveContent.xaml</DependentUpon>
@@ -729,11 +729,11 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Views\EditTools\Background\BackgroundBarContent.xaml">
+    <Page Include="Views\EditTools\Background\BackgroundContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Views\EditTools\Background\BackgroundTemplateContent.xaml">
+    <Page Include="Views\EditTools\Watermark\WatermarkContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>

+ 14 - 8
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterCSVDialogViewModel.cs

@@ -24,6 +24,11 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 {
     public class ConverterCSVDialogViewModel : BindableBase,IDialogAware
     {
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        #region 参数和属性
         public ConverterCSVDialogModel ConverterCSVModel = new ConverterCSVDialogModel();
 
         public CPDFViewer currentViewer;
@@ -35,12 +40,16 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
         public string PageRangeText { set; get; } = "0";
 
         public string PageRangeSelectIndex { set; get; } = "0";
+        #endregion
 
+        #region 委托声明
         public DelegateCommand<string> RadioButtonCommand { get; set; }
 
         public DelegateCommand CancelCommand { get; set; }
 
         public DelegateCommand ConverterCommnad { get; set; }
+        #endregion
+
         public ConverterCSVDialogViewModel(IDialogService dialogService)
         {
             CancelCommand = new DelegateCommand(cancel);
@@ -48,6 +57,8 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
             RadioButtonCommand = new DelegateCommand<string>(radiobutton);
             dialogs = dialogService;
         }
+
+        #region 逻辑函数
         private void cancel()
         {
             RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
@@ -97,15 +108,9 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
             }
 
         }
+        #endregion
 
-        private void SetProgress(int pageIndex)
-        {
-
-        }
-        public string Title=>"";
-
-        public event Action<IDialogResult> RequestClose;
-
+        #region 构架行为
         public bool CanCloseDialog()
         {
             return true;
@@ -127,5 +132,6 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 ConverterCSVModel.OutputPath = fileinfo.DirectoryName;
             }
         }
+        #endregion
     }
 }

+ 14 - 10
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterExcelDialogViewModel.cs

@@ -19,25 +19,33 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 {
     public class ConverterExcelDialogViewModel : BindableBase, IDialogAware
     {
+
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        #region 参数和属性
         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";
+        #endregion
 
-
+        #region 委托声明
         public DelegateCommand<string> RadioButtonCommand { get; set; }
 
         public DelegateCommand CancelCommand { get; set; }
 
         public DelegateCommand ConverterCommnad { get; set; }
+        #endregion
+
         public ConverterExcelDialogViewModel(IDialogService dialogService)
         {
             CancelCommand = new DelegateCommand(cancel);
@@ -45,6 +53,7 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
             RadioButtonCommand = new DelegateCommand<string>(radiobutton);
             dialogs = dialogService;
         }
+        #region 逻辑函数
         private void cancel()
         {
             RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
@@ -101,15 +110,9 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
             }
         
         }
+        #endregion
 
-
-        private void SetProgress(int pageIndex)
-        {
-
-        }
-        public string Title => "";
-
-        public event Action<IDialogResult> RequestClose;
+        #region 构架行为
 
         public bool CanCloseDialog()
         {
@@ -132,5 +135,6 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 ConverterExcelModel.OutputPath = fileinfo.DirectoryName;
             }
         }
+        #endregion
     }
 }

+ 13 - 7
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterHTMLDialogViewModel.cs

@@ -19,6 +19,11 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
     public class ConverterHTMLDialogViewModel : BindableBase, IDialogAware
     {
 
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        #region 参数和属性
         public ConverterHTMLDialogModel ConverterHTMLModel = new ConverterHTMLDialogModel();
 
         public CPDFViewer currentViewer;
@@ -30,10 +35,14 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
         public string PageRangeText { set; get; } = "0";
 
         public string PageRangeSelectIndex { set; get; } = "0";
+        #endregion
 
+        #region 委托声明
         public DelegateCommand CancelCommand { get; set; }
 
         public DelegateCommand ConverterCommnad { get; set; }
+        #endregion
+
         public ConverterHTMLDialogViewModel(IDialogService dialogService)
         {
             CancelCommand = new DelegateCommand(cancel);
@@ -41,6 +50,7 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
             dialogs = dialogService;
 
         }
+        #region 逻辑函数
         private void cancel()
         {
             RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
@@ -74,14 +84,9 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 
             });
         }
+        #endregion
 
-        private void SetProgress(int pageIndex)
-        {
-
-        }
-        public string Title => "";
-
-        public event Action<IDialogResult> RequestClose;
+        #region 构架行为
 
         public bool CanCloseDialog()
         {
@@ -104,5 +109,6 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 ConverterHTMLModel.OutputPath = fileinfo.DirectoryName;
             }
         }
+        #endregion
     }
 }

+ 15 - 7
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterImgDialogViewModel.cs

@@ -18,6 +18,12 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 {
     public class ConverterImgDialogViewModel : BindableBase, IDialogAware
     {
+
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        #region 参数和属性
         public ConverterImgDialogModel ConverterImgModel = new ConverterImgDialogModel();
 
         public CPDFViewer currentViewer;
@@ -54,16 +60,22 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
             this.ImageDPIFamily.Add("300 dpi");
             this.ImageDPIFamily.Add("600 dpi");
         }
+        #endregion
 
+        #region 委托声明
         public DelegateCommand CancelCommand { get; set; }
 
         public DelegateCommand ConverterCommnad { get; set; }
+        #endregion
+
         public ConverterImgDialogViewModel(IDialogService dialogService)
         {
             CancelCommand = new DelegateCommand(cancel);
             ConverterCommnad = new DelegateCommand(converter);
             dialogs = dialogService;
         }
+
+        #region 逻辑函数
         private void cancel()
         {
             RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
@@ -95,14 +107,9 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 
             });
         }
+        #endregion
 
-        private void SetProgress(int pageIndex)
-        {
-
-        }
-        public string Title => "";
-
-        public event Action<IDialogResult> RequestClose;
+        #region 构架行为
 
         public bool CanCloseDialog()
         {
@@ -127,5 +134,6 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 SetImageDPIOrigin();
             }
         }
+        #endregion
     }
 }

+ 14 - 7
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterPPTDialogViewModel.cs

@@ -19,6 +19,11 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
     public class ConverterPPTDialogViewModel : BindableBase, IDialogAware
     {
 
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        #region 参数和属性
         public ConverterPPTDialogModel ConverterPPTModel = new ConverterPPTDialogModel();
 
         public CPDFViewer currentViewer;
@@ -30,16 +35,22 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
         public string PageRangeText { set; get; } = "0";
 
         public string PageRangeSelectIndex { set; get; } = "0";
+        #endregion
+
+        #region 委托声明
 
         public DelegateCommand CancelCommand { get; set; }
 
         public DelegateCommand ConverterCommnad { get; set; }
+        #endregion
+
         public ConverterPPTDialogViewModel(IDialogService dialogService)
         {
             CancelCommand = new DelegateCommand(cancel);
             ConverterCommnad = new DelegateCommand(converter);
             dialogs = dialogService;
         }
+        #region 逻辑函数
         private void cancel()
         {
             RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
@@ -71,14 +82,9 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 
             });
         }
+        #endregion
 
-        private void SetProgress(int pageIndex)
-        {
-
-        }
-        public string Title => "";
-
-        public event Action<IDialogResult> RequestClose;
+        #region 构架行为
 
         public bool CanCloseDialog()
         {
@@ -101,5 +107,6 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 ConverterPPTModel.OutputPath = fileinfo.DirectoryName;
             }
         }
+        #endregion
     }
 }

+ 11 - 5
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterProgressBarDialogViewModel.cs

@@ -17,6 +17,11 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 {
     public class ConverterProgressBarDialogViewModel : BindableBase,IDialogAware
     {
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        #region 参数和属性
         private string _pageIndex = "0";
 
         /// <value>
@@ -43,20 +48,20 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 SetProperty(ref _pageNumber, value);
             }
         }
+        #endregion
 
         public ConverterProgressBarDialogViewModel()
         {
 
         }
-
+        #region 逻辑函数
         private void SetProgress(int pageIndex)
         {
             PageIndex=pageIndex.ToString();
         }
-
-        public string Title =>"";
-
-        public event Action<IDialogResult> RequestClose;
+        #endregion
+        
+        #region 构架行为
 
         public bool CanCloseDialog()
         {
@@ -153,5 +158,6 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
             }
             RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
         }
+        #endregion
     }
 }

+ 14 - 8
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterRTFDialogViewModel.cs

@@ -19,6 +19,11 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
     public class ConverterRTFDialogViewModel : BindableBase, IDialogAware
     {
 
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        #region 参数和属性
         public ConverterRTFDialogModel ConverterRTFModel = new ConverterRTFDialogModel();
 
         public CPDFViewer currentViewer;
@@ -30,16 +35,21 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
         public string PageRangeText { set; get; } = "0";
 
         public string PageRangeSelectIndex { set; get; } = "0";
-
+        #endregion
+        #region 委托声明
         public DelegateCommand CancelCommand { get; set; }
 
         public DelegateCommand ConverterCommnad { get; set; }
+        #endregion
+
         public ConverterRTFDialogViewModel(IDialogService dialogService)
         {
             CancelCommand = new DelegateCommand(cancel);
             ConverterCommnad = new DelegateCommand(converter);
             dialogs = dialogService;
         }
+
+        #region 逻辑函数
         private void cancel()
         {
             RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
@@ -71,14 +81,9 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 
             });
         }
+        #endregion
 
-        private void SetProgress(int pageIndex)
-        {
-
-        }
-        public string Title => "";
-
-        public event Action<IDialogResult> RequestClose;
+        #region 构架行为
 
         public bool CanCloseDialog()
         {
@@ -101,5 +106,6 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 ConverterRTFModel.OutputPath = fileinfo.DirectoryName;
             }
         }
+        #endregion
     }
 }

+ 15 - 7
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterTextDialogViewModel.cs

@@ -19,6 +19,12 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 {
     public class ConverterTextDialogViewModel : BindableBase, IDialogAware
     {
+
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        #region 参数和属性
         public ConverterTextDialogModel ConverterTextModel = new ConverterTextDialogModel();
 
         public CPDFViewer currentViewer;
@@ -31,15 +37,21 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 
         public string PageRangeSelectIndex { set; get; } = "0";
 
+        #endregion
+
+        #region 委托声明
         public DelegateCommand CancelCommand { get; set; }
 
         public DelegateCommand ConverterCommnad { get; set; }
+        #endregion
+
         public ConverterTextDialogViewModel(IDialogService dialogService)
         {
             CancelCommand = new DelegateCommand(cancel);
             ConverterCommnad = new DelegateCommand(converter);
             dialogs = dialogService;
         }
+        #region 逻辑函数
         private void cancel()
         {
             RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
@@ -70,14 +82,9 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 
             });
         }
+        #endregion
 
-        private void SetProgress(int pageIndex)
-        { 
-        
-        }
-        public string Title => "";
-
-        public event Action<IDialogResult> RequestClose;
+        #region 构架行为
 
         public bool CanCloseDialog()
         {
@@ -100,5 +107,6 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 ConverterTextModel.OutputPath=fileinfo.DirectoryName;
             }
         }
+        #endregion
     }
 }

+ 14 - 8
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterWordDialogViewModel.cs

@@ -18,6 +18,12 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 {
     public class ConverterWordDialogViewModel : BindableBase, IDialogAware
     {
+
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        #region 参数和属性
         public ConverterWordDialogModel ConverterWordModel = new ConverterWordDialogModel();
 
         public CPDFViewer currentViewer;
@@ -29,12 +35,15 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
         public string PageRangeText { set; get; } = "0";
 
         public string PageRangeSelectIndex { set; get; } = "0";
+        #endregion
 
+        #region 委托声明
         public DelegateCommand<string> RadioButtonCommand { get; set; }
 
         public DelegateCommand CancelCommand { get; set; }
 
         public DelegateCommand ConverterCommnad { get; set; }
+        #endregion
 
         public ConverterWordDialogViewModel(IDialogService dialogService)
         {
@@ -43,6 +52,7 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
             RadioButtonCommand = new DelegateCommand<string>(radiobutton);
             dialogs = dialogService;
         }
+        #region 逻辑函数
         private void cancel()
         {
             RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
@@ -73,7 +83,7 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 
             });
         }
-
+        
         private void radiobutton(string e)
         {
             string radioButton = e;
@@ -91,14 +101,9 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
             }
 
         }
+        #endregion
 
-        private void SetProgress(int pageIndex)
-        {
-
-        }
-        public string Title => "";
-
-        public event Action<IDialogResult> RequestClose;
+        #region 构架行为
 
         public bool CanCloseDialog()
         {
@@ -121,5 +126,6 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 ConverterWordModel.OutputPath = fileinfo.DirectoryName;
             }
         }
+        #endregion
     }
 }

+ 10 - 2
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBatchProcessingDialogViewModel.cs

@@ -17,6 +17,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 {
     public class HomePageBatchProcessingDialogViewModel : BindableBase, IDialogAware, INavigationAware
     {
+        #region 参数和属性
         private List<string> fileNames;
 
         public IRegionManager BatchProcessingRegion;
@@ -40,15 +41,18 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             get { return batchProcessingVisible; }
             set { SetProperty(ref batchProcessingVisible, value); }
         }
-        public DelegateCommand<string> DelegateChangeBatchProcessingCommand { get; set; }
+        #endregion
 
+        #region 委托声明
+        public DelegateCommand<string> DelegateChangeBatchProcessingCommand { get; set; }
+        #endregion
         public HomePageBatchProcessingDialogViewModel(IRegionManager regionManager)
         {
             BatchProcessingRegion = regionManager;
             BatchProcessingRegionName = Guid.NewGuid().ToString();
             DelegateChangeBatchProcessingCommand= new DelegateCommand<string>(ChangeBatchProcessing);
         }
-
+        #region 逻辑函数
         public void ChangeBatchProcessing(string index) {
             if (index=="0"||index =="1"||index=="2") { 
             NavigationParameters param = new NavigationParameters();
@@ -58,11 +62,14 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             BatchProcessingVisible = Visibility.Visible;
             }
         }
+        #endregion
 
         public string Title => "PDF批量工具";
 
         public event Action<IDialogResult> RequestClose;
 
+        #region 构架行为
+
         public bool CanCloseDialog()
         {
             return true;
@@ -98,5 +105,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
         }
+        #endregion
     }
 }

+ 11 - 2
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageCompressDialogViewModel.cs

@@ -21,6 +21,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 {
     public class HomePageCompressDialogViewModel : BindableBase, INavigationAware
     {
+        #region 参数和属性
         private List<string> fileNames;
 
         private CPDFDocument tempDocument;
@@ -102,6 +103,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
             }
         }
+        #endregion
+
+        #region 委托声明
         public DelegateCommand ADDPDFCommand { get; set; }
 
         public DelegateCommand RemovePDFFileCommand { get; set; }
@@ -111,6 +115,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public DelegateCommand CompressCommand { get; set; }
 
         public DelegateCommand<string> RadioButtonCommand{ get; set; }
+        #endregion
 
         public HomePageCompressDialogViewModel()
         {
@@ -123,7 +128,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             CompressCommand = new DelegateCommand(compress);
             RadioButtonCommand = new DelegateCommand<string>(RadioButton);
         }
-
+        #region 逻辑函数
         private void RadioButton(string sender) {
             if (sender != "") {
 
@@ -146,7 +151,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
                 }
             }
-
         }
 
         private int GetIndex(int pageindex)
@@ -180,7 +184,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             MessageBoxEx.Show("已完成");
             
         }
+        #endregion
 
+        #region 批量处理逻辑函数
         /// <summary>
         /// 添加PDF文件
         /// </summary>
@@ -318,7 +324,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 AddFileVisibility = Visibility.Collapsed;
             }
         }
+        #endregion
 
+        #region 构架行为
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             List<string> filepath = new List<string>();
@@ -342,5 +350,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             if(tempDocument!=null)
             tempDocument.CompressFile_Cancel(compressingIntpr);
         }
+        #endregion
     }
 }

+ 6 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterCSVViewModel.cs

@@ -10,14 +10,17 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 {
     public class HomePageConverterCSVViewModel : BindableBase, INavigationAware
     {
+        #region 委托声明
         public DelegateCommand<string> RadioButtonCommand { get; set; }
 
         public HomePageConverterDialogViewModel homePageConverterDialogViewModel { get; set; }
+        #endregion
 
         public HomePageConverterCSVViewModel()
         {
             RadioButtonCommand = new DelegateCommand<string>(radiobutton);
         }
+        #region 逻辑函数
         private void radiobutton(string e)
         {
             string radioButton = e;
@@ -35,7 +38,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
 
         }
+        #endregion
 
+        #region 构架行为
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             var homePageConverterVM = navigationContext.Parameters[ParameterNames.ViewContentViewModel] as HomePageConverterDialogViewModel;
@@ -53,5 +58,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
         }
+        #endregion
     }
 }

+ 15 - 2
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterDialogViewModel.cs

@@ -26,6 +26,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 {
     public class HomePageConverterDialogViewModel : BindableBase, INavigationAware
     {
+        #region 参数和属性
         private List<string> fileNames;
 
         public HomePageConverterCSVModel ConverterCSVModel = new HomePageConverterCSVModel();
@@ -99,8 +100,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
         }
 
-       
-
         private string removeIsEnable = "False";
         public string RemoveIsEnable
         {
@@ -152,6 +151,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
             }
         }
+        #endregion
+
+        #region 委托声明
         public DelegateCommand ADDPDFCommand { get; set; }
 
         public DelegateCommand RemovePDFFileCommand { get; set; }
@@ -159,6 +161,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public DelegateCommand ConvertCommand { get; set; }
 
         public DelegateCommand ADDPDFFilesCommand { get; set; }
+        #endregion
 
         public HomePageConverterDialogViewModel(IRegionManager converterRegion)
         {
@@ -174,11 +177,13 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             ConverterRegion = converterRegion;
             ConverterRegionName=Guid.NewGuid().ToString();
         }
+        #region 逻辑函数
         private void SetProgress(int pageIndex)
         {
             PDFDataTable.Rows[fileNamesIndex]["FileState"] = "已经转换" + pageIndex.ToString() + "页";
             pageIndex.ToString();
         }
+
         private async void convert()
         {
 
@@ -277,6 +282,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
             ConverterGridIsEnabled = "True";
         }
+        #endregion
+
+        #region 批量处理逻辑函数
         /// <summary>
         /// 添加PDF文件
         /// </summary>
@@ -428,6 +436,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             else { ConverterVisible = Visibility.Collapsed; }
 
         }
+        #endregion
+
+        #region 构架行为
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             List<string> filepath = new List<string>();
@@ -440,6 +451,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 ChangeConverter(0);
             }
         }
+       
 
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
@@ -450,5 +462,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             ConverterHelper.Clear();
         }
+        #endregion
     }
 }

+ 10 - 2
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterExcelViewModel.cs

@@ -12,16 +12,21 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 {
     public class HomePageConverterExcelViewModel : BindableBase, INavigationAware
     {
+        #region 参数和属性
         public ConverterExcelDialogModel ConverterExcelModel = new ConverterExcelDialogModel();
 
-        public DelegateCommand<string> RadioButtonCommand { get; set; }
-
         public HomePageConverterDialogViewModel homePageConverterDialogViewModel { get; set; }
+        #endregion
+
+        #region 委托声明
+        public DelegateCommand<string> RadioButtonCommand { get; set; }
+        #endregion
 
         public HomePageConverterExcelViewModel()
         {
             RadioButtonCommand = new DelegateCommand<string>(radiobutton);
         }
+        #region 逻辑函数
         private void radiobutton(string e)
         {
             string radioButton = e;
@@ -44,6 +49,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
 
         }
+        #endregion
+        #region 构架行为
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             var homePageConverterVM = navigationContext.Parameters[ParameterNames.ViewContentViewModel] as HomePageConverterDialogViewModel;
@@ -61,5 +68,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
         }
+        #endregion
     }
 }

+ 4 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterImgViewModel.cs

@@ -10,6 +10,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 {
     public class HomePageConverterImgViewModel : BindableBase, INavigationAware
     {
+        #region 参数和属性
         public List<string> ImageTypeFamily { set; get; } = new List<string>();
 
         public HomePageConverterDialogViewModel homePageConverterDialogViewModel { get; set; }
@@ -36,12 +37,14 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             this.ImageDPIFamily.Add("300 dpi");
             this.ImageDPIFamily.Add("600 dpi");
         }
+        #endregion
 
         public HomePageConverterImgViewModel()
         {
             SetImageTypeOrigin();
             SetImageDPIOrigin();
         }
+        #region 构架行为
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             var homePageConverterVM = navigationContext.Parameters[ParameterNames.ViewContentViewModel] as HomePageConverterDialogViewModel;
@@ -59,5 +62,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
         }
+        #endregion
     }
 }

+ 83 - 73
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageSetPasswordDialogViewModel.cs

@@ -18,6 +18,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 {
     public class HomePageSetPasswordDialogViewModel : BindableBase, INavigationAware
     {
+        #region 参数和属性
         private List<string> fileNames;
 
         private int fileNamesIndex = 0;
@@ -157,6 +158,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
             }
         }
+        #endregion
+
+        #region 委托声明
 
         public DelegateCommand DelegateSetOpenCommand { get; set; }
 
@@ -175,6 +179,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public DelegateCommand RemovePDFFileCommand { get; set; }
 
         public DelegateCommand ADDPDFFilesCommand { get; set; }
+        #endregion
 
         public HomePageSetPasswordDialogViewModel()
         {
@@ -228,6 +233,82 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             GetChangeMod.Add("4", HomePageSetPasswordDialogModel.ChangeMod.ExceptAbstrat);
         }
         #endregion
+        #region 逻辑函数
+        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("已完成");
+        }
+        #endregion
+
+        #region 批量处理逻辑函数
         /// <summary>
         /// 添加PDF文件
         /// </summary>
@@ -312,78 +393,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         }
 
-        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("已完成");
-        }
+        
 
         /// <summary>
         /// 逆序int类型集合
@@ -438,7 +448,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 AddFileVisibility = Visibility.Collapsed;
             }
         }
-
+        #endregion
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             List<string> filepath = new List<string>();

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

@@ -98,6 +98,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         }
 
         #endregion
+
         #region 委托声明
 
         public DelegateCommand ToPDFCommand { get; set; }
@@ -219,7 +220,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             FileInfo file = new FileInfo(filename);
             return filename.Replace(file.Name, "") +pictureToPDFModel.FrontFileNameLabel+file.Name+pictureToPDFModel.RearFileNameLabel+".pdf";
         }
+        #endregion
 
+        #region 批量处理逻辑函数
         /// <summary>
         /// 选择PDF文件
         /// </summary>
@@ -354,7 +357,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             ImagesDataTable = imagesdatatable;
 
         }
+        #endregion
 
+        #region 图片转换
         /// <summary>
         /// 图片转PNG
         /// picturefile 图片文件名

+ 0 - 16
PDF Office/ViewModels/EditTools/Background/BackgroundBarContentViewModel.cs

@@ -1,16 +0,0 @@
-using Prism.Commands;
-using Prism.Mvvm;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace PDF_Office.ViewModels
-{
-    public class BackgroundBarContentViewModel : BindableBase
-    {
-        public BackgroundBarContentViewModel()
-        {
-
-        }
-    }
-}

+ 28 - 0
PDF Office/ViewModels/EditTools/Background/BackgroundContentViewModel.cs

@@ -0,0 +1,28 @@
+using PDF_Office.EventAggregators;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace PDF_Office.ViewModels.EditTools.Background
+{
+    public class BackgroundContentViewModel : BindableBase
+    {
+        public IEventAggregator eventAggregator;
+
+
+        public DelegateCommand CloseEditToolCommand { get; set; }
+        public BackgroundContentViewModel(IEventAggregator eventAggregator)
+        {
+            this.eventAggregator = eventAggregator;
+            CloseEditToolCommand = new DelegateCommand(CloseEditTool);
+        }
+        public void CloseEditTool()
+        {
+            this.eventAggregator.GetEvent<CloseEditToolEvent>().Publish();
+
+        }
+    }
+}

+ 0 - 16
PDF Office/ViewModels/EditTools/Background/BackgroundTemplateContentViewModel.cs

@@ -1,16 +0,0 @@
-using Prism.Commands;
-using Prism.Mvvm;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace PDF_Office.ViewModels
-{
-    public class BackgroundTemplateContentViewModel : BindableBase
-    {
-        public BackgroundTemplateContentViewModel()
-        {
-
-        }
-    }
-}

+ 28 - 0
PDF Office/ViewModels/EditTools/Watermark/WatermarkContentViewModel.cs

@@ -0,0 +1,28 @@
+using PDF_Office.EventAggregators;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace PDF_Office.ViewModels.EditTools.Watermark
+{
+    public class WatermarkContentViewModel : BindableBase
+    {
+        public IEventAggregator eventAggregator;
+
+
+        public DelegateCommand CloseEditToolCommand { get; set; }
+        public WatermarkContentViewModel(IEventAggregator eventAggregator)
+        {
+            this.eventAggregator = eventAggregator;
+            CloseEditToolCommand = new DelegateCommand(CloseEditTool);
+        }
+        public void CloseEditTool()
+        {
+            this.eventAggregator.GetEvent<CloseEditToolEvent>().Publish();
+
+        }
+    }
+}

+ 2 - 2
PDF Office/ViewModels/HomePanel/HomeGuidContentViewModel.cs

@@ -103,7 +103,7 @@ namespace PDF_Office.ViewModels.HomePanel
                         DialogParameters securitypdf = new DialogParameters();
                         securitypdf.Add(ParameterNames.BatchProcessing_Name, "2");
                         HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 1;
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 2;
                         securitypdf.Add(ParameterNames.FilePath, dlg.FileNames);
                         dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, securitypdf, e => { });
                         
@@ -112,7 +112,7 @@ namespace PDF_Office.ViewModels.HomePanel
                         DialogParameters convertpdf = new DialogParameters();
                         convertpdf.Add(ParameterNames.BatchProcessing_Name, "0");
                         HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 1;
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
                         convertpdf.Add(ParameterNames.FilePath, dlg.FileNames);
                         dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdf, e => { });
 

+ 11 - 4
PDF Office/ViewModels/Tools/ToolsBarContentViewModel.cs

@@ -34,7 +34,9 @@ namespace PDF_Office.ViewModels.Tools
 
         public DelegateCommand CancelPasswordCommand { get; set; }
 
-        public DelegateCommand SetBackgroundCommand { get; set; }
+        public DelegateCommand<object> SetEditToolsCommand { get; set; }
+
+        public DelegateCommand SetWatermarkCommand { get; set; }
 
         public ToolsBarContentViewModel(IDialogService dialogService, IEventAggregator eventAggregator)
         {
@@ -43,14 +45,19 @@ namespace PDF_Office.ViewModels.Tools
             CompressCommand = new DelegateCommand(OpenCompressDialog);
             SetPasswordCommand = new DelegateCommand(OpenSetPasswordDialog);
             CancelPasswordCommand = new DelegateCommand(OpenCancelPasswordDialog);
-            SetBackgroundCommand = new DelegateCommand(SetBackground);
+            SetEditToolsCommand = new DelegateCommand<object>(SetEditTools);
         }
 
-        private void SetBackground()
+        private void SetEditTools(object e)
         {
-            this.eventAggregator.GetEvent<EditToolsEvent>().Publish("SetBackground");
+            var args = e as System.Windows.Controls.Button;
+            if (args != null)
+            {
+                this.eventAggregator.GetEvent<EditToolsEvent>().Publish(args.Name);
+            }
         }
 
+
         private void OpenCompressDialog()
         {
             DialogParameters value = new DialogParameters();

+ 47 - 21
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -15,11 +15,9 @@ using PDF_Office.CustomControl;
 using PDF_Office.Model;
 using System.Windows;
 using System.Windows.Controls;
-using System.IO;
+using System.IO;
 using Prism.Events;
 using PDF_Office.EventAggregators;
-
-
 namespace PDF_Office.ViewModels
 {
 
@@ -84,7 +82,7 @@ namespace PDF_Office.ViewModels
                 SetProperty(ref propertyColumnWidth, value);
             }
         }
-
+
 
         private int gridToolRow = 1;
         /// <summary>
@@ -126,6 +124,19 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        private Visibility gridVisibility = Visibility.Visible;
+        /// <summary>
+        /// 是否正在加载中
+        /// </summary>
+        public Visibility GridVisibility
+        {
+            get { return gridVisibility; }
+            set
+            {
+                SetProperty(ref gridVisibility, value);
+            }
+        }
+
         private Visibility isLoading = Visibility.Collapsed;
         /// <summary>
         /// 是否正在加载中
@@ -138,7 +149,7 @@ namespace PDF_Office.ViewModels
                 SetProperty(ref isLoading, value);
             }
         }
-
+
         private Visibility converterBarContentVisible = Visibility.Collapsed;
         /// <summary>
         /// 控制ToolsBarContent的显示
@@ -240,7 +251,7 @@ namespace PDF_Office.ViewModels
         #endregion
 
         public ViewContentViewModel(IRegionManager regionManager, IDialogService dialogService, IEventAggregator eventAggregator)
-
+
         {
             region = regionManager;
             dialogs = dialogService;
@@ -248,7 +259,7 @@ 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);
@@ -270,7 +281,8 @@ namespace PDF_Office.ViewModels
             InitialregionNameByTabItem(ref regionNameByTabItem);
             InitialbarContentByTabItem(ref barContentByTabItem);
             eventAggregator.GetEvent<EditToolsEvent>().Subscribe(EnterEditTools);
-
+            eventAggregator.GetEvent<CloseEditToolEvent>().Subscribe(CloseEditTool);
+
         }
 
         private void InitialregionNameByTabItem(ref Dictionary<string, string> dictionary)
@@ -314,6 +326,13 @@ namespace PDF_Office.ViewModels
                 case "TabItemPageEdit":
                     ToolContentVisible = Visibility.Visible;
                     break;
+                case "WatermarkContent":
+                    ToolContentVisible = Visibility.Visible;
+                    break;
+                case "BackgroundContent":
+                    ToolContentVisible = Visibility.Visible;
+                    break;
+                   
                 default:
                     break;
             }
@@ -330,7 +349,7 @@ namespace PDF_Office.ViewModels
                 CanUndo = PDFViewer.UndoManager.CanUndo;
             }
             if (e.PropertyName == "CanRedo")
-
+
             {
                 CanRedo = PDFViewer.UndoManager.CanRedo;
             }
@@ -350,7 +369,7 @@ namespace PDF_Office.ViewModels
                 if (previousBar != currentBar)
                 {
                     if (currentBar == "TabItemPageEdit")//如果是页面编辑则进入页面编辑模式
-
+
                     {
                         EnterToolMode(barContentByTabItem[currentBar]);
                         isInPageEdit = true;
@@ -439,7 +458,7 @@ namespace PDF_Office.ViewModels
         private void Undo()
         {
             if (isInPageEdit)
-
+
             {
                 //执行页面编辑的Undo
                 PageEditUndo?.Invoke();
@@ -453,7 +472,7 @@ namespace PDF_Office.ViewModels
         private void Redo()
         {
             if (isInPageEdit)
-
+
             {
                 //执行页面编辑的Redo
                 PageEditRedo?.Invoke();
@@ -473,7 +492,7 @@ namespace PDF_Office.ViewModels
                 parameters.Add(ParameterNames.PDFViewer, PDFViewer);
                 parameters.Add(ParameterNames.ViewContentViewModel, this);
                 region.RequestNavigate(BOTARegionName, "BOTAContent", parameters);
-
+
             }
             ));
         }
@@ -678,9 +697,10 @@ namespace PDF_Office.ViewModels
         /// 显示前添加内容到Region
         /// </summary>
         /// <param name="isPageEdit"></param>
-
+
         private void ShowContent(string currentBar,bool isToolMode=false)
         {
+            GridVisibility = Visibility.Visible;
             //显示页面编辑或其他工具
             if (currentBar == "TabItemPageEdit"||isToolMode)
             {
@@ -698,6 +718,7 @@ namespace PDF_Office.ViewModels
                 }
                 else//进入水印等其他工具模式
                 {
+                    GridVisibility = Visibility.Collapsed;
                     if (GridToolRow != 0)
                     {
                         GridToolRow = 0;
@@ -728,13 +749,18 @@ namespace PDF_Office.ViewModels
         /// <param name="EditToolName"></param>
         private void EnterEditTools(string EditToolName)
         {
-            if (EditToolName == "SetBackground")
-            {
-                ToolRowHeight = 0;
-                PropertyColumnWidth = 260;
-            }
+            EnterSelectedEditTool(EditToolName);
+        }
+        private void EnterSelectedEditTool(string EditToolName)
+        {
+            currentBar = EditToolName;
+            EnterToolMode(EditToolName);
+        }
+        private void CloseEditTool()
+        {
+            currentBar = "TabItemTool";
+            EnterSelectedBar(currentBar);
         }
-
         /// <summary>
         /// 进入工具编辑(如页面编辑、水印、密文等)模式
         /// </summary> 
@@ -756,7 +782,7 @@ namespace PDF_Office.ViewModels
             }
             region.RequestNavigate(ToolContentRegionName, targetToolMode, param);
             ShowContent(currentBar, true);
-
+
 
             IsLoading = Visibility.Collapsed;
         }

+ 1 - 1
PDF Office/Views/Dialog/ConverterDialogs/ConverterExcelDialog.xaml

@@ -30,7 +30,7 @@
                         <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}">
+                                <RadioButton Name="ForEachPageRadioBtn" Command="{Binding RadioButtonCommand}" CommandParameter="{Binding ElementName=ForEachPageRadioBtn,Path=Name}" IsChecked="True">
                                     <TextBlock Text="将每个页面转换为一个单独的工作表"/>
                                 </RadioButton>
                                 <RadioButton Margin="0,6,0,0" Name="ForTheDocRadioBtn" Command="{Binding RadioButtonCommand}" CommandParameter="{Binding ElementName=ForTheDocRadioBtn,Path=Name}">

+ 0 - 56
PDF Office/Views/EditTools/Background/BackgroundBarContent.xaml

@@ -1,56 +0,0 @@
-<UserControl x:Class="PDF_Office.Views.EditTools.Background.BackgroundBarContent"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:prism="http://prismlibrary.com/"             
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             prism:ViewModelLocator.AutoWireViewModel="True"
-                          Height="40" Width="1280">
-    <UserControl.Resources>
-        <ResourceDictionary>
-            <ResourceDictionary.MergedDictionaries>
-                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
-            </ResourceDictionary.MergedDictionaries>
-        </ResourceDictionary>
-    </UserControl.Resources>
-    <Grid>
-        <Border x:Name="ToolsBorder" BorderBrush="#1A000000" BorderThickness="0,1,0,1" Height="40">
-            <WrapPanel HorizontalAlignment="Center" Height="40">
-                <Button Style="{StaticResource InsideBarBtnStyle }" Command="{Binding CompressCommand}">
-
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="添加背景" VerticalAlignment="Center"></TextBlock>
-                    </StackPanel>
-                </Button>
-                <Button Style="{StaticResource InsideBarBtnStyle }" Command="{Binding CompressCommand}">
-
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="移除" VerticalAlignment="Center"></TextBlock>
-                    </StackPanel>
-                </Button>
-
-                <Label Height="10" Width="1" Background="LightGray"></Label>
-                
-                <Button Style="{StaticResource InsideBarBtnStyle }" Command="{Binding CompressCommand}">
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="批量" VerticalAlignment="Center"></TextBlock>
-                    </StackPanel>
-                </Button>
-            </WrapPanel>
-        </Border>
-        <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
-            <Button Content="应用" Height="24" Width="44"></Button>
-            <Button Content="关闭" Height="24" Width="44" Margin="16,0,16,0"></Button>
-        </StackPanel>
-    </Grid>
-    
-</UserControl>
-

+ 93 - 0
PDF Office/Views/EditTools/Background/BackgroundContent.xaml

@@ -0,0 +1,93 @@
+<UserControl x:Class="PDF_Office.Views.EditTools.Background.BackgroundContent"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"             
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:background="clr-namespace:PDF_Office.ViewModels.EditTools.Background" d:DataContext="{d:DesignInstance Type=background:BackgroundContentViewModel}"
+             mc:Ignorable="d"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             d:DesignHeight="760"
+             d:DesignWidth="1280">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="40"></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Grid.Row="0" Background="AntiqueWhite">
+            <Border x:Name="ToolsBorder" BorderBrush="#1A000000" BorderThickness="0,1,0,1" Height="40">
+                <WrapPanel HorizontalAlignment="Center" Height="40">
+                    <Button Style="{StaticResource InsideBarBtnStyle }">
+
+                        <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                            <StackPanel Margin="0,0,8,0">
+                                <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                            </StackPanel >
+                            <TextBlock Text="添加背景" VerticalAlignment="Center"></TextBlock>
+                        </StackPanel>
+                    </Button>
+                    <Button Style="{StaticResource InsideBarBtnStyle }" >
+
+                        <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                            <StackPanel Margin="0,0,8,0">
+                                <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                            </StackPanel >
+                            <TextBlock Text="移除" VerticalAlignment="Center"></TextBlock>
+                        </StackPanel>
+                    </Button>
+
+                    <Label Height="10" Width="1" Background="LightGray"></Label>
+
+                    <Button Style="{StaticResource InsideBarBtnStyle }" >
+                        <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                            <StackPanel Margin="0,0,8,0">
+                                <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                            </StackPanel >
+                            <TextBlock Text="批量" VerticalAlignment="Center"></TextBlock>
+                        </StackPanel>
+                    </Button>
+                </WrapPanel>
+            </Border>
+            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
+                <Button Content="应用" Height="24" Width="44" ></Button>
+                <Button Content="关闭" Height="24" Width="44" Margin="16,0,16,0" Command="{Binding CloseEditToolCommand}"></Button>
+            </StackPanel>
+        </Grid>
+        <Grid Grid.Row="1" >
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition></ColumnDefinition>
+                <ColumnDefinition Width="260"></ColumnDefinition>
+            </Grid.ColumnDefinitions>
+            <Grid Grid.Column="0" Background="BurlyWood" >
+                <Grid Height="64" Width="293" HorizontalAlignment="Center"  VerticalAlignment="Bottom"  Panel.ZIndex="1" Background="#323232" Margin="9,9,9,9">
+                    <StackPanel Orientation="Horizontal"  VerticalAlignment="Center">
+                        <StackPanel Orientation="Horizontal">
+
+                            <TextBlock Text="-" FontSize="20" Foreground="White" Margin="20,0,20,0"></TextBlock>
+                            <TextBlock Text="+" FontSize="20" Foreground="White" Margin="0,0,39,0"></TextBlock>
+                        </StackPanel>
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="1" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
+                            <TextBlock Text="/" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
+                            <TextBlock Text="20" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
+                        </StackPanel>
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="↑" FontSize="20" Foreground="White" Margin="20,0,20,0"></TextBlock>
+                            <TextBlock Text="↓" FontSize="20" Foreground="White"></TextBlock>
+
+                        </StackPanel>
+                    </StackPanel>
+                </Grid>
+            </Grid>
+            <Grid Grid.Column="1" Background="Wheat">
+            </Grid>
+        </Grid>
+    </Grid>
+</UserControl>
+    

+ 2 - 2
PDF Office/Views/EditTools/Background/BackgroundBarContent.xaml.cs

@@ -5,9 +5,9 @@ namespace PDF_Office.Views.EditTools.Background
     /// <summary>
     /// Interaction logic for BackgroundBarContent
     /// </summary>
-    public partial class BackgroundBarContent : UserControl
+    public partial class BackgroundContent : UserControl
     {
-        public BackgroundBarContent()
+        public BackgroundContent()
         {
             InitializeComponent();
         }

+ 0 - 31
PDF Office/Views/EditTools/Background/BackgroundTemplateContent.xaml

@@ -1,31 +0,0 @@
-<UserControl x:Class="PDF_Office.Views.EditTools.Background.BackgroundTemplateContent"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:prism="http://prismlibrary.com/"        
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             prism:ViewModelLocator.AutoWireViewModel="True"
-                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-                 mc:Ignorable="d"
-             d:DesignHeight ="720"
-             d:DesignWidth ="260">
-    <Grid>
-        <Grid.RowDefinitions>
-            <RowDefinition Height="56"></RowDefinition>
-            <RowDefinition Height="32"></RowDefinition>
-            <RowDefinition></RowDefinition>
-        </Grid.RowDefinitions>
-        <Grid Grid.Row="0">
-            <StackPanel Orientation="Horizontal">
-                <TextBlock Height="32" Width="24" Margin="16" Text="背景"></TextBlock>
-            </StackPanel>
-        </Grid>
-        <Grid Grid.Row="1">
-            <StackPanel Orientation="Horizontal">
-                
-            </StackPanel>
-        </Grid>
-        <Grid Grid.Row="2" Background="AliceBlue" >
-            
-        </Grid>
-    </Grid>
-</UserControl>

+ 0 - 15
PDF Office/Views/EditTools/Background/BackgroundTemplateContent.xaml.cs

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

+ 92 - 0
PDF Office/Views/EditTools/Watermark/WatermarkContent.xaml

@@ -0,0 +1,92 @@
+<UserControl x:Class="PDF_Office.Views.EditTools.Watermark.WatermarkContent"
+           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"             
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:background="clr-namespace:PDF_Office.ViewModels.EditTools.Background" d:DataContext="{d:DesignInstance Type=background:BackgroundContentViewModel}"
+             mc:Ignorable="d"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             d:DesignHeight="760"
+             d:DesignWidth="1280">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="40"></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Grid.Row="0" Background="AntiqueWhite">
+            <Border x:Name="ToolsBorder" BorderBrush="#1A000000" BorderThickness="0,1,0,1" Height="40">
+                <WrapPanel HorizontalAlignment="Center" Height="40">
+                    <Button Style="{StaticResource InsideBarBtnStyle }">
+
+                        <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                            <StackPanel Margin="0,0,8,0">
+                                <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                            </StackPanel >
+                            <TextBlock Text="添加水印" VerticalAlignment="Center"></TextBlock>
+                        </StackPanel>
+                    </Button>
+                    <Button Style="{StaticResource InsideBarBtnStyle }" >
+
+                        <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                            <StackPanel Margin="0,0,8,0">
+                                <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                            </StackPanel >
+                            <TextBlock Text="移除" VerticalAlignment="Center"></TextBlock>
+                        </StackPanel>
+                    </Button>
+
+                    <Label Height="10" Width="1" Background="LightGray"></Label>
+
+                    <Button Style="{StaticResource InsideBarBtnStyle }" >
+                        <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                            <StackPanel Margin="0,0,8,0">
+                                <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                            </StackPanel >
+                            <TextBlock Text="批量" VerticalAlignment="Center"></TextBlock>
+                        </StackPanel>
+                    </Button>
+                </WrapPanel>
+            </Border>
+            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
+                <Button Content="应用" Height="24" Width="44" ></Button>
+                <Button Content="关闭" Height="24" Width="44" Margin="16,0,16,0" Command="{Binding CloseEditToolCommand}"></Button>
+            </StackPanel>
+        </Grid>
+        <Grid Grid.Row="1" >
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition></ColumnDefinition>
+                <ColumnDefinition Width="260"></ColumnDefinition>
+            </Grid.ColumnDefinitions>
+            <Grid Grid.Column="0" Background="DarkSlateBlue" >
+                <Grid Height="64" Width="293" HorizontalAlignment="Center"  VerticalAlignment="Bottom"  Panel.ZIndex="1" Background="#323232" Margin="9,9,9,9">
+                    <StackPanel Orientation="Horizontal"  VerticalAlignment="Center">
+                        <StackPanel Orientation="Horizontal">
+
+                            <TextBlock Text="-" FontSize="20" Foreground="White" Margin="20,0,20,0"></TextBlock>
+                            <TextBlock Text="+" FontSize="20" Foreground="White" Margin="0,0,39,0"></TextBlock>
+                        </StackPanel>
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="1" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
+                            <TextBlock Text="/" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
+                            <TextBlock Text="20" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
+                        </StackPanel>
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="↑" FontSize="20" Foreground="White" Margin="20,0,20,0"></TextBlock>
+                            <TextBlock Text="↓" FontSize="20" Foreground="White"></TextBlock>
+
+                        </StackPanel>
+                    </StackPanel>
+                </Grid>
+            </Grid>
+            <Grid Grid.Column="1" Background="DarkBlue">
+            </Grid>
+        </Grid>
+    </Grid>
+</UserControl>

+ 15 - 0
PDF Office/Views/EditTools/Watermark/WatermarkContent.xaml.cs

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

+ 153 - 153
PDF Office/Views/Tools/ToolsBarContent.xaml

@@ -1,153 +1,153 @@
-<UserControl x:Class="PDF_Office.Views.Tools.ToolsBarContent"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:prism="http://prismlibrary.com/" xmlns:tools="clr-namespace:PDF_Office.ViewModels.Tools" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
-             prism:ViewModelLocator.AutoWireViewModel="True">
-    <UserControl.Resources>
-        <ResourceDictionary>
-            <ResourceDictionary.MergedDictionaries>
-                <ResourceDictionary Source="../../Styles/CustomBtnStyle.xaml"/>
-                <ResourceDictionary Source="../../Styles/MenuStyle.xaml"/>
-            </ResourceDictionary.MergedDictionaries>
-        </ResourceDictionary>
-    </UserControl.Resources>
-    <Grid>
-        <Border x:Name="ToolsBorder" BorderBrush="#1A000000" BorderThickness="0,1,0,1" Height="40">
-            <WrapPanel HorizontalAlignment="Center" Height="40">
-                <Button Style="{StaticResource InsideBarBtnStyle }" Command="{Binding CompressCommand}">
-
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="压缩" VerticalAlignment="Center"></TextBlock>
-                    </StackPanel>
-                </Button>
-                <Button Style="{StaticResource InsideBarBtnStyle }" >
-
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="合并" VerticalAlignment="Center"></TextBlock>
-                    </StackPanel>
-                </Button>
-                <Button Style="{StaticResource InsideBarBtnStyle }">
-
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="文件对比" VerticalAlignment="Center"></TextBlock>
-                    </StackPanel>
-                </Button>
-                <Menu Background="White">
-                    <MenuItem x:Name="btnPassword" Height="40" Padding="0" Width="auto" BorderThickness="0" >
-                        <MenuItem.Header>
-                            <StackPanel Orientation="Horizontal" Margin="12 0 12 0" VerticalAlignment="Center">
-                                <StackPanel Margin="0,0,8,0" VerticalAlignment="Center">
-                                    <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                                </StackPanel >
-                                <TextBlock x:Name="txtPassword" Padding="0,12,0,0" Text="安全" Height="40" FontSize="12"/>
-                                <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
-                                    <Path.RenderTransform>
-                                        <TranslateTransform X="8"/>
-                                    </Path.RenderTransform>
-                                </Path>
-                            </StackPanel>
-                        </MenuItem.Header>
-                        <MenuItem Name="MenuEncrypt" Style="{StaticResource ToolsMenuStyle }" Command="{Binding SetPasswordCommand}">
-                            <MenuItem.Header>
-                                <TextBlock Text="设置密码" ></TextBlock>
-                            </MenuItem.Header>
-                        </MenuItem>
-                        <MenuItem Name="MenuDecrypt"  Style="{StaticResource ToolsMenuStyle }"  Command="{Binding CancelPasswordCommand}">
-                            <MenuItem.Header>
-                                <TextBlock Text="解除安全性设置"></TextBlock>
-                            </MenuItem.Header>
-                        </MenuItem>
-                    </MenuItem>
-                </Menu>
-                <Button Style="{StaticResource InsideBarBtnStyle }" >
-
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="密文" VerticalAlignment="Center"></TextBlock>
-                        <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
-                            <Path.RenderTransform>
-                                <TranslateTransform X="8"/>
-                            </Path.RenderTransform>
-                        </Path>
-                    </StackPanel>
-                </Button>
-                <Button Style="{StaticResource InsideBarBtnStyle }" >
-
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="水印" VerticalAlignment="Center"></TextBlock>
-                        <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
-                            <Path.RenderTransform>
-                                <TranslateTransform X="8"/>
-                            </Path.RenderTransform>
-                        </Path>
-                    </StackPanel>
-                </Button>
-                <Button Style="{StaticResource InsideBarBtnStyle }" Command="{Binding SetBackgroundCommand }">
-
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="背景" VerticalAlignment="Center"></TextBlock>
-                        <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
-                            <Path.RenderTransform>
-                                <TranslateTransform X="8"/>
-                            </Path.RenderTransform>
-                        </Path>
-                    </StackPanel>
-                </Button>
-                <Button Style="{StaticResource InsideBarBtnStyle }" >
-
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="页眉页脚" VerticalAlignment="Center"></TextBlock>
-                        <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
-                            <Path.RenderTransform>
-                                <TranslateTransform X="8"/>
-                            </Path.RenderTransform>
-                        </Path>
-                    </StackPanel>
-                </Button>
-                <Button Style="{StaticResource InsideBarBtnStyle }" >
-
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="贝茨码" VerticalAlignment="Center"></TextBlock>
-                        <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
-                            <Path.RenderTransform>
-                                <TranslateTransform X="8"/>
-                            </Path.RenderTransform>
-                        </Path>
-                    </StackPanel>
-                </Button>
-                <Button Style="{StaticResource InsideBarBtnStyle }">
-
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                        <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="裁剪" VerticalAlignment="Center"></TextBlock>
-                    </StackPanel>
-                </Button>
-            </WrapPanel>
-        </Border>
-    </Grid>
-</UserControl>
+<UserControl x:Class="PDF_Office.Views.Tools.ToolsBarContent"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/" xmlns:tools="clr-namespace:PDF_Office.ViewModels.Tools" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             prism:ViewModelLocator.AutoWireViewModel="True">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../Styles/CustomBtnStyle.xaml"/>
+                <ResourceDictionary Source="../../Styles/MenuStyle.xaml"/>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <Grid>
+        <Border x:Name="ToolsBorder" BorderBrush="#1A000000" BorderThickness="0,1,0,1" Height="40">
+            <WrapPanel HorizontalAlignment="Center" Height="40">
+                <Button Style="{StaticResource InsideBarBtnStyle }" Command="{Binding CompressCommand}">
+
+                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                        <StackPanel Margin="0,0,8,0">
+                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                        </StackPanel >
+                        <TextBlock Text="压缩" VerticalAlignment="Center"></TextBlock>
+                    </StackPanel>
+                </Button>
+                <Button Style="{StaticResource InsideBarBtnStyle }" >
+
+                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                        <StackPanel Margin="0,0,8,0">
+                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                        </StackPanel >
+                        <TextBlock Text="合并" VerticalAlignment="Center"></TextBlock>
+                    </StackPanel>
+                </Button>
+                <Button Style="{StaticResource InsideBarBtnStyle }">
+
+                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                        <StackPanel Margin="0,0,8,0">
+                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                        </StackPanel >
+                        <TextBlock Text="文件对比" VerticalAlignment="Center"></TextBlock>
+                    </StackPanel>
+                </Button>
+                <Menu Background="White">
+                    <MenuItem x:Name="btnPassword" Height="40" Padding="0" Width="auto" BorderThickness="0" >
+                        <MenuItem.Header>
+                            <StackPanel Orientation="Horizontal" Margin="12 0 12 0" VerticalAlignment="Center">
+                                <StackPanel Margin="0,0,8,0" VerticalAlignment="Center">
+                                    <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                                </StackPanel >
+                                <TextBlock x:Name="txtPassword" Padding="0,12,0,0" Text="安全" Height="40" FontSize="12"/>
+                                <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
+                                    <Path.RenderTransform>
+                                        <TranslateTransform X="8"/>
+                                    </Path.RenderTransform>
+                                </Path>
+                            </StackPanel>
+                        </MenuItem.Header>
+                        <MenuItem Name="MenuEncrypt" Style="{StaticResource ToolsMenuStyle }" Command="{Binding SetPasswordCommand}">
+                            <MenuItem.Header>
+                                <TextBlock Text="设置密码" ></TextBlock>
+                            </MenuItem.Header>
+                        </MenuItem>
+                        <MenuItem Name="MenuDecrypt"  Style="{StaticResource ToolsMenuStyle }"  Command="{Binding CancelPasswordCommand}">
+                            <MenuItem.Header>
+                                <TextBlock Text="解除安全性设置"></TextBlock>
+                            </MenuItem.Header>
+                        </MenuItem>
+                    </MenuItem>
+                </Menu>
+                <Button Style="{StaticResource InsideBarBtnStyle }" >
+
+                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                        <StackPanel Margin="0,0,8,0">
+                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                        </StackPanel >
+                        <TextBlock Text="密文" VerticalAlignment="Center"></TextBlock>
+                        <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
+                            <Path.RenderTransform>
+                                <TranslateTransform X="8"/>
+                            </Path.RenderTransform>
+                        </Path>
+                    </StackPanel>
+                </Button>
+                <Button Name="WatermarkContent" Style="{StaticResource InsideBarBtnStyle }" Command="{Binding SetEditToolsCommand }" CommandParameter="{Binding ElementName=WatermarkContent}">
+
+                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                        <StackPanel Margin="0,0,8,0">
+                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                        </StackPanel >
+                        <TextBlock Text="水印" VerticalAlignment="Center"></TextBlock>
+                        <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
+                            <Path.RenderTransform>
+                                <TranslateTransform X="8"/>
+                            </Path.RenderTransform>
+                        </Path>
+                    </StackPanel>
+                </Button>
+                <Button Name="BackgroundContent" Style="{StaticResource InsideBarBtnStyle }" Command="{Binding SetEditToolsCommand }" CommandParameter="{Binding ElementName=BackgroundContent}">
+
+                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                        <StackPanel Margin="0,0,8,0">
+                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                        </StackPanel >
+                        <TextBlock Text="背景" VerticalAlignment="Center"></TextBlock>
+                        <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
+                            <Path.RenderTransform>
+                                <TranslateTransform X="8"/>
+                            </Path.RenderTransform>
+                        </Path>
+                    </StackPanel>
+                </Button>
+                <Button Style="{StaticResource InsideBarBtnStyle }" >
+
+                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                        <StackPanel Margin="0,0,8,0">
+                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                        </StackPanel >
+                        <TextBlock Text="页眉页脚" VerticalAlignment="Center"></TextBlock>
+                        <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
+                            <Path.RenderTransform>
+                                <TranslateTransform X="8"/>
+                            </Path.RenderTransform>
+                        </Path>
+                    </StackPanel>
+                </Button>
+                <Button Style="{StaticResource InsideBarBtnStyle }" >
+
+                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                        <StackPanel Margin="0,0,8,0">
+                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                        </StackPanel >
+                        <TextBlock Text="贝茨码" VerticalAlignment="Center"></TextBlock>
+                        <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
+                            <Path.RenderTransform>
+                                <TranslateTransform X="8"/>
+                            </Path.RenderTransform>
+                        </Path>
+                    </StackPanel>
+                </Button>
+                <Button Style="{StaticResource InsideBarBtnStyle }">
+
+                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                        <StackPanel Margin="0,0,8,0">
+                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
+                        </StackPanel >
+                        <TextBlock Text="裁剪" VerticalAlignment="Center"></TextBlock>
+                    </StackPanel>
+                </Button>
+            </WrapPanel>
+        </Border>
+    </Grid>
+</UserControl>

File diff suppressed because it is too large
+ 58 - 64
PDF Office/Views/ViewContent.xaml