liyijie 2 anni fa
parent
commit
4b23bebb8b
26 ha cambiato i file con 3282 aggiunte e 270 eliminazioni
  1. 4 0
      PDF Office/App.xaml.cs
  2. 2 2
      PDF Office/CustomControl/WritableComboBox.xaml
  3. 32 0
      PDF Office/PDF Office.csproj
  4. 2 2
      PDF Office/SDKLisence.xml
  5. 2 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundDialogViewModel.cs
  6. 718 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContentViewModel.cs
  7. 82 17
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesDialogViewModel.cs
  8. 229 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesTemplateListContentViewModel.cs
  9. 730 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterCreateContentViewModel.cs
  10. 83 6
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterDialogViewModel.cs
  11. 225 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterTemplateListContentViewModel.cs
  12. 2 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkDialogViewModel.cs
  13. 262 231
      PDF Office/ViewModels/HomePanel/PDFTools/QuickToolsContentViewModel.cs
  14. 8 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundDialog.xaml
  15. 182 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContent.xaml
  16. 40 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContent.xaml.cs
  17. 13 4
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesDialog.xaml
  18. 128 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesTemplateListContent.xaml
  19. 83 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesTemplateListContent.xaml.cs
  20. 170 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterCreateContent.xaml
  21. 48 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterCreateContent.xaml.cs
  22. 13 4
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterDialog.xaml
  23. 129 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterTemplateListContent.xaml
  24. 84 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterTemplateListContent.xaml.cs
  25. 8 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkDialog.xaml
  26. 3 3
      PDF Office/Views/EditTools/HeaderFooter/HeaderFooterCreateContent.xaml

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

@@ -174,7 +174,11 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<HomePageSetPasswordDialog>();
             containerRegistry.RegisterForNavigation<HomePageRemoveDialog>();
             containerRegistry.RegisterForNavigation<HomePageHeaderFooterDialog>();
+            containerRegistry.RegisterForNavigation<HomePageHeaderFooterTemplateListContent>();
+            containerRegistry.RegisterForNavigation<HomePageHeaderFooterCreateContent>();
             containerRegistry.RegisterForNavigation<HomePageBatesDialog>();
+            containerRegistry.RegisterForNavigation<HomePageBatesTemplateListContent>();
+            containerRegistry.RegisterForNavigation<HomePageBatesCreateContent>();
             containerRegistry.RegisterForNavigation<HomePageBackgroundDialog>();
             containerRegistry.RegisterForNavigation<HomePageWatermarkDialog>();
             containerRegistry.RegisterForNavigation<ConverterBarContent>();

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

@@ -5,7 +5,7 @@
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:local="clr-namespace:PDF_Office.CustomControl"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    d:DesignHeight="32"
+    d:DesignHeight="24"
     d:DesignWidth="200"
     mc:Ignorable="d">
     <Grid>
@@ -15,7 +15,7 @@
             x:Name="writableComboBox"
             Grid.Column="1"
             MinWidth="58"
-            MinHeight="32"
+            MinHeight="24"
             VerticalContentAlignment="Center"
             SelectionChanged="writableComboBox_SelectionChanged"
             SelectedIndex="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBox}, Path=SelectedIndex}"

+ 32 - 0
PDF Office/PDF Office.csproj

@@ -425,6 +425,10 @@
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBates\HomePageBatesDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageHeaderFooter\HomePageHeaderFooterDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageWatermark\HomePageWatermarkDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageHeaderFooter\HomePageHeaderFooterCreateContentViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageHeaderFooter\HomePageHeaderFooterTemplateListContentViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBates\HomePageBatesCreateContentViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBates\HomePageBatesTemplateListContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\PDFTools\PDFToolsContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\PDFTools\QuickToolsContentViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\SignatureAnnotPropertyViewModel.cs" />
@@ -565,6 +569,18 @@
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBackground\HomePageBackgroundDialog.xaml.cs">
       <DependentUpon>HomePageBackgroundDialog.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBates\HomePageBatesCreateContent.xaml.cs">
+      <DependentUpon>HomePageBatesCreateContent.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBates\HomePageBatesTemplateListContent.xaml.cs">
+      <DependentUpon>HomePageBatesTemplateListContent.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageHeaderFooter\HomePageHeaderFooterCreateContent.xaml.cs">
+      <DependentUpon>HomePageHeaderFooterCreateContent.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageHeaderFooter\HomePageHeaderFooterTemplateListContent.xaml.cs">
+      <DependentUpon>HomePageHeaderFooterTemplateListContent.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBatchProcessingDialog.xaml.cs">
       <DependentUpon>HomePageBatchProcessingDialog.xaml</DependentUpon>
     </Compile>
@@ -1132,6 +1148,22 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBates\HomePageBatesCreateContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBates\HomePageBatesTemplateListContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageHeaderFooter\HomePageHeaderFooterCreateContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageHeaderFooter\HomePageHeaderFooterTemplateListContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageBatchProcessing\HomePageBatchProcessingDialog.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 2 - 2
PDF Office/SDKLisence.xml

@@ -3,8 +3,8 @@
     devSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4gQurxTxGuBlGAhs0P1mD3X3bHT+AHfcLiymaqE4DY7kTFHoPs9I3tl5ErS+BHdzHRhrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1367/WkJ00tM7U7tttD6cfaiHpW8pgW2aur3AxuQIBBLuJD5gcmNxTYW3KA32JLG8alfyXjKFVS3gka9bngvwfZ7GuNXybjKlmz1tnN6iVHpnbSj+xOHhWEperY4HHrSg=="
 	userKey = "iBPRM/Tz8b6Z1G2GQt52X7hiNCGfVYXztnPjalgrgARvqfKV6lFNH8QeScTzBRYI8GGFpwelfgh790Kd9JmL7V4adI1jCiFHUT2DLT7QucxY5Nkgys2aJItQS482Ck2G2Xf8gNgojxYxRt65o/MEzkj93foj8qIdfHagXsSorSs="
 	userSecret="mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4ivEHOmPIqbfhpDnKKj+7Ymj2rXQvfZRmke06HMV+3tt064G64WjPW8+EbGCNZaAh1hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1FKJi6HYB+DuugQyaqI2prfej861QnJrU4s2T/npZK/"
-	ConverterDevKey="Eahwo7OZAYHJaCF7TJQYKSVqC62MzfBdllVXnC5BRR5BQFDKnQ1FJtCRVdug+VNg/ti+/DeA5Sq4IH2CBpQjAZst5705uk5Sz0ZwRu8Qdn9HFGwh2pG6dJEIrl7lOccoZS6+1IxgOTcTeHqYpym3NsmtbhBWE848Pvme3scpW28="
-	ConverterDevSecret="mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iccr16WMBclnQACarlyblNUvAm/S8uFbhXMvxwgBSgULSsrbuyF/SIZ3I+dl0qU8EiR4IKrcJxus3VRNu+jx8P7CGq2BlSjPVXRHBI1lV8ukpCIUGmcK+P+Z0QbYdkAHAm6NPgs2c4tp1jOFPPbnUkTtX7riDb9xRCx1YNm3/+xd96PzrVCcmtTizZP+elkr8="
+	ConverterDevKey="ErjZKxcU3SPvUohGZo0CBgy0XdkAsZqUYqCTbfn1AYsCQ6mxCucx61UPqLT7MDQ0n+5/oKnWY9SSk8Xv5pJtYYHD87HRdYNG+QNCaoPGHulyfVxGllmzU71U7WjflfZBFvhg/UQOFiz3OsAVKz4k2YkXPzQgNaS3glym42PVpj4="
+	ConverterDevSecret="mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iYfqdItiFUaR9LVjsPTUXicGXjRTJz0NHg67bO82qMNdkuY0NReKpg+S1SkS2QdEScM/fgvvcctF5rcqYAH1dpMv7C2jvq4o0q6sQtN3jR47j9bjclgv4TJTahQMmvDDLtOGD99YkYWB6rt/zU8htEYkwcNWVMyYvggPV2rTFvfawopGIC034QzjthmhwwX90="
 	ConverterUserkey=" WLUHzXhndQKyrTJVzvZ+dvPXDQDZeJpcSvklX3GJwRX4+urd8eQskYgbeCf0NXLZ/qJkS/k10x+qGad34i4v5rI/ASFIx901c/Nw5C0YJMH7X87dib141tdAmSmQhnKLO5TBi4FiAidboyvnLFLrYGMmS2kLQOXFPwPj5zQUv5A="
 	ConverterUserSecret="mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iK16EcneqBPRe2eKQLuJXpA79IONX9GVI/Ap3uWzMcNWaitc2UB6gDeexJXFPVaXOFAoV6NtcUJC8skonXVk7k/oKTJGcYKLPGdXenrzHolQ=="
 	>

+ 2 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundDialogViewModel.cs

@@ -134,6 +134,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageBackgroundDialogViewModel(IRegionManager backgroundRegion)
         {
             PDFDataTable.Columns.Add("FileName");
+            PDFDataTable.Columns.Add("FilePageRangeText");
+            PDFDataTable.Columns.Add("FilePageRangeSelectIndex");
             PDFDataTable.Columns.Add("FileSize");
             PDFDataTable.Columns.Add("FileState");
             ADDPDFCommand = new DelegateCommand(addpicture);

+ 718 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContentViewModel.cs

@@ -0,0 +1,718 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.EventAggregators;
+using PDF_Office.Helper;
+using PDF_Office.Model.EditTools.Bates;
+using PDF_Office.Model;
+using PDF_Office.Properties;
+using PDFSettings;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Windows.Media;
+using System.Windows;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBates
+{
+    public class HomePageBatesCreateContentViewModel : BindableBase, INavigationAware
+    {
+        private CPDFViewer PDFViewer;
+
+        public BatesInfo BatesInfo = new BatesInfo();
+
+        public BatesHeaderFooterItem TemplateBatesItem;
+
+        public enum EnumCreateOrEdit
+        {
+            None,
+            StatusCreate,
+            StatusEdit
+        }
+
+        private List<string> _fontNameList = new List<string>();
+        public List<string> FontNameList
+        {
+            get { return _fontNameList; }
+            set
+            {
+                SetProperty(ref _fontNameList, value);
+            }
+        }
+
+        private void InitFontNameList()
+        {
+            FontNameList.Clear();
+            FontNameList.Add("Courier");
+            FontNameList.Add("Courier-Bold");
+            FontNameList.Add("Courier-Oblique");
+            FontNameList.Add("Courier-BoldOblique");
+            FontNameList.Add("Helvetica");
+            FontNameList.Add("Helvetica-Bold");
+            FontNameList.Add("Helvetica-Oblique");
+            FontNameList.Add("Helvetica-BoldOblique");
+            FontNameList.Add("Times-Roman");
+            FontNameList.Add("Times-Bold");
+            FontNameList.Add("Times-Italic");
+            FontNameList.Add("Times-BoldItalic");
+        }
+
+        private int _fontNameSelectedIndex = 0;
+        public int FontNameSelectedIndex
+        {
+            get { return _fontNameSelectedIndex; }
+            set
+            {
+                SetProperty(ref _fontNameSelectedIndex, value);
+                SetFontName(FontNameSelectedIndex);
+                
+
+            }
+        }
+
+        private List<string> _fontSizeList = new List<string>();
+        public List<string> FontSizeList
+        {
+            get { return _fontSizeList; }
+            set
+            {
+                SetProperty(ref _fontSizeList, value);
+            }
+        }
+
+        private void InitFontSizeList()
+        {
+            FontSizeList.Clear();
+            for (int temp = 10; temp <= 15; temp += 1)
+            {
+                FontSizeList.Add(temp.ToString() + "pt");
+            }
+        }
+
+        private int _fontSizeSelectedIndex = 0;
+        public int FontSizeSelectedIndex
+        {
+            get { return _fontSizeSelectedIndex; }
+            set
+            {
+                SetProperty(ref _fontSizeSelectedIndex, value);
+                SetFontSize(FontSizeSelectedIndex);
+                
+            }
+        }
+
+        private List<string> _starPagetNumberList = new List<string>();
+        public List<string> StarPagetNumberList
+        {
+            get { return _starPagetNumberList; }
+            set
+            {
+                SetProperty(ref _starPagetNumberList, value);
+            }
+        }
+
+        private void InitStarPagetNumberList()
+        {
+            StarPagetNumberList.Clear();
+            for (int temp = 10; temp <= 15; temp += 1)
+            {
+                StarPagetNumberList.Add(temp.ToString());
+            }
+        }
+
+        private int _starPagetNumberIndex = 0;
+        public int StarPagetNumberIndex
+        {
+            get { return _starPagetNumberIndex; }
+            set
+            {
+                SetProperty(ref _starPagetNumberIndex, value);
+                SetStarPagetNumber(StarPagetNumberIndex);
+            }
+        }
+
+        public string _pageRangeText = "0";
+        public string PageRangeText
+        {
+            get { return _pageRangeText; }
+            set
+            {
+                _pageRangeText = value;
+                //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref BatesInfo.PageRange, PageRangeText);
+                
+            }
+        }
+
+        private int _pageRangeSelectIndex = 0;
+        public int PageRangeSelectIndex
+        {
+            get { return _pageRangeSelectIndex; }
+            set
+            {
+                SetProperty(ref _pageRangeSelectIndex, value);
+                BatesInfo.PageRangeIndex = PageRangeSelectIndex;
+                //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref BatesInfo.PageRange, PageRangeText);
+                
+            }
+        }
+
+        private SolidColorBrush _solidColorBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x00, 0x00));
+        public SolidColorBrush SolidColorBrush
+        {
+            get
+            {
+                return _solidColorBrush;
+            }
+            set
+            {
+
+                SetProperty(ref _solidColorBrush, value);
+
+            }
+        }
+
+        private Color _stringColor = Color.FromArgb(0xFF, 0xFF, 0x00, 0x00);
+        public Color StringColor
+        {
+            get
+            {
+                return _stringColor;
+            }
+            set
+            {
+                SetProperty(ref _stringColor, value);
+                SolidColorBrush = new SolidColorBrush(StringColor);
+                for (int i = 0; i <= 5; i++)
+                {
+                    BatesInfo.TextData[i].Color = EditToolsHelper.ConvertColor(value);
+                }
+                
+
+            }
+        }
+
+
+        private EnumCreateOrEdit _createOrEdit;
+        public EnumCreateOrEdit CreateOrEdit
+        {
+            get { return _createOrEdit; }
+            set
+            {
+                _createOrEdit = value;
+                if (value == EnumCreateOrEdit.StatusEdit)
+                {
+                    EditBaseVisible = Visibility.Visible;
+                    CreateBaseVisible = Visibility.Collapsed;
+                }
+                else if (value == EnumCreateOrEdit.StatusCreate)
+                {
+                    CreateBaseVisible = Visibility.Visible;
+                    EditBaseVisible = Visibility.Collapsed;
+                }
+            }
+        }
+
+        private Visibility _createBaseVisible;
+        public Visibility CreateBaseVisible
+        {
+            get => _createBaseVisible;
+            set => SetProperty(ref _createBaseVisible, value);
+        }
+
+        private Visibility _editBaseVisible;
+        public Visibility EditBaseVisible
+        {
+            get => _editBaseVisible;
+            set => SetProperty(ref _editBaseVisible, value);
+        }
+
+        private string _marginTopValue = "3";
+        public string MarginTopValue
+        {
+            get { return _marginTopValue; }
+            set
+            {
+                SetProperty(ref _marginTopValue, value);
+                bool ValueEQ = true;
+                if (BatesInfo.margin[1] == float.Parse(MarginTopValue))
+                {
+                    ValueEQ = false;
+                }
+                BatesInfo.margin[1] = float.Parse(MarginTopValue);
+                if (ValueEQ)
+                {
+                    
+                }
+            }
+        }
+
+        private string _marginDownValue = "3";
+        public string MarginDownValue
+        {
+            get { return _marginDownValue; }
+            set
+            {
+                SetProperty(ref _marginDownValue, value);
+                bool ValueEQ = true;
+                if (BatesInfo.margin[3] == float.Parse(MarginTopValue))
+                {
+                    ValueEQ = false;
+                }
+                BatesInfo.margin[3] = float.Parse(MarginDownValue);
+                if (ValueEQ)
+                {
+                    
+                }
+            }
+        }
+
+        private string _marginLeftValue = "3";
+        public string MarginLeftValue
+        {
+            get { return _marginLeftValue; }
+            set
+            {
+                SetProperty(ref _marginLeftValue, value);
+                bool ValueEQ = true;
+                if (BatesInfo.margin[0] == float.Parse(MarginTopValue))
+                {
+                    ValueEQ = false;
+                }
+                BatesInfo.margin[0] = float.Parse(MarginLeftValue);
+                if (ValueEQ)
+                {
+                    
+                }
+            }
+        }
+
+        private string _marginRightValue = "3";
+        public string MarginRightValue
+        {
+            get { return _marginRightValue; }
+            set
+            {
+                SetProperty(ref _marginRightValue, value);
+                bool ValueEQ = true;
+                if (BatesInfo.margin[2] == float.Parse(MarginTopValue))
+                {
+                    ValueEQ = false;
+                }
+                if (ValueEQ)
+                {
+                    BatesInfo.margin[2] = float.Parse(MarginRightValue);
+                    
+                }
+            }
+        }
+
+        private string _digitNumberValue = "1";
+        public string DigitNumberValue
+        {
+            get { return _digitNumberValue; }
+            set
+            {
+                SetProperty(ref _digitNumberValue, value);
+                BatesInfo.DigitNumber = int.Parse(DigitNumberValue);
+            }
+        }
+
+
+        private string _textValue = "";
+        public string TextValue
+        {
+            get { return _textValue; }
+            set
+            {
+                SetProperty(ref _textValue, value);
+            }
+        }
+
+
+        private string _prefixTextValue = "";
+        public string PrefixTextValue
+        {
+            get { return _prefixTextValue; }
+            set
+            {
+
+                _prefixTextValue = value;
+
+            }
+        }
+
+        private string _surfixTextValue = "";
+        public string SurfixTextValue
+        {
+            get { return _surfixTextValue; }
+            set
+            {
+                _surfixTextValue = value;
+            }
+        }
+
+        public int GetLocationIndex = 0;
+
+        private Dictionary<string, string> _getTextValueFromNumber = new Dictionary<string, string>();
+        public Dictionary<string, string> GetTextValueFromNumber
+        {
+            get { return _getTextValueFromNumber; }
+            set
+            {
+                _getTextValueFromNumber = value;
+            }
+        }
+
+        public IEventAggregator eventAggregator;
+
+        public DelegateCommand<object> ChangeLocationCommand { get; set; }
+        public DelegateCommand EnterTemplateListCommand { get; set; }
+        public DelegateCommand SaveToTemplateListCommand { get; set; }
+        public DelegateCommand SaveToCurrentTemplateListCommand { get; set; }
+        public DelegateCommand<object> SelectedColorChangedCommand { get; set; }
+        public DelegateCommand<object> TextValueChangedCommand { get; set; }
+        public DelegateCommand ADDBatesCommand { get; set; }
+
+        public string Unicode = null;
+
+        public HomePageBatesCreateContentViewModel(IEventAggregator eventAggregator)
+        {
+            this.eventAggregator = eventAggregator;
+            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
+            for (int i = 0; i <= 5; i++)
+            {
+                BatesInfo.TextData[i].Color = EditToolsHelper.ConvertColor(Color.FromArgb(0xFF, 0xFF, 0x00, 0x00));
+            }
+            InitList();
+            InitBatesInfo();
+            ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
+            SelectedColorChangedCommand = new DelegateCommand<object>(ChangedColor);
+            EnterTemplateListCommand = new DelegateCommand(EnterTemplateList);
+            SaveToTemplateListCommand = new DelegateCommand(SaveToTemplateList);
+            SaveToCurrentTemplateListCommand = new DelegateCommand(SaveToCurrentTemplateList);
+            TextValueChangedCommand = new DelegateCommand<object>(TextValueChanged);
+            ADDBatesCommand = new DelegateCommand(ADDBates);
+        }
+
+        private void InitList()
+        {
+
+            InitFontNameList();
+            InitFontSizeList();
+            InitStarPagetNumberList();
+            InitLocationButtonMatrix();
+
+        }
+
+        private void InitLocationButtonMatrix()
+        {
+            GetTextValueFromNumber.Clear();
+            for (var temp = 0; temp <= 5; temp++)
+            {
+                GetTextValueFromNumber.Add(temp.ToString(), temp.ToString());
+            }
+        }
+
+        private void InitBatesInfo()
+        {
+            for (int i = 0; i <= 5; i++)
+            {
+                BatesInfo.TextData[i].text = GetTextValueFromNumber[i.ToString()];
+            }
+            BatesInfo.margin[0] = float.Parse(MarginTopValue);
+            BatesInfo.margin[1] = float.Parse(MarginRightValue);
+            BatesInfo.margin[2] = float.Parse(MarginDownValue);
+            BatesInfo.margin[3] = float.Parse(MarginLeftValue);
+            BatesInfo.Prefix = PrefixTextValue;
+            BatesInfo.Suffix = SurfixTextValue;
+            BatesInfo.DigitNumber = int.Parse(DigitNumberValue);
+            SetFontName(FontNameSelectedIndex);
+            SetFontSize(FontSizeSelectedIndex);
+            SetStarPagetNumber(StarPagetNumberIndex);
+            StringColor = Color.FromArgb(0xFF, 0xFF, 0x00, 0x00);
+        }
+
+        private void SetFontName(int Index)
+        {
+            for (int i = 0; i <= 5; i++) { BatesInfo.TextData[i].fontName = FontNameList[Index]; }
+        }
+
+        private void SetFontSize(int Index)
+        {
+            for (int i = 0; i <= 5; i++) { BatesInfo.TextData[i].fontSize = (Index + 7) * 1.33f; }
+        }
+
+        private void SetStarPagetNumber(int Index)
+        {
+            BatesInfo.StarPagetNumber = Index;
+        }
+
+
+        public void ChangeLocation(object e)
+        {
+            string args = e as string;
+            if (args != null)
+            {
+                GetLocationIndex = int.Parse(args);
+                TextValue = GetTextValueFromNumber[args];
+
+            }
+        }
+
+        private void ChangedColor(object obj)
+        {
+            if (obj != null)
+            {
+                var colorValue = (Color)obj;
+                if (colorValue != null)
+                {
+
+                    StringColor = colorValue;
+                }
+            }
+        }
+
+        public void EnterTemplateList()
+        {
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode { Unicode = Unicode, Status = EnumTemplateListOrCreate.StatusTemplate });
+        }
+
+        public void SaveToTemplateList()
+        {
+            SaveCurrentTemplate();
+        }
+
+        public void SaveToCurrentTemplateList()
+        {
+            ConfirmEditBackgroundTemplateItem();
+        }
+
+        private void TextValueChanged(object obj)
+        {
+            if (obj != null)
+            {
+                var textValue = obj as System.Windows.Controls.TextBox;
+                if (textValue != null)
+                {
+                    bool TextEQ = true;
+                    switch (textValue.Name)
+                    {
+                        case "TextValueTextBox":
+
+                            if (GetTextValueFromNumber[GetLocationIndex.ToString()] == textValue.Text)
+                            {
+                                TextEQ = false;
+                            }
+                            GetTextValueFromNumber[GetLocationIndex.ToString()] = textValue.Text;
+                            BatesInfo.TextData[GetLocationIndex].text = GetTextValueFromNumber[GetLocationIndex.ToString()];
+
+                            break;
+                        case "PrefixTextValueTextBox":
+                            if (BatesInfo.Prefix == textValue.Text)
+                            {
+                                TextEQ = false;
+                            }
+                            BatesInfo.Prefix = textValue.Text;
+
+                            break;
+                        case "SuffixTextValueTextBox":
+                            if (BatesInfo.Suffix == textValue.Text)
+                            {
+                                TextEQ = false;
+                            }
+                            BatesInfo.Suffix = textValue.Text;
+                            break;
+                        default:
+                            break;
+                    }
+                    if (TextEQ)
+                    {
+                        
+                    }
+
+                }
+            }
+        }
+
+        public void ADDBates()
+        {
+            if (PrefixTextValue == "" || SurfixTextValue == "")
+            {
+                if (SurfixTextValue == "" && PrefixTextValue == "")
+                {
+                    GetTextValueFromNumber[GetLocationIndex.ToString()] = GetTextValueFromNumber[GetLocationIndex.ToString()] + "<<" + "#" + DigitNumberValue + "#" + (StarPagetNumberIndex + 1).ToString() + ">>";
+                }
+                else if (SurfixTextValue == "")
+                {
+                    GetTextValueFromNumber[GetLocationIndex.ToString()] = GetTextValueFromNumber[GetLocationIndex.ToString()] + "<<" + "#" + DigitNumberValue + "#" + (StarPagetNumberIndex + 1).ToString() + "#" + PrefixTextValue + ">>";
+                }
+                else
+                {
+                    GetTextValueFromNumber[GetLocationIndex.ToString()] = GetTextValueFromNumber[GetLocationIndex.ToString()] + "<<" + "#" + DigitNumberValue + "#" + (StarPagetNumberIndex + 1).ToString() + "#" + "#" + SurfixTextValue + ">>";
+                }
+            }
+            else
+            {
+                GetTextValueFromNumber[GetLocationIndex.ToString()] = GetTextValueFromNumber[GetLocationIndex.ToString()] + "<<" + "#" + DigitNumberValue + "#" + (StarPagetNumberIndex + 1).ToString() + "#" + PrefixTextValue + "#" + SurfixTextValue + ">>";
+            }
+            BatesInfo.TextData[GetLocationIndex].text = GetTextValueFromNumber[GetLocationIndex.ToString()];
+            
+        }
+
+        public void ConvertInfoToItem(ref BatesHeaderFooterItem batesItem, BatesInfo batesInfo)
+        {
+            batesItem.TextData = batesInfo.TextData;
+            batesItem.DigitNumber = batesInfo.DigitNumber;
+            batesItem.ItemName = batesInfo.ItemName;
+            batesItem.Prefix = batesInfo.Prefix;
+            batesItem.Suffix = batesInfo.Suffix;
+            batesItem.StarPagetNumber = batesInfo.StarPagetNumber;
+            batesItem.margin = batesInfo.margin;
+            batesItem.PageRange = batesInfo.PageRange;
+            batesItem.PageRangeIndex = batesInfo.PageRangeIndex;
+
+        }
+
+        public void ConvertItemToInfo(BatesHeaderFooterItem batesItem, ref BatesInfo batesInfo)
+        {
+            batesInfo.TextData = batesItem.TextData;
+            batesInfo.ItemName = batesItem.ItemName;
+            batesInfo.DigitNumber = batesItem.DigitNumber;
+            batesInfo.Prefix = batesItem.Prefix;
+            batesInfo.Suffix = batesItem.Suffix;
+            batesInfo.StarPagetNumber = batesItem.StarPagetNumber;
+            batesInfo.margin = batesItem.margin;
+            batesInfo.PageRangeIndex = batesItem.PageRangeIndex;
+            //EditToolsHelper.GetPageRange(batesInfo.PageRangeIndex, PDFViewer.Document, ref batesInfo.PageRange, batesItem.PageRange);
+
+        }
+
+        public void SaveCurrentTemplate()
+        {
+            var batesItem = new BatesHeaderFooterItem();
+            ConvertInfoToItem(ref batesItem, BatesInfo);
+            batesItem.ItemName += Settings.Default.BatesTemplateList.Count().ToString();
+            try
+            {
+                //创建缓存文件夹
+                string folderPath = Path.Combine(App.CurrentPath, "Bates");
+                //有可能因为其他原因存在同名文件,导致创建文件夹失败,需要先删除同名文件
+                //保险措施(猜测)
+                if (File.Exists(folderPath))
+                {
+                    File.Delete(folderPath);
+                }
+
+                DirectoryInfo tempfolder = new DirectoryInfo(folderPath);
+                if (!tempfolder.Exists)
+                {
+                    tempfolder.Create();
+                }
+                //预览图缓存
+                string saveName = Guid.NewGuid().ToString();
+                string savePath = Path.Combine(folderPath, saveName);
+                Settings.Default.BatesTemplateList.Add(batesItem);
+                Settings.Default.Save();
+            }
+            catch
+            {
+
+            }
+
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode
+            {
+                Unicode = Unicode,
+                Status = EnumTemplateListOrCreate.StatusTemplate
+            });
+        }
+
+        public void ConfirmEditBackgroundTemplateItem()
+        {
+
+            var batesItem = new BatesHeaderFooterItem();
+            ConvertInfoToItem(ref batesItem, BatesInfo);
+            try
+            {
+                //创建缓存文件夹
+                string folderPath = Path.Combine(App.CurrentPath, "Background");
+                //有可能因为其他原因存在同名文件,导致创建文件夹失败,需要先删除同名文件
+                //保险措施(猜测)
+                if (File.Exists(folderPath))
+                {
+                    File.Delete(folderPath);
+                }
+
+                DirectoryInfo tempfolder = new DirectoryInfo(folderPath);
+                if (!tempfolder.Exists)
+                {
+                    tempfolder.Create();
+                }
+                Settings.Default.BatesTemplateList[TemplateBatesItem.listIndex] = batesItem;
+                Settings.Default.Save();
+            }
+            catch
+            {
+
+            }
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode
+            {
+                Unicode = Unicode,
+                Status = EnumTemplateListOrCreate.StatusTemplate
+            });
+
+        }
+
+        public void InitComponentBySelectedInfo()
+        {
+            ConvertItemToInfo(TemplateBatesItem, ref BatesInfo);
+            for (int i = 0; i <= 5; i++)
+            {
+                GetTextValueFromNumber[i.ToString()] = BatesInfo.TextData[i].text;
+            }
+            MarginTopValue = BatesInfo.margin[0].ToString();
+            MarginRightValue = BatesInfo.margin[1].ToString();
+            MarginDownValue = BatesInfo.margin[2].ToString();
+            MarginLeftValue = BatesInfo.margin[3].ToString();
+            PrefixTextValue = BatesInfo.Prefix;
+            SurfixTextValue = BatesInfo.Suffix;
+            DigitNumberValue = BatesInfo.DigitNumber.ToString();
+            FontNameSelectedIndex = FontNameList.IndexOf(BatesInfo.TextData[0].fontName);
+            FontSizeSelectedIndex = FontSizeList.IndexOf(BatesInfo.TextData[0].fontSize.ToString());
+            StarPagetNumberIndex = StarPagetNumberList.IndexOf(BatesInfo.StarPagetNumber.ToString());
+            StringColor = EditToolsHelper.ConvertColor(BatesInfo.TextData[0].Color);
+            SolidColorBrush = new SolidColorBrush(StringColor);
+            PageRangeSelectIndex = BatesInfo.PageRangeIndex;
+        }
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref BatesInfo.PageRange, PageRangeText);
+
+            if (navigationContext.Parameters.TryGetValue<BatesHeaderFooterItem>("BatesItem", out TemplateBatesItem))
+            {
+                CreateOrEdit = EnumCreateOrEdit.StatusEdit;
+                InitComponentBySelectedInfo();
+            }
+            else
+            {
+                CreateOrEdit = EnumCreateOrEdit.StatusCreate;
+            }
+        }
+
+
+    }
+}
+

+ 82 - 17
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesDialogViewModel.cs

@@ -14,6 +14,10 @@ using System.Linq;
 using PDF_Office.Helper;
 using System.Windows;
 using System.Windows.Forms;
+using ComPDFKitViewer.PdfViewer;
+using Prism.Events;
+using PDF_Office.EventAggregators;
+using PDFSettings;
 
 namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBates
 {
@@ -27,12 +31,44 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public string PageNumber = "";
 
-        public IRegionManager BatesRegion;
+        public IEventAggregator eventAggregator;
+        public IRegionManager batesRegion;
+
+        private CPDFViewer PDFViewer;
+
+        private ViewContentViewModel viewContentViewModel;
+
+        public string TemplateListName = "HomePageBatesTemplateListContent";
+        public string CreateName = "HomePageBatesCreateContent";
+
+        public string BatesDocumentName = "HomePageBatesDocumentContent";
+
+        public string BatesType = "HomePageBatesType";
 
         public List<int> fileNamesView = new List<int>();
 
         private int fileNamesIndex = 0;
 
+        private string _batesSettingsRegionName;
+        /// <summary>
+        /// 属性设置Region
+        /// </summary>
+        public string BatesSettingsRegionName
+        {
+            get { return _batesSettingsRegionName; }
+            set { _batesSettingsRegionName = value; }
+        }
+
+        private Visibility _batesSettingsVisible = Visibility.Visible;
+        /// <summary>
+        /// 属性设置Region可见
+        /// </summary>
+        public Visibility BatesSettingsVisible
+        {
+            get { return _batesSettingsVisible; }
+            set { _batesSettingsVisible = value; }
+        }
+
         private string batesGridIsEnabled = "True";
         public string BatesGridIsEnabled
         {
@@ -89,19 +125,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
         }
 
-        private string batesRegionName;
-        public string BatesRegionName
-        {
-            get
-            {
-                return batesRegionName;
-            }
-            set
-            {
-                SetProperty(ref batesRegionName, value);
-            }
-        }
-
         private Visibility batesVisible = Visibility.Collapsed;
         public Visibility BatesVisible
         {
@@ -131,20 +154,58 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public DelegateCommand ADDPDFFilesCommand { get; set; }
         #endregion
-        public HomePageBatesDialogViewModel(IRegionManager batesRegion)
+
+        public string Unicode = null;
+
+        public HomePageBatesDialogViewModel(IRegionManager batesRegion, IEventAggregator eventAggregator)
         {
+            this.eventAggregator = eventAggregator;
+            this.batesRegion = batesRegion;
+            BatesSettingsRegionName = Guid.NewGuid().ToString();
+            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             PDFDataTable.Columns.Add("FileName");
+            PDFDataTable.Columns.Add("FilePageRangeText");
+            PDFDataTable.Columns.Add("FilePageRangeSelectIndex");
             PDFDataTable.Columns.Add("FileSize");
             PDFDataTable.Columns.Add("FileState");
             ADDPDFCommand = new DelegateCommand(addpicture);
             ADDPDFFilesCommand = new DelegateCommand(addpicturefiles);
             RemovePDFFileCommand = new DelegateCommand(removepdffile);
             CreateCommand = new DelegateCommand(create);
-            BatesRegion = batesRegion;
-            BatesRegionName = Guid.NewGuid().ToString();
+            eventAggregator.GetEvent<EditBatesHeaderFooterTemplateItemEvent>().Subscribe(EditBatesTemplateItem, e => e.Unicode == Unicode && e.Type == BatesType);
+            eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Subscribe(EnterTemplateListOrCreate, e => e.Unicode == Unicode);
         }
         #region 逻辑函数
+        public void EditBatesTemplateItem(BatesHeaderFooterItemUnicode batesItemunicode)
+        {
+            BatesHeaderFooterItem batesItem = batesItemunicode.Status;
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, PDFViewer);
+            param.Add("BatesItem", batesItem);
+            batesRegion.RequestNavigate(BatesSettingsRegionName, CreateName, param);
+            BatesSettingsVisible = Visibility.Visible;
+        }
 
+        public void EnterTemplateListOrCreate(EnumTemplateListOrCreateUnicode enumTemplateListOrCreateunicode)
+        {
+            EnumTemplateListOrCreate enumTemplateListOrCreate = enumTemplateListOrCreateunicode.Status;
+            if (enumTemplateListOrCreate == EnumTemplateListOrCreate.StatusTemplate)
+            {
+                EnterSelectedContent(TemplateListName);
+            }
+            else
+            {
+                EnterSelectedContent(CreateName);
+            }
+        }
+
+        public void EnterSelectedContent(string SelectedContentName)
+        {
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, PDFViewer);
+            batesRegion.RequestNavigate(BatesSettingsRegionName, SelectedContentName, param);
+            BatesSettingsVisible = Visibility.Visible;
+        }
 
         private void create()
         {
@@ -333,12 +394,16 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             List<string> filepath = new List<string>();
+            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            
             navigationContext.Parameters.TryGetValue<List<string>>(ParameterNames.FilePath, out filepath);
             if (filepath != null)
             {
                 fileNames = filepath;
                 PDFFileCount();
                 updateListview("待确定");
+                EnterSelectedContent(TemplateListName);
             }
         }
 

+ 229 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesTemplateListContentViewModel.cs

@@ -0,0 +1,229 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.EventAggregators;
+using PDF_Office.Helper;
+using PDF_Office.Model.EditTools.Bates;
+using PDF_Office.Model;
+using PDF_Office.Properties;
+using PDFSettings;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Windows.Controls;
+using System.Windows;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBates
+{
+    public class HomePageBatesTemplateListContentViewModel : BindableBase, INavigationAware
+    {
+        private CPDFViewer PDFViewer;
+        public IEventAggregator eventAggregator;
+        public BatesInfo BatesInfo = new BatesInfo();
+        public BatesHeaderFooterItem BatesItem = new BatesHeaderFooterItem();
+        public int TemplateIndex = 0;
+
+        private ObservableCollection<BatesHeaderFooterItem> batesModCollection = new ObservableCollection<BatesHeaderFooterItem>();
+        public ObservableCollection<BatesHeaderFooterItem> BatesModCollection
+        {
+            get { return batesModCollection; }
+            set
+            {
+                batesModCollection = value;
+                RaisePropertyChanged();
+            }
+        }
+
+        private Visibility _createTemplateVisible;
+        public Visibility CreateTemplateVisible
+        {
+            get { return _createTemplateVisible; }
+            set { SetProperty(ref _createTemplateVisible, value); }
+        }
+
+        public DelegateCommand AddTemplateCommand { get; set; }
+        public DelegateCommand<object> DeleteTemplateItemCommand { get; set; }
+        public DelegateCommand<object> EditTemplateItemCommand { get; set; }
+        public DelegateCommand DeleteAllTemplateItemCommand { get; set; }
+        public DelegateCommand<object> SelectTemplateItemCommand { get; set; }
+        public DelegateCommand EnterCreateCommand { get; set; }
+
+        public string Unicode = null;
+
+        public HomePageBatesTemplateListContentViewModel(IEventAggregator eventAggregator)
+        {
+            this.eventAggregator = eventAggregator;
+            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
+            EnterCreateCommand = new DelegateCommand(EnterCreate);
+            AddTemplateCommand = new DelegateCommand(AddTemplate);
+            EditTemplateItemCommand = new DelegateCommand<object>(RequestEditTemplateItem);
+            DeleteTemplateItemCommand = new DelegateCommand<object>(DeleteTemplateItem);
+            DeleteAllTemplateItemCommand = new DelegateCommand(DeleteAllTemplateItem);
+            SelectTemplateItemCommand = new DelegateCommand<object>(SelectTemplateItem);
+        }
+
+        private void InitBackgroundTemplateList()
+        {
+            if (Settings.Default.BatesTemplateList == null)
+            {
+                Settings.Default.BatesTemplateList = new BatesTemplateList();
+            }
+            GetBatesSource();
+        }
+
+        public void EnterCreate()
+        {
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode { Unicode = Unicode, Status = EnumTemplateListOrCreate.StatusCreate });
+        }
+
+        public void AddTemplate()
+        {
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode
+            {
+                Unicode = Unicode,
+                Status = EnumTemplateListOrCreate.StatusCreate
+            });
+        }
+
+        public void SaveEditedBatesTemplateItem(BatesHeaderFooterItemUnicode BatesItemunicode)
+        {
+            BatesHeaderFooterItem batesItem = BatesItemunicode.Status;
+
+            Settings.Default.BatesTemplateList[TemplateIndex] = batesItem;
+            Settings.Default.Save();
+
+            GetBatesSource();
+        }
+
+        public void RequestEditTemplateItem(object e)
+        {
+            var control = e as Control;
+            if (control == null)
+            {
+                return;
+            }
+            var template = control.DataContext as BatesHeaderFooterItem;
+            if (template == null)
+            {
+                return;
+            }
+            TemplateIndex = Settings.Default.BatesTemplateList.IndexOf(template);
+            template.listIndex = TemplateIndex;
+            ConvertItemToInfo(template, ref BatesInfo);
+            this.eventAggregator.GetEvent<EditBatesHeaderFooterTemplateItemEvent>().Publish(new BatesHeaderFooterItemUnicode
+            {
+                Unicode = Unicode,
+                Type = "HomePageBatesType",
+                Status = template
+            });
+        }
+
+        public void DeleteTemplateItem(object e)
+        {
+            var btn = e as System.Windows.Controls.Button;
+            if (btn == null)
+            {
+                return;
+            }
+            BatesItem = btn.DataContext as BatesHeaderFooterItem;
+            if (BatesItem == null)
+            {
+                return;
+            }
+
+            Settings.Default.BatesTemplateList.Remove(BatesItem);
+            Settings.Default.Save();
+            BatesModCollection.Remove(BatesItem);
+            GetBatesSource();
+        }
+
+        public void DeleteAllTemplateItem()
+        {
+            while (Settings.Default.BatesTemplateList.Count != 0)
+            {
+                int temp = 0;
+                var template = Settings.Default.BatesTemplateList[temp];
+
+                Settings.Default.BatesTemplateList.Remove(template);
+                Settings.Default.Save();
+
+                BatesModCollection.Remove(template);
+
+            }
+            GetBatesSource();
+        }
+
+        public void SelectTemplateItem(object e)
+        {
+            var listBox = e as ListBox;
+            BatesHeaderFooterItem BatesItem = listBox.SelectedItem as BatesHeaderFooterItem;
+            SendTemplateItemToDocument(BatesItem);
+        }
+
+        public void SendTemplateItemToDocument(BatesHeaderFooterItem template)
+        {
+            if (template != null)
+            {
+                ConvertItemToInfo(template, ref BatesInfo);
+                
+            }
+
+        }
+
+        private void GetBatesSource()
+        {
+            List<BatesHeaderFooterItem> batesModColorTemplateList = new List<BatesHeaderFooterItem>();
+            for (int temp = 0; temp < Settings.Default.BatesTemplateList.Count; temp++)
+            {
+                Settings.Default.BatesTemplateList[temp].ItemName = (temp + 1).ToString();
+                batesModColorTemplateList.Add(Settings.Default.BatesTemplateList[temp]);
+
+            }
+            BatesModCollection = new ObservableCollection<BatesHeaderFooterItem>(batesModColorTemplateList);
+            CheckTemplateListIsEmpty(batesModColorTemplateList);
+        }
+
+        public void ConvertItemToInfo(BatesHeaderFooterItem batesItem, ref BatesInfo batesInfo)
+        {
+            batesInfo.TextData = batesItem.TextData;
+            batesInfo.ItemName = batesItem.ItemName;
+            batesInfo.DigitNumber = batesItem.DigitNumber;
+            batesInfo.Prefix = batesItem.Prefix;
+            batesInfo.Suffix = batesItem.Suffix;
+            batesInfo.StarPagetNumber = batesItem.StarPagetNumber;
+            batesInfo.margin = batesItem.margin;
+            batesInfo.PageRangeIndex = batesItem.PageRangeIndex;
+            //EditToolsHelper.GetPageRange(batesInfo.PageRangeIndex, PDFViewer.Document, ref batesInfo.PageRange, batesItem.PageRange);
+
+        }
+        private void CheckTemplateListIsEmpty(List<BatesHeaderFooterItem> batesTemplateList)
+        {
+            if (batesTemplateList.Count() == 0)
+            {
+                CreateTemplateVisible = Visibility.Visible;
+            }
+            else
+            {
+                CreateTemplateVisible = Visibility.Collapsed;
+            }
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            InitBackgroundTemplateList();
+        }
+    }
+}

+ 730 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterCreateContentViewModel.cs

@@ -0,0 +1,730 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.EventAggregators;
+using PDF_Office.Helper;
+using PDF_Office.Model.EditTools.HeaderFooter;
+using PDF_Office.Model;
+using PDF_Office.Properties;
+using PDFSettings;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Windows.Media;
+using System.Windows;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageHeaderFooter
+{
+    public class HomePageHeaderFooterCreateContentViewModel : BindableBase, INavigationAware
+    {
+        private CPDFViewer PDFViewer;
+
+        public HeaderFooterInfo HeaderFooterInfo = new HeaderFooterInfo();
+
+        public BatesHeaderFooterItem TemplateHeaderFooterItem;
+
+        public enum EnumCreateOrEdit
+        {
+            None,
+            StatusCreate,
+            StatusEdit
+        }
+
+        private List<string> _fontNameList = new List<string>();
+        public List<string> FontNameList
+        {
+            get { return _fontNameList; }
+            set
+            {
+                SetProperty(ref _fontNameList, value);
+            }
+        }
+
+        private void InitFontNameList()
+        {
+            FontNameList.Clear();
+            FontNameList.Add("Courier");
+            FontNameList.Add("Courier-Bold");
+            FontNameList.Add("Courier-Oblique");
+            FontNameList.Add("Courier-BoldOblique");
+            FontNameList.Add("Helvetica");
+            FontNameList.Add("Helvetica-Bold");
+            FontNameList.Add("Helvetica-Oblique");
+            FontNameList.Add("Helvetica-BoldOblique");
+            FontNameList.Add("Times-Roman");
+            FontNameList.Add("Times-Bold");
+            FontNameList.Add("Times-Italic");
+            FontNameList.Add("Times-BoldItalic");
+        }
+
+        private int _fontNameSelectedIndex = 0;
+        public int FontNameSelectedIndex
+        {
+            get { return _fontNameSelectedIndex; }
+            set
+            {
+                SetProperty(ref _fontNameSelectedIndex, value);
+                SetFontName(FontNameSelectedIndex);
+                
+            }
+        }
+
+        private List<string> _fontSizeList = new List<string>();
+        public List<string> FontSizeList
+        {
+            get { return _fontSizeList; }
+            set
+            {
+                SetProperty(ref _fontSizeList, value);
+            }
+        }
+
+        private void InitFontSizeList()
+        {
+            FontSizeList.Clear();
+            for (int temp = 10; temp <= 15; temp += 1)
+            {
+                FontSizeList.Add(temp.ToString() + "pt");
+            }
+        }
+
+        private int _fontSizeSelectedIndex = 0;
+        public int FontSizeSelectedIndex
+        {
+            get { return _fontSizeSelectedIndex; }
+            set
+            {
+                SetProperty(ref _fontSizeSelectedIndex, value);
+                SetFontSize(FontSizeSelectedIndex);
+                
+            }
+        }
+
+        private List<string> _starPagetNumberList = new List<string>();
+        public List<string> StarPagetNumberList
+        {
+            get { return _starPagetNumberList; }
+            set
+            {
+                SetProperty(ref _starPagetNumberList, value);
+            }
+        }
+
+        private void InitStarPagetNumberList()
+        {
+            StarPagetNumberList.Clear();
+            for (int temp = 10; temp <= 15; temp += 1)
+            {
+                StarPagetNumberList.Add(temp.ToString());
+            }
+        }
+
+        private int _starPagetNumberIndex = 0;
+        public int StarPagetNumberIndex
+        {
+            get { return _starPagetNumberIndex; }
+            set
+            {
+                SetProperty(ref _starPagetNumberIndex, value);
+                SetStarPagetNumber(StarPagetNumberIndex);
+                
+            }
+        }
+
+        private List<string> _pageNumberFormatList = new List<string>();
+        public List<string> PageNumberFormatList
+        {
+            get { return _pageNumberFormatList; }
+            set
+            {
+                SetProperty(ref _pageNumberFormatList, value);
+            }
+        }
+
+        private void InitPageNumberFormatList()
+        {
+            PageNumberFormatList.Clear();
+            PageNumberFormatList.Add("1");
+            PageNumberFormatList.Add("1 of n");
+            PageNumberFormatList.Add("1/n");
+            PageNumberFormatList.Add("Page 1");
+            PageNumberFormatList.Add("Page 1 of n");
+        }
+
+        private int _pageNumberFormatIndex = 0;
+        public int PageNumberFormatIndex
+        {
+            get { return _pageNumberFormatIndex; }
+            set
+            {
+                SetProperty(ref _pageNumberFormatIndex, value);
+                SetPageNumberFormat(PageNumberFormatIndex);
+            }
+        }
+
+        private List<string> _dateTimeFormatList = new List<string>();
+        public List<string> DateTimeFormatList
+        {
+            get { return _dateTimeFormatList; }
+            set
+            {
+                SetProperty(ref _dateTimeFormatList, value);
+            }
+        }
+
+        private void InitDateTimeFormatList()
+        {
+            DateTimeFormatList.Clear();
+            DateTimeFormatList.Add("m/d");
+            DateTimeFormatList.Add("m/d/yy");
+            DateTimeFormatList.Add("m/d/yyyy");
+            DateTimeFormatList.Add("mm/dd/yy");
+            DateTimeFormatList.Add("mm/dd/yyyy");
+            DateTimeFormatList.Add("d/m/yy");
+            DateTimeFormatList.Add("d/m/yyyy");
+            DateTimeFormatList.Add("dd/mm/yy");
+            DateTimeFormatList.Add("dd/mm/yyyy");
+            DateTimeFormatList.Add("mm/yy");
+            DateTimeFormatList.Add("mm/yyyy");
+            DateTimeFormatList.Add("m.d.yy");
+            DateTimeFormatList.Add("m.d.yyyy");
+            DateTimeFormatList.Add("mm.dd.yy");
+            DateTimeFormatList.Add("mm.dd.yyyy");
+            DateTimeFormatList.Add("mm.yy");
+            DateTimeFormatList.Add("mm.yyyy");
+            DateTimeFormatList.Add("d.m.yy");
+            DateTimeFormatList.Add("dd.mm.yy");
+            DateTimeFormatList.Add("dd.mm.yyyy");
+            DateTimeFormatList.Add("yy-mm-dd");
+            DateTimeFormatList.Add("yyyy-mm-dd");
+        }
+
+        private int _dateTimeFormatIndex = 0;
+        public int DateTimeFormatIndex
+        {
+            get { return _dateTimeFormatIndex; }
+            set
+            {
+                SetProperty(ref _dateTimeFormatIndex, value);
+                SetDateTimeFormat(DateTimeFormatIndex);
+            }
+        }
+
+        public string _pageRangeText = "0";
+        public string PageRangeText
+        {
+            get { return _pageRangeText; }
+            set
+            {
+                _pageRangeText = value;
+                //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref HeaderFooterInfo.PageRange, PageRangeText);
+                
+            }
+        }
+
+        private int _pageRangeSelectIndex = 0;
+        public int PageRangeSelectIndex
+        {
+            get { return _pageRangeSelectIndex; }
+            set
+            {
+                SetProperty(ref _pageRangeSelectIndex, value);
+                HeaderFooterInfo.PageRangeIndex = PageRangeSelectIndex;
+                //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref HeaderFooterInfo.PageRange, PageRangeText);
+               
+            }
+        }
+
+        private SolidColorBrush _solidColorBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x00, 0x00));
+        public SolidColorBrush SolidColorBrush
+        {
+            get
+            {
+                return _solidColorBrush;
+            }
+            set
+            {
+
+                SetProperty(ref _solidColorBrush, value);
+            }
+        }
+
+        private Color _stringColor = Color.FromArgb(0xFF, 0xFF, 0x00, 0x00);
+        public Color StringColor
+        {
+            get
+            {
+                return _stringColor;
+            }
+            set
+            {
+                SetProperty(ref _stringColor, value);
+                SolidColorBrush = new SolidColorBrush(StringColor);
+                for (int i = 0; i <= 5; i++)
+                {
+                    HeaderFooterInfo.TextData[i].Color = EditToolsHelper.ConvertColor(value);
+                }
+                
+            }
+        }
+
+        private EnumCreateOrEdit _createOrEdit;
+        public EnumCreateOrEdit CreateOrEdit
+        {
+            get { return _createOrEdit; }
+            set
+            {
+                _createOrEdit = value;
+                if (value == EnumCreateOrEdit.StatusEdit)
+                {
+                    EditBaseVisible = Visibility.Visible;
+                    CreateBaseVisible = Visibility.Collapsed;
+                }
+                else if (value == EnumCreateOrEdit.StatusCreate)
+                {
+                    CreateBaseVisible = Visibility.Visible;
+                    EditBaseVisible = Visibility.Collapsed;
+                }
+            }
+        }
+
+        private Visibility _createBaseVisible;
+        public Visibility CreateBaseVisible
+        {
+            get => _createBaseVisible;
+            set => SetProperty(ref _createBaseVisible, value);
+        }
+
+        private Visibility _editBaseVisible;
+        public Visibility EditBaseVisible
+        {
+            get => _editBaseVisible;
+            set => SetProperty(ref _editBaseVisible, value);
+        }
+
+        private string _marginTopValue = "3";
+        public string MarginTopValue
+        {
+            get { return _marginTopValue; }
+            set
+            {
+                SetProperty(ref _marginTopValue, value);
+                bool ValueEQ = true;
+                if (HeaderFooterInfo.margin[1] == float.Parse(MarginTopValue))
+                {
+                    ValueEQ = false;
+                }
+                HeaderFooterInfo.margin[1] = float.Parse(MarginTopValue);
+                if (ValueEQ)
+                {
+                    
+                }
+            }
+        }
+
+        private string _marginDownValue = "3";
+        public string MarginDownValue
+        {
+            get { return _marginDownValue; }
+            set
+            {
+                SetProperty(ref _marginDownValue, value);
+                bool ValueEQ = true;
+                if (HeaderFooterInfo.margin[3] == float.Parse(MarginTopValue))
+                {
+                    ValueEQ = false;
+                }
+                HeaderFooterInfo.margin[3] = float.Parse(MarginDownValue);
+                if (ValueEQ)
+                {
+                   
+                }
+            }
+        }
+
+        private string _marginLeftValue = "3";
+        public string MarginLeftValue
+        {
+            get { return _marginLeftValue; }
+            set
+            {
+                SetProperty(ref _marginLeftValue, value);
+                bool ValueEQ = true;
+                if (HeaderFooterInfo.margin[0] == float.Parse(MarginTopValue))
+                {
+                    ValueEQ = false;
+                }
+                HeaderFooterInfo.margin[0] = float.Parse(MarginLeftValue);
+                if (ValueEQ)
+                {
+                   
+                }
+            }
+        }
+
+        private string _marginRightValue = "3";
+        public string MarginRightValue
+        {
+            get { return _marginRightValue; }
+            set
+            {
+                SetProperty(ref _marginRightValue, value);
+                bool ValueEQ = true;
+                if (HeaderFooterInfo.margin[2] == float.Parse(MarginTopValue))
+                {
+                    ValueEQ = false;
+                }
+                if (ValueEQ)
+                {
+                   
+                }
+            }
+        }
+
+        private string _textValue = "";
+        public string TextValue
+        {
+            get { return _textValue; }
+            set
+            {
+                SetProperty(ref _textValue, value);
+
+            }
+        }
+
+        public int GetLocationIndex = 0;
+
+        private Dictionary<string, string> _getTextValueFromNumber = new Dictionary<string, string>();
+        public Dictionary<string, string> GetTextValueFromNumber
+        {
+            get { return _getTextValueFromNumber; }
+            set
+            {
+                _getTextValueFromNumber = value;
+            }
+        }
+
+        public IEventAggregator eventAggregator;
+
+        public DelegateCommand<object> ChangeLocationCommand { get; set; }
+        public DelegateCommand EnterTemplateListCommand { get; set; }
+        public DelegateCommand SaveToTemplateListCommand { get; set; }
+        public DelegateCommand SaveToCurrentTemplateListCommand { get; set; }
+        public DelegateCommand<object> SelectedColorChangedCommand { get; set; }
+        public DelegateCommand<object> TextValueChangedCommand { get; set; }
+        public DelegateCommand ADDDateCommand { get; set; }
+        public DelegateCommand ADDPagesCommand { get; set; }
+        public string Unicode = null;
+        public HomePageHeaderFooterCreateContentViewModel(IEventAggregator eventAggregator)
+        {
+            this.eventAggregator = eventAggregator;
+            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
+            for (int i = 0; i <= 5; i++)
+            {
+                HeaderFooterInfo.TextData[i].Color = EditToolsHelper.ConvertColor(Color.FromArgb(0xFF, 0xFF, 0x00, 0x00));
+            }
+            InitList();
+            InitHeaderFooterInfo();
+            ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
+            SelectedColorChangedCommand = new DelegateCommand<object>(ChangedColor);
+            EnterTemplateListCommand = new DelegateCommand(EnterTemplateList);
+            SaveToTemplateListCommand = new DelegateCommand(SaveToTemplateList);
+            SaveToCurrentTemplateListCommand = new DelegateCommand(SaveToCurrentTemplateList);
+            TextValueChangedCommand = new DelegateCommand<object>(TextValueChanged);
+            ADDDateCommand = new DelegateCommand(ADDDate);
+            ADDPagesCommand = new DelegateCommand(ADDPages);
+        }
+
+        private void InitList()
+        {
+
+            InitFontNameList();
+            InitFontSizeList();
+            InitStarPagetNumberList();
+            InitDateTimeFormatList();
+            InitPageNumberFormatList();
+            InitLocationButtonMatrix();
+
+        }
+
+        private void InitLocationButtonMatrix()
+        {
+            GetTextValueFromNumber.Clear();
+            for (var temp = 0; temp <= 5; temp++)
+            {
+                GetTextValueFromNumber.Add(temp.ToString(), "");
+            }
+        }
+
+        private void InitHeaderFooterInfo()
+        {
+            for (int i = 0; i <= 5; i++)
+            {
+                HeaderFooterInfo.TextData[i].text = GetTextValueFromNumber[i.ToString()];
+            }
+            HeaderFooterInfo.margin[0] = float.Parse(MarginTopValue);
+            HeaderFooterInfo.margin[1] = float.Parse(MarginRightValue);
+            HeaderFooterInfo.margin[2] = float.Parse(MarginDownValue);
+            HeaderFooterInfo.margin[3] = float.Parse(MarginLeftValue);
+            SetFontName(FontNameSelectedIndex);
+            SetFontSize(FontSizeSelectedIndex);
+            SetDateTimeFormat(DateTimeFormatIndex);
+            SetPageNumberFormat(PageNumberFormatIndex);
+            SetStarPagetNumber(StarPagetNumberIndex);
+            StringColor = Color.FromArgb(0xFF, 0xFF, 0x00, 0x00);
+        }
+
+        private void SetFontName(int Index)
+        {
+            for (int i = 0; i <= 5; i++) { HeaderFooterInfo.TextData[i].fontName = FontNameList[Index]; }
+        }
+
+        private void SetFontSize(int Index)
+        {
+            for (int i = 0; i <= 5; i++) { HeaderFooterInfo.TextData[i].fontSize = (Index + 7) * 1.33f; }
+        }
+
+        private void SetDateTimeFormat(int Index)
+        {
+            HeaderFooterInfo.DateTimeFormat = DateTimeFormatList[Index];
+        }
+
+        private void SetPageNumberFormat(int Index)
+        {
+            HeaderFooterInfo.PageNumberFormat = PageNumberFormatList[Index];
+        }
+
+        private void SetStarPagetNumber(int Index)
+        {
+            HeaderFooterInfo.StarPagetNumber = Index;
+        }
+
+        public void ChangeLocation(object e)
+        {
+            string args = e as string;
+            if (args != null)
+            {
+                GetLocationIndex = int.Parse(args);
+                TextValue = GetTextValueFromNumber[args];
+
+            }
+        }
+        private void ChangedColor(object obj)
+        {
+            if (obj != null)
+            {
+                var colorValue = (Color)obj;
+                if (colorValue != null)
+                {
+
+                    StringColor = colorValue;
+                }
+            }
+        }
+
+        public void EnterTemplateList()
+        {
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode { Unicode = Unicode, Status = EnumTemplateListOrCreate.StatusTemplate });
+        }
+
+        public void SaveToTemplateList()
+        {
+            SaveCurrentTemplate();
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode { Unicode = Unicode, Status = EnumTemplateListOrCreate.StatusTemplate });
+        }
+
+        public void SaveToCurrentTemplateList()
+        {
+            ConfirmEditBackgroundTemplateItem();
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode { Unicode = Unicode, Status = EnumTemplateListOrCreate.StatusTemplate });
+        }
+
+        private void TextValueChanged(object obj)
+        {
+            if (obj != null)
+            {
+                var textValue = obj as System.Windows.Controls.TextBox;
+                if (textValue != null)
+                {
+                    bool TextEQ = true;
+                    if (GetTextValueFromNumber[GetLocationIndex.ToString()] == textValue.Text)
+                    {
+                        TextEQ = false;
+                    }
+                    GetTextValueFromNumber[GetLocationIndex.ToString()] = textValue.Text;
+                    HeaderFooterInfo.TextData[GetLocationIndex].text = GetTextValueFromNumber[GetLocationIndex.ToString()];
+                    if (TextEQ)
+                    {
+                       
+                    }
+
+                }
+            }
+
+        }
+
+        public void ADDDate()
+        {
+            GetTextValueFromNumber[GetLocationIndex.ToString()] = GetTextValueFromNumber[GetLocationIndex.ToString()] + "<<" + DateTimeFormatList[DateTimeFormatIndex] + ">>";
+            TextValue = GetTextValueFromNumber[GetLocationIndex.ToString()];
+            HeaderFooterInfo.TextData[GetLocationIndex].text = GetTextValueFromNumber[GetLocationIndex.ToString()];
+          
+        }
+        public void ADDPages()
+        {
+            GetTextValueFromNumber[GetLocationIndex.ToString()] = GetTextValueFromNumber[GetLocationIndex.ToString()] + "<<" + PageNumberFormatList[PageNumberFormatIndex] + ">>";
+            TextValue = GetTextValueFromNumber[GetLocationIndex.ToString()];
+            HeaderFooterInfo.TextData[GetLocationIndex].text = GetTextValueFromNumber[GetLocationIndex.ToString()];
+           
+        }
+
+        public void ConvertInfoToItem(ref BatesHeaderFooterItem headerFooterItem, HeaderFooterInfo headerFooterInfo)
+        {
+            headerFooterItem.TextData = headerFooterInfo.TextData;
+            headerFooterItem.ItemName = headerFooterInfo.ItemName;
+            headerFooterItem.DateTimeFormat = headerFooterInfo.DateTimeFormat;
+            headerFooterItem.StarPagetNumber = headerFooterInfo.StarPagetNumber;
+            headerFooterItem.PageNumberFormat = headerFooterInfo.PageNumberFormat;
+            headerFooterItem.margin = headerFooterInfo.margin;
+            headerFooterItem.PageRange = headerFooterInfo.PageRange;
+            headerFooterItem.PageRangeIndex = headerFooterInfo.PageRangeIndex;
+        }
+
+        public void ConvertItemToInfo(BatesHeaderFooterItem headerFooterItem, ref HeaderFooterInfo headerFooterInfo)
+        {
+            headerFooterInfo.TextData = headerFooterItem.TextData;
+            headerFooterInfo.ItemName = headerFooterItem.ItemName;
+            headerFooterInfo.DateTimeFormat = headerFooterItem.DateTimeFormat;
+            headerFooterInfo.StarPagetNumber = headerFooterItem.StarPagetNumber;
+            headerFooterInfo.PageNumberFormat = headerFooterItem.PageNumberFormat;
+            headerFooterInfo.margin = headerFooterItem.margin;
+            headerFooterInfo.PageRangeIndex = headerFooterItem.PageRangeIndex;
+            //EditToolsHelper.GetPageRange(headerFooterInfo.PageRangeIndex, PDFViewer.Document, ref headerFooterInfo.PageRange, headerFooterItem.PageRange);
+        }
+
+        public void SaveCurrentTemplate()
+        {
+            var headerFooterItem = new BatesHeaderFooterItem();
+
+            ConvertInfoToItem(ref headerFooterItem, HeaderFooterInfo);
+            headerFooterItem.ItemName += Settings.Default.HeaderFooterTemplateList.Count().ToString();
+            try
+            {
+                //创建缓存文件夹
+                string folderPath = Path.Combine(App.CurrentPath, "HeaderFooter");
+                //有可能因为其他原因存在同名文件,导致创建文件夹失败,需要先删除同名文件
+                //保险措施(猜测)
+                if (File.Exists(folderPath))
+                {
+                    File.Delete(folderPath);
+                }
+
+                DirectoryInfo tempfolder = new DirectoryInfo(folderPath);
+                if (!tempfolder.Exists)
+                {
+                    tempfolder.Create();
+                }
+                //预览图缓存
+                string saveName = Guid.NewGuid().ToString();
+                string savePath = Path.Combine(folderPath, saveName);
+                Settings.Default.HeaderFooterTemplateList.Add(headerFooterItem);
+                Settings.Default.Save();
+            }
+            catch
+            {
+
+            }
+
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode
+            {
+                Unicode = Unicode,
+                Status = EnumTemplateListOrCreate.StatusTemplate
+            });
+        }
+
+        public void ConfirmEditBackgroundTemplateItem()
+        {
+
+            var headerFooterItem = new BatesHeaderFooterItem();
+            ConvertInfoToItem(ref headerFooterItem, HeaderFooterInfo);
+            try
+            {
+                //创建缓存文件夹
+                string folderPath = Path.Combine(App.CurrentPath, "Background");
+                //有可能因为其他原因存在同名文件,导致创建文件夹失败,需要先删除同名文件
+                //保险措施(猜测)
+                if (File.Exists(folderPath))
+                {
+                    File.Delete(folderPath);
+                }
+
+                DirectoryInfo tempfolder = new DirectoryInfo(folderPath);
+                if (!tempfolder.Exists)
+                {
+                    tempfolder.Create();
+                }
+                Settings.Default.HeaderFooterTemplateList[TemplateHeaderFooterItem.listIndex] = headerFooterItem;
+                Settings.Default.Save();
+            }
+            catch
+            {
+
+            }
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode
+            {
+                Unicode = Unicode,
+                Status = EnumTemplateListOrCreate.StatusTemplate
+            });
+
+        }
+
+        public void InitComponentBySelectedInfo()
+        {
+            ConvertItemToInfo(TemplateHeaderFooterItem, ref HeaderFooterInfo);
+            for (int i = 0; i <= 5; i++)
+            {
+                GetTextValueFromNumber[i.ToString()] = HeaderFooterInfo.TextData[i].text;
+            }
+            MarginTopValue = HeaderFooterInfo.margin[0].ToString();
+            MarginRightValue = HeaderFooterInfo.margin[1].ToString();
+            MarginDownValue = HeaderFooterInfo.margin[2].ToString();
+            MarginLeftValue = HeaderFooterInfo.margin[3].ToString();
+            DateTimeFormatIndex = DateTimeFormatList.IndexOf(HeaderFooterInfo.DateTimeFormat);
+            PageNumberFormatIndex = PageNumberFormatList.IndexOf(HeaderFooterInfo.PageNumberFormat);
+            FontNameSelectedIndex = FontNameList.IndexOf(HeaderFooterInfo.TextData[0].fontName);
+            FontSizeSelectedIndex = FontSizeList.IndexOf(HeaderFooterInfo.TextData[0].fontSize.ToString());
+            StarPagetNumberIndex = StarPagetNumberList.IndexOf(HeaderFooterInfo.StarPagetNumber.ToString());
+            StringColor = EditToolsHelper.ConvertColor(HeaderFooterInfo.TextData[0].Color);
+            SolidColorBrush = new SolidColorBrush(StringColor);
+            PageRangeSelectIndex = HeaderFooterInfo.PageRangeIndex;
+
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref HeaderFooterInfo.PageRange, PageRangeText);
+            if (navigationContext.Parameters.TryGetValue<BatesHeaderFooterItem>("HeaderFooterItem", out TemplateHeaderFooterItem))
+            {
+                CreateOrEdit = EnumCreateOrEdit.StatusEdit;
+                InitComponentBySelectedInfo();
+            }
+            else
+            {
+                CreateOrEdit = EnumCreateOrEdit.StatusCreate;
+            }
+        }
+    }
+}

+ 83 - 6
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterDialogViewModel.cs

@@ -14,6 +14,10 @@ using System.IO;
 using System.Linq;
 using System.Windows;
 using System.Windows.Forms;
+using Prism.Events;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.EventAggregators;
+using PDFSettings;
 
 namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageHeaderFooter
 {
@@ -27,7 +31,38 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public string PageNumber = "";
 
-        public IRegionManager HeaderFooterRegion;
+        public IRegionManager headerFooterRegion;
+        public IEventAggregator eventAggregator;
+
+        private CPDFViewer PDFViewer;
+
+        private ViewContentViewModel viewContentViewModel;
+
+        public string TemplateListName = "HomePageHeaderFooterTemplateListContent";
+        public string CreateName = "HomePageHeaderFooterCreateContent";
+
+        public string HeaderFooterType = "HomePageHeaderFooterType";
+
+        private string _headerFooterSettingsRegionName;
+        /// <summary>
+        /// 属性设置Region
+        /// </summary>
+        public string HeaderFooterSettingsRegionName
+        {
+            get { return _headerFooterSettingsRegionName; }
+            set { _headerFooterSettingsRegionName = value; }
+        }
+
+        private Visibility _headerFooterSettingsVisible = Visibility.Visible;
+        /// <summary>
+        /// 属性设置Region可见
+        /// </summary>
+        public Visibility HeaderFooterSettingsVisible
+        {
+            get { return _headerFooterSettingsVisible; }
+            set { _headerFooterSettingsVisible = value; }
+        }
+
 
         public List<int> fileNamesView = new List<int>();
 
@@ -132,21 +167,60 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public DelegateCommand ADDPDFFilesCommand { get; set; }
         #endregion
 
-        public HomePageHeaderFooterDialogViewModel(IRegionManager headerFooterRegion)
+        public string Unicode = null;
+
+        public HomePageHeaderFooterDialogViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
         {
-           
+            this.eventAggregator = eventAggregator;
+            this.headerFooterRegion = regionManager;
+
+            HeaderFooterSettingsRegionName = Guid.NewGuid().ToString();
+            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
+
             PDFDataTable.Columns.Add("FileName");
+            PDFDataTable.Columns.Add("FilePageRangeText");
+            PDFDataTable.Columns.Add("FilePageRangeSelectIndex");
             PDFDataTable.Columns.Add("FileSize");
             PDFDataTable.Columns.Add("FileState");
             ADDPDFCommand = new DelegateCommand(addpicture);
             ADDPDFFilesCommand = new DelegateCommand(addpicturefiles);
             RemovePDFFileCommand = new DelegateCommand(removepdffile);
             CreateCommand = new DelegateCommand(create);
-            HeaderFooterRegion = headerFooterRegion;
-            HeaderFooterRegionName = Guid.NewGuid().ToString();
+            eventAggregator.GetEvent<EditBatesHeaderFooterTemplateItemEvent>().Subscribe(EditHeaderFooterTemplateItem, e => e.Unicode == Unicode && e.Type == HeaderFooterType);
+            eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Subscribe(EnterTemplateListOrCreate, e => e.Unicode == Unicode);
         }
         #region 逻辑函数
-   
+
+        public void EditHeaderFooterTemplateItem(BatesHeaderFooterItemUnicode headerfooterItemunicode)
+        {
+            BatesHeaderFooterItem headerfooterItem = headerfooterItemunicode.Status;
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, PDFViewer);
+            param.Add("HeaderFooterItem", headerfooterItem);
+            headerFooterRegion.RequestNavigate(HeaderFooterSettingsRegionName, CreateName, param);
+            HeaderFooterSettingsVisible = Visibility.Visible;
+        }
+
+        public void EnterTemplateListOrCreate(EnumTemplateListOrCreateUnicode enumTemplateListOrCreateunicode)
+        {
+            EnumTemplateListOrCreate enumTemplateListOrCreate = enumTemplateListOrCreateunicode.Status;
+            if (enumTemplateListOrCreate == EnumTemplateListOrCreate.StatusTemplate)
+            {
+                EnterSelectedContent(TemplateListName);
+            }
+            else
+            {
+                EnterSelectedContent(CreateName);
+            }
+        }
+
+        public void EnterSelectedContent(string SelectedContentName)
+        {
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, PDFViewer);
+            headerFooterRegion.RequestNavigate(HeaderFooterSettingsRegionName, SelectedContentName, param);
+            HeaderFooterSettingsVisible = Visibility.Visible;
+        }
 
         private  void create()
         {
@@ -335,12 +409,15 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             List<string> filepath = new List<string>();
+            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<List<string>>(ParameterNames.FilePath, out filepath);
             if (filepath != null)
             {
                 fileNames = filepath;
                 PDFFileCount();
                 updateListview("待确定");
+                EnterSelectedContent(TemplateListName);
             }
         }
 

+ 225 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterTemplateListContentViewModel.cs

@@ -0,0 +1,225 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.EventAggregators;
+using PDF_Office.Helper;
+using PDF_Office.Model.EditTools.HeaderFooter;
+using PDF_Office.Model;
+using PDF_Office.Properties;
+using PDFSettings;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Windows.Controls;
+using System.Windows;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageHeaderFooter
+{
+    public class HomePageHeaderFooterTemplateListContentViewModel : BindableBase, INavigationAware
+    {
+        public IEventAggregator eventAggregator;
+        private CPDFViewer PDFViewer;
+        public HeaderFooterInfo HeaderFooterInfo = new HeaderFooterInfo();
+        public BatesHeaderFooterItem HeaderFooterItem = new BatesHeaderFooterItem();
+        public int TemplateIndex = 0;
+
+        private ObservableCollection<BatesHeaderFooterItem> headerFooterModCollection = new ObservableCollection<BatesHeaderFooterItem>();
+        public ObservableCollection<BatesHeaderFooterItem> HeaderFooterModCollection
+        {
+            get { return headerFooterModCollection; }
+            set
+            {
+                headerFooterModCollection = value;
+                RaisePropertyChanged();
+            }
+        }
+
+        private Visibility _createTemplateVisible;
+        public Visibility CreateTemplateVisible
+        {
+            get { return _createTemplateVisible; }
+            set { SetProperty(ref _createTemplateVisible, value); }
+        }
+
+        public DelegateCommand AddTemplateCommand { get; set; }
+        public DelegateCommand<object> DeleteTemplateItemCommand { get; set; }
+        public DelegateCommand<object> EditTemplateItemCommand { get; set; }
+        public DelegateCommand DeleteAllTemplateItemCommand { get; set; }
+        public DelegateCommand<object> SelectTemplateItemCommand { get; set; }
+        public DelegateCommand EnterCreateCommand { get; set; }
+
+        public string Unicode = null;
+        public HomePageHeaderFooterTemplateListContentViewModel(IEventAggregator eventAggregator)
+        {
+            this.eventAggregator = eventAggregator;
+            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
+            EnterCreateCommand = new DelegateCommand(EnterCreate);
+            AddTemplateCommand = new DelegateCommand(AddTemplate);
+            EditTemplateItemCommand = new DelegateCommand<object>(RequestEditTemplateItem);
+            DeleteTemplateItemCommand = new DelegateCommand<object>(DeleteTemplateItem);
+            DeleteAllTemplateItemCommand = new DelegateCommand(DeleteAllTemplateItem);
+            SelectTemplateItemCommand = new DelegateCommand<object>(SelectTemplateItem);
+        }
+
+        private void InitBackgroundTemplateList()
+        {
+            if (Settings.Default.HeaderFooterTemplateList == null)
+            {
+                Settings.Default.HeaderFooterTemplateList = new HeaderFooterTemplateList();
+            }
+            GetHeaderFooterSource();
+        }
+
+        public void EnterCreate()
+        {
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode { Unicode = Unicode, Status = EnumTemplateListOrCreate.StatusCreate });
+        }
+
+        public void AddTemplate()
+        {
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode
+            {
+                Unicode = Unicode,
+                Status = EnumTemplateListOrCreate.StatusCreate
+            });
+        }
+
+        public void SaveEditedBatesTemplateItem(BatesHeaderFooterItemUnicode HeaderFooterItemunicode)
+        {
+            BatesHeaderFooterItem headerFooterItem = HeaderFooterItemunicode.Status;
+
+            Settings.Default.HeaderFooterTemplateList[TemplateIndex] = headerFooterItem;
+            Settings.Default.Save();
+
+            GetHeaderFooterSource();
+        }
+
+        public void RequestEditTemplateItem(object e)
+        {
+            var control = e as Control;
+            if (control == null)
+            {
+                return;
+            }
+            var template = control.DataContext as BatesHeaderFooterItem;
+            if (template == null)
+            {
+                return;
+            }
+            TemplateIndex = Settings.Default.HeaderFooterTemplateList.IndexOf(template);
+            template.listIndex = TemplateIndex;
+            ConvertItemToInfo(template, ref HeaderFooterInfo);
+            this.eventAggregator.GetEvent<EditBatesHeaderFooterTemplateItemEvent>().Publish(new BatesHeaderFooterItemUnicode
+            {
+                Unicode = Unicode,
+                Type = "HomePageHeaderFooterType",
+                Status = template
+            });
+        }
+
+        public void DeleteTemplateItem(object e)
+        {
+            var btn = e as System.Windows.Controls.Button;
+            if (btn == null)
+            {
+                return;
+            }
+            HeaderFooterItem = btn.DataContext as BatesHeaderFooterItem;
+            if (HeaderFooterItem == null)
+            {
+                return;
+            }
+
+            Settings.Default.HeaderFooterTemplateList.Remove(HeaderFooterItem);
+            Settings.Default.Save();
+            HeaderFooterModCollection.Remove(HeaderFooterItem);
+            GetHeaderFooterSource();
+        }
+
+        public void DeleteAllTemplateItem()
+        {
+            while (Settings.Default.HeaderFooterTemplateList.Count != 0)
+            {
+                int temp = 0;
+                var template = Settings.Default.HeaderFooterTemplateList[temp];
+
+                Settings.Default.HeaderFooterTemplateList.Remove(template);
+                Settings.Default.Save();
+
+                HeaderFooterModCollection.Remove(template);
+
+            }
+            GetHeaderFooterSource();
+        }
+
+        public void SelectTemplateItem(object e)
+        {
+            var listBox = e as ListBox;
+            BatesHeaderFooterItem HeaderFooterItem = listBox.SelectedItem as BatesHeaderFooterItem;
+            SendTemplateItemToDocument(HeaderFooterItem);
+        }
+
+        public void SendTemplateItemToDocument(BatesHeaderFooterItem template)
+        {
+            if (template != null)
+            {
+                ConvertItemToInfo(template, ref HeaderFooterInfo);
+            }
+
+        }
+
+        private void GetHeaderFooterSource()
+        {
+            List<BatesHeaderFooterItem> headerFooterModColorTemplateList = new List<BatesHeaderFooterItem>();
+            for (int temp = 0; temp < Settings.Default.HeaderFooterTemplateList.Count; temp++)
+            {
+                Settings.Default.HeaderFooterTemplateList[temp].ItemName = (temp + 1).ToString();
+                headerFooterModColorTemplateList.Add(Settings.Default.HeaderFooterTemplateList[temp]);
+
+            }
+            HeaderFooterModCollection = new ObservableCollection<BatesHeaderFooterItem>(headerFooterModColorTemplateList);
+            CheckTemplateListIsEmpty(headerFooterModColorTemplateList);
+        }
+
+        public void ConvertItemToInfo(BatesHeaderFooterItem headerFooterItem, ref HeaderFooterInfo headerFooterInfo)
+        {
+            headerFooterInfo.TextData = headerFooterItem.TextData;
+            headerFooterInfo.ItemName = headerFooterItem.ItemName;
+            headerFooterInfo.DateTimeFormat = headerFooterItem.DateTimeFormat;
+            headerFooterInfo.StarPagetNumber = headerFooterItem.StarPagetNumber;
+            headerFooterInfo.PageNumberFormat = headerFooterItem.PageNumberFormat;
+            headerFooterInfo.margin = headerFooterItem.margin;
+            headerFooterInfo.PageRangeIndex = headerFooterItem.PageRangeIndex;
+            EditToolsHelper.GetPageRange(headerFooterInfo.PageRangeIndex, PDFViewer.Document, ref headerFooterInfo.PageRange, headerFooterItem.PageRange);
+        }
+        private void CheckTemplateListIsEmpty(List<BatesHeaderFooterItem> headerFooterTemplateList)
+        {
+            if (headerFooterTemplateList.Count() == 0)
+            {
+                CreateTemplateVisible = Visibility.Visible;
+            }
+            else
+            {
+                CreateTemplateVisible = Visibility.Collapsed;
+            }
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            InitBackgroundTemplateList();
+        }
+    }
+}

+ 2 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkDialogViewModel.cs

@@ -22,7 +22,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         #region 参数和属性
         private List<string> fileNames;
 
-
         private CPDFDocument tempDocument;
 
         public string PageNumber = "";
@@ -134,6 +133,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageWatermarkDialogViewModel(IRegionManager watermarkRegion)
         {
             PDFDataTable.Columns.Add("FileName");
+            PDFDataTable.Columns.Add("FilePageRangeText");
+            PDFDataTable.Columns.Add("FilePageRangeSelectIndex");
             PDFDataTable.Columns.Add("FileSize");
             PDFDataTable.Columns.Add("FileState");
             ADDPDFCommand = new DelegateCommand(addpicture);

+ 262 - 231
PDF Office/ViewModels/HomePanel/PDFTools/QuickToolsContentViewModel.cs

@@ -1,232 +1,263 @@
-using ComPDFKitViewer.PdfViewer;
-using PDF_Office.Helper;
-using PDF_Office.Model;
-using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
-using PDF_Office.Model.PDFTool;
-using PDFSettings;
-using Prism.Commands;
-using Prism.Mvvm;
-using Prism.Regions;
-using Prism.Services.Dialogs;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Controls;
-
-namespace PDF_Office.ViewModels.HomePanel.PDFTools
-{
-    public class QuickToolsContentViewModel : BindableBase
-    {
-        #region 属性
-        /// <summary>
-        /// 扩展/收缩
-        /// </summary>
-        private bool _isExpendTools = false;
-        public bool IsExpendTools
-        {
-            get { return _isExpendTools; }
-            set { SetProperty(ref _isExpendTools, value); }
-        }
-
-        private string regionName;
-
-        public string ToolRegionName
-        {
-            get { return regionName; }
-            set { SetProperty(ref regionName, value); }
-        }
-
-        #endregion
-
-        #region Command and Event
-        public IDialogService dialogs;
-        public DelegateCommand<ToolItem> QuickToolsCommand { get; set; }
-        public DelegateCommand<object> OpenMenuCommand { get; set; }
-        public DelegateCommand ExpendCommand { get; set; }
-        public DelegateCommand ShowToolCommand { get; set; }
-
-        public IRegionManager toolregion;
-        public event EventHandler<bool> ExpendToolsHanlder;
-        #endregion
-
-        public QuickToolsContentViewModel(IDialogService dialogService, IRegionManager regionManager)
-        {
-            toolregion = regionManager;
-            ToolRegionName = RegionNames.ToolRegionName;
-            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
-            {
-                toolregion.RequestNavigate(ToolRegionName, "Guid");
-            }));
-
-            dialogs = dialogService;
-
-            InitVariable();
-            InitCommand();
-            
-        }
-
-        #region 初始化和绑定
-        private void InitVariable()
-        {
-
-        }
-
-        private void InitCommand()
-        {
-            QuickToolsCommand = new DelegateCommand<ToolItem>(QuickTools_Click);
-            OpenMenuCommand = new DelegateCommand<object>(OpenMenu);
-            ExpendCommand = new DelegateCommand(Expend);
-            ShowToolCommand = new DelegateCommand(ShowTool);
-        }
-
-        #endregion
-
-        private void ShowTool()
-        {
-            toolregion.RequestNavigate(ToolRegionName, "Tools");
-        }
-
-
-        public void QuickTools_Click(ToolItem toolItem)
-        {
-            /*
-             *设置这个对话框的起始保存路径
-             */
-            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
-            dlg.Multiselect = false;
-            dlg.Filter = "PDF|*.pdf;*.PDF;";
-            if (toolItem.FnType == PDFFnType.Compress || toolItem.FnType == PDFFnType.Security||toolItem.FnType ==PDFFnType.BatchRemove||toolItem.FnType==PDFFnType.ConvertPDF)
-            {
-                dlg.Multiselect = true;
-            }
-            if (toolItem.FnType == PDFFnType.ImageToPDF)
-            {
-                dlg.Multiselect = true;
-                dlg.Filter = "Picture|*.png;*.PNG;*.jpg;*.JPG;*bmp;*jpeg;*gif;*tiff;";
-            }
-            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
-            {
-                CPDFViewer viewer = new CPDFViewer();
-
-                switch ((PDFFnType)toolItem.FnType)
-                {
-                    case PDFFnType.Split:
-
-                        viewer.InitDocument(dlg.FileName);
-                        DialogParameters splitvalue = new DialogParameters();
-                        splitvalue.Add(ParameterNames.PDFViewer, viewer);
-                        splitvalue.Add(ParameterNames.FilePath, dlg.FileName);
-                        dialogs.ShowDialog(DialogNames.HomePageSplitDialog, splitvalue, e => { });
-                        break;
-
-                    case PDFFnType.Extract:
-                        viewer.InitDocument(dlg.FileName);
-                        DialogParameters extractvalue = new DialogParameters();
-                        extractvalue.Add(ParameterNames.PDFViewer, viewer);
-                        extractvalue.Add(ParameterNames.FilePath, dlg.FileName);
-                        dialogs.ShowDialog(DialogNames.HomePageExtractDialog, extractvalue, e => { });
-                        break;
-
-                    case PDFFnType.Insert:
-                        viewer.InitDocument(dlg.FileName);
-                        DialogParameters insertvalue = new DialogParameters();
-                        insertvalue.Add(ParameterNames.PDFViewer, viewer);
-                        insertvalue.Add(ParameterNames.FilePath, dlg.FileName);
-                        dialogs.ShowDialog(DialogNames.HomePageInsertDialog, insertvalue, e => { });
-                        break;
-
-                    case PDFFnType.Compress:
-                        DialogParameters compresspdf = new DialogParameters();
-                        compresspdf.Add(ParameterNames.BatchProcessing_Name, "1");
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 1;
-                        compresspdf.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, compresspdf, e => { });
-                        break;
-
-                    case PDFFnType.ImageToPDF:
-                        DialogParameters picturetopdf = new DialogParameters();
-                        picturetopdf.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePagePictureToPDFDialog, picturetopdf, e => { });
-                        break;
-
-                    case PDFFnType.Print:
-                        viewer.InitDocument(dlg.FileName);
-                        DialogParameters printvalue = new DialogParameters();
-                        printvalue.Add(ParameterNames.PDFViewer, viewer);
-                        printvalue.Add(ParameterNames.FilePath, dlg.FileName);
-                        dialogs.ShowDialog(DialogNames.HomePagePrinterDialog, printvalue, e => { });
-                        break;
-
-                    case PDFFnType.Security:
-                        DialogParameters securitypdf = new DialogParameters();
-                        securitypdf.Add(ParameterNames.BatchProcessing_Name, "2");
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 2;
-                        securitypdf.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, securitypdf, e => { });
-
-                        break;
-                    case PDFFnType.ConvertPDF:
-                        DialogParameters convertpdf = new DialogParameters();
-                        convertpdf.Add(ParameterNames.BatchProcessing_Name, "0");
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
-                        convertpdf.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdf, e => { });
-
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
+using PDF_Office.Model.PDFTool;
+using PDFSettings;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+
+namespace PDF_Office.ViewModels.HomePanel.PDFTools
+{
+    public class QuickToolsContentViewModel : BindableBase
+    {
+        #region 属性
+        /// <summary>
+        /// 扩展/收缩
+        /// </summary>
+        private bool _isExpendTools = false;
+        public bool IsExpendTools
+        {
+            get { return _isExpendTools; }
+            set { SetProperty(ref _isExpendTools, value); }
+        }
+
+        private string regionName;
+
+        public string ToolRegionName
+        {
+            get { return regionName; }
+            set { SetProperty(ref regionName, value); }
+        }
+
+        #endregion
+
+        #region Command and Event
+        public IDialogService dialogs;
+        public DelegateCommand<ToolItem> QuickToolsCommand { get; set; }
+        public DelegateCommand<object> OpenMenuCommand { get; set; }
+        public DelegateCommand ExpendCommand { get; set; }
+        public DelegateCommand ShowToolCommand { get; set; }
+
+        public IRegionManager toolregion;
+        public event EventHandler<bool> ExpendToolsHanlder;
+        #endregion
+
+        public QuickToolsContentViewModel(IDialogService dialogService, IRegionManager regionManager)
+        {
+            toolregion = regionManager;
+            ToolRegionName = RegionNames.ToolRegionName;
+            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+            {
+                toolregion.RequestNavigate(ToolRegionName, "Guid");
+            }));
+
+            dialogs = dialogService;
+
+            InitVariable();
+            InitCommand();
+            
+        }
+
+        #region 初始化和绑定
+        private void InitVariable()
+        {
+
+        }
+
+        private void InitCommand()
+        {
+            QuickToolsCommand = new DelegateCommand<ToolItem>(QuickTools_Click);
+            OpenMenuCommand = new DelegateCommand<object>(OpenMenu);
+            ExpendCommand = new DelegateCommand(Expend);
+            ShowToolCommand = new DelegateCommand(ShowTool);
+        }
+
+        #endregion
+
+        private void ShowTool()
+        {
+            toolregion.RequestNavigate(ToolRegionName, "Tools");
+        }
+
+
+        public void QuickTools_Click(ToolItem toolItem)
+        {
+            /*
+             *设置这个对话框的起始保存路径
+             */
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = false;
+            dlg.Filter = "PDF|*.pdf;*.PDF;";
+            if (toolItem.FnType == PDFFnType.Compress || toolItem.FnType == PDFFnType.Security||toolItem.FnType ==PDFFnType.BatchRemove||toolItem.FnType==PDFFnType.ConvertPDF)
+            {
+                dlg.Multiselect = true;
+            }
+            if (toolItem.FnType == PDFFnType.ImageToPDF)
+            {
+                dlg.Multiselect = true;
+                dlg.Filter = "Picture|*.png;*.PNG;*.jpg;*.JPG;*bmp;*jpeg;*gif;*tiff;";
+            }
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                CPDFViewer viewer = new CPDFViewer();
+
+                switch ((PDFFnType)toolItem.FnType)
+                {
+                    case PDFFnType.Split:
+
+                        viewer.InitDocument(dlg.FileName);
+                        DialogParameters splitvalue = new DialogParameters();
+                        splitvalue.Add(ParameterNames.PDFViewer, viewer);
+                        splitvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePageSplitDialog, splitvalue, e => { });
                         break;
-                    case PDFFnType.BatchRemove:
-                        DialogParameters batchremovepdf = new DialogParameters();
-                        batchremovepdf.Add(ParameterNames.BatchProcessing_Name, "7");
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 7;
-                        batchremovepdf.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, batchremovepdf, e => { });
-
-                        break;
-                }
-
-            }
-        }
-
-
-
-        private void Expend()
-        {
-            IsExpendTools = !IsExpendTools;
-            ExpendToolsHanlder?.Invoke(null, IsExpendTools);
-        }
-
-        private void OpenMenu(object obj)
-        {
-            var menu = App.Current.FindResource("ExpendToolsContextMenu") as ContextMenu;
-            var btn = obj as Button;
-            if (menu != null && btn != null)
-            {
-                if(menu.Items.Count == 1)
-                {
-                  var item = menu.Items[0] as MenuItem;
-                    if(_isExpendTools)
-                    {
-                        item.Header = "收缩";
-                    }
-                    else
-                    {
-                        item.Header = "展开";
-                    }
-
-                    item.Command = ExpendCommand;
-                    //btn.ContextMenu = menu;
-                    menu.PlacementTarget = btn;
-                    menu.IsOpen = true;
-                }
-            }
-        }
-
-
-
-    }
-}
+
+                    case PDFFnType.Extract:
+                        viewer.InitDocument(dlg.FileName);
+                        DialogParameters extractvalue = new DialogParameters();
+                        extractvalue.Add(ParameterNames.PDFViewer, viewer);
+                        extractvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePageExtractDialog, extractvalue, e => { });
+                        break;
+
+                    case PDFFnType.Insert:
+                        viewer.InitDocument(dlg.FileName);
+                        DialogParameters insertvalue = new DialogParameters();
+                        insertvalue.Add(ParameterNames.PDFViewer, viewer);
+                        insertvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePageInsertDialog, insertvalue, e => { });
+                        break;
+
+                    case PDFFnType.Compress:
+                        DialogParameters compresspdf = new DialogParameters();
+                        compresspdf.Add(ParameterNames.BatchProcessing_Name, "1");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 1;
+                        compresspdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, compresspdf, e => { });
+                        break;
+
+                    case PDFFnType.ImageToPDF:
+                        DialogParameters picturetopdf = new DialogParameters();
+                        picturetopdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePagePictureToPDFDialog, picturetopdf, e => { });
+                        break;
+
+                    case PDFFnType.Print:
+                        viewer.InitDocument(dlg.FileName);
+                        DialogParameters printvalue = new DialogParameters();
+                        printvalue.Add(ParameterNames.PDFViewer, viewer);
+                        printvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePagePrinterDialog, printvalue, e => { });
+                        break;
+
+                    case PDFFnType.Security:
+                        DialogParameters securitypdf = new DialogParameters();
+                        securitypdf.Add(ParameterNames.BatchProcessing_Name, "2");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 2;
+                        securitypdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, securitypdf, e => { });
+
+                        break;
+                    case PDFFnType.ConvertPDF:
+                        DialogParameters convertpdf = new DialogParameters();
+                        convertpdf.Add(ParameterNames.BatchProcessing_Name, "0");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
+                        convertpdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdf, e => { });
+
+                        break;
+                    case PDFFnType.BatchRemove:
+                        DialogParameters batchremovepdf = new DialogParameters();
+                        batchremovepdf.Add(ParameterNames.BatchProcessing_Name, "7");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 7;
+                        batchremovepdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, batchremovepdf, e => { });
+                        break;
+                    case PDFFnType.HeaderFooter:
+                        DialogParameters headerFooterpdf = new DialogParameters();
+                        headerFooterpdf.Add(ParameterNames.BatchProcessing_Name, "6");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 5;
+                        headerFooterpdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, headerFooterpdf, e => { });
+                        break;
+                    case PDFFnType.BatesNumbers:
+                        DialogParameters batesNumberspdf = new DialogParameters();
+                        batesNumberspdf.Add(ParameterNames.BatchProcessing_Name, "6");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 6;
+                        batesNumberspdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, batesNumberspdf, e => { });
+                        break;
+                    case PDFFnType.Background:
+                        DialogParameters backgroundpdf = new DialogParameters();
+                        backgroundpdf.Add(ParameterNames.BatchProcessing_Name, "4");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 4;
+                        backgroundpdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, backgroundpdf, e => { });
+                        break;
+                    case PDFFnType.WaterMark:
+                        DialogParameters watermarkpdf = new DialogParameters();
+                        watermarkpdf.Add(ParameterNames.BatchProcessing_Name, "3");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 3;
+                        watermarkpdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, watermarkpdf, e => { });
+                        break;
+                }
+
+            }
+        }
+
+
+
+        private void Expend()
+        {
+            IsExpendTools = !IsExpendTools;
+            ExpendToolsHanlder?.Invoke(null, IsExpendTools);
+        }
+
+        private void OpenMenu(object obj)
+        {
+            var menu = App.Current.FindResource("ExpendToolsContextMenu") as ContextMenu;
+            var btn = obj as Button;
+            if (menu != null && btn != null)
+            {
+                if(menu.Items.Count == 1)
+                {
+                  var item = menu.Items[0] as MenuItem;
+                    if(_isExpendTools)
+                    {
+                        item.Header = "收缩";
+                    }
+                    else
+                    {
+                        item.Header = "展开";
+                    }
+
+                    item.Command = ExpendCommand;
+                    //btn.ContextMenu = menu;
+                    menu.PlacementTarget = btn;
+                    menu.IsOpen = true;
+                }
+            }
+        }
+
+
+
+    }
+}

+ 8 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundDialog.xaml

@@ -3,6 +3,7 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
              xmlns:prism="http://prismlibrary.com/"
              prism:ViewModelLocator.AutoWireViewModel="True"
              xmlns:convert="clr-namespace:PDF_Office.DataConvert"
@@ -44,6 +45,13 @@
                     <ListView.View>
                         <GridView>
                             <GridViewColumn  Header="文档名"  Width="400" DisplayMemberBinding="{Binding FileName}"/>
+                            <GridViewColumn Header="页面范围" Width="170" >
+                                <GridViewColumn.CellTemplate>
+                                    <DataTemplate>
+                                        <cus:WritableComboBox Height="24" Width="140" Margin="0,8,0,0" Text="{Binding FilePageRangeText,Mode=TwoWay}" SelectedIndex="{Binding FilePageRangeSelectIndex,Mode=TwoWay}"></cus:WritableComboBox>
+                                    </DataTemplate>
+                                </GridViewColumn.CellTemplate>
+                            </GridViewColumn>
                             <GridViewColumn Header="大小" Width="100" DisplayMemberBinding="{Binding FileSize}"/>
                             <GridViewColumn Header="状态" Width="80" >
                                 <GridViewColumn.CellTemplate>

+ 182 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContent.xaml

@@ -0,0 +1,182 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBates.HomePageBatesCreateContent"
+              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+             xmlns:CompositeControl="clr-namespace:PDF_Office.CustomControl.CompositeControl"
+             mc:Ignorable="d"
+             d:DesignHeight="720"
+             d:DesignWidth="260" >
+    <UserControl.Resources>
+        <ResourceDictionary >
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../../../../Styles/RadioButtonStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="40"></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Grid.Row="0" Visibility="{Binding CreateBaseVisible, Mode=TwoWay}">
+            <Button  Height="24" Width="98" HorizontalAlignment="Left" Margin="16,0,0,0"  Command="{Binding EnterTemplateListCommand}">
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="&lt;" Margin="0,0,9,0" FontSize="16"></TextBlock>
+                    <TextBlock Text="创建Bates" FontSize="16"></TextBlock>
+                </StackPanel>
+            </Button>
+            <Button  Height="20" Width="64" Margin="0,0,16,0" HorizontalAlignment="Right" Command="{Binding SaveToTemplateListCommand}">
+                <StackPanel>
+                    <TextBlock Text="保存至模板"  Foreground="#18A0FB"></TextBlock>
+                    <Rectangle Height="1" Fill="#18A0FB"></Rectangle>
+                </StackPanel>
+            </Button>
+        </Grid>
+        <Grid Grid.Row="0" Visibility="{Binding EditBaseVisible, Mode=TwoWay}">
+            <Button  Height="24" Width="90" HorizontalAlignment="Left" Margin="16,0,0,0"  Command="{Binding EnterTemplateListCommand}">
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="&lt;" Margin="0,0,9,0" FontSize="16"></TextBlock>
+                    <TextBlock Text="编辑模板" FontSize="16"></TextBlock>
+                </StackPanel>
+            </Button>
+            <Button  Height="20" Width="64" Margin="0,0,16,0" HorizontalAlignment="Right" Command="{Binding SaveToCurrentTemplateListCommand}">
+                <StackPanel>
+                    <TextBlock Text="保存"  Foreground="#18A0FB"></TextBlock>
+                    <Rectangle Height="1" Fill="#18A0FB"></Rectangle>
+                </StackPanel>
+            </Button>
+        </Grid>
+        <Grid Grid.Row="1">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="116"></RowDefinition>
+                <RowDefinition Height="116"></RowDefinition>
+                <RowDefinition Height="189"></RowDefinition>
+                <RowDefinition Height="172"></RowDefinition>
+                <RowDefinition></RowDefinition>
+            </Grid.RowDefinitions>
+            <Grid Grid.Row="0" Margin="0,16,0,0" Width="228">
+                <StackPanel>
+                    <TextBlock Text="外观" FontSize="12" Foreground="#666666" Height="20" Width="24" HorizontalAlignment="Left"></TextBlock>
+                    <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
+                        <ComboBox Width="154" Height="32"  ItemsSource="{Binding FontNameList}" SelectedIndex="{Binding FontNameSelectedIndex}"></ComboBox>
+                        <ComboBox Width="66" Height="32" Margin="8,0,0,0" ItemsSource="{Binding FontSizeList}" SelectedIndex="{Binding FontSizeSelectedIndex}"></ComboBox>
+                    </StackPanel>
+                    <CompositeControl:ColorContent x:Name="cusColor" Height="32" Width="66"  Margin="0,8,0,0"  HorizontalAlignment="Left">
+                    </CompositeControl:ColorContent>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="1" Margin="0,16,0,0" Width="228">
+                <StackPanel>
+                    <TextBlock Text="页边距" FontSize="12" Foreground="#666666" Height="20" Width="36" HorizontalAlignment="Left"></TextBlock>
+                    <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
+                        <StackPanel Orientation="Vertical" Margin="0,0,0,0">
+                            <StackPanel Orientation="Horizontal">
+                                <TextBlock Text="上"  Width="14" Height="20" VerticalAlignment="Center"/>
+                                <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0" Text="{Binding MarginTopValue,Mode=TwoWay}"></cus:NumericUpDown>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
+                                <TextBlock Text="左" Width="14" Height="20" VerticalAlignment="Center"/>
+                                <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding MarginLeftValue,Mode=TwoWay}"></cus:NumericUpDown>
+                            </StackPanel>
+                        </StackPanel>
+                        <StackPanel Orientation="Vertical" Margin="51,0,0,0">
+                            <StackPanel Orientation="Horizontal">
+                                <TextBlock Text="下"  Width="14" Height="20" VerticalAlignment="Center"/>
+                                <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding MarginDownValue,Mode=TwoWay}"></cus:NumericUpDown>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
+                                <TextBlock Text="右" Width="14" Height="20" VerticalAlignment="Center"/>
+                                <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding MarginRightValue,Mode=TwoWay}"></cus:NumericUpDown>
+                            </StackPanel>
+                        </StackPanel>
+                    </StackPanel>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="2" Margin="0,16,0,0" Width="228">
+                <StackPanel>
+                    <StackPanel>
+                        <TextBlock Text="前缀" FontSize="12" Foreground="#666666" Height="20" Width="24" HorizontalAlignment="Left"></TextBlock>
+                        <TextBox Name="PrefixTextValueTextBox" Height="32">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="TextChanged">
+                                    <i:InvokeCommandAction Command="{Binding TextValueChangedCommand}" CommandParameter="{Binding ElementName=PrefixTextValueTextBox}" />
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </TextBox>
+                    </StackPanel>
+                    <StackPanel Margin="0,8,0,0">
+                        <TextBlock Text="后缀" FontSize="12" Foreground="#666666" Height="20" Width="24" HorizontalAlignment="Left"></TextBlock>
+                        <TextBox Name="SuffixTextValueTextBox" Height="32">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="TextChanged">
+                                    <i:InvokeCommandAction Command="{Binding TextValueChangedCommand}" CommandParameter="{Binding ElementName=SuffixTextValueTextBox}" />
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </TextBox>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
+                        <StackPanel>
+                            <TextBlock Text="位数" FontSize="12" Foreground="#666666" Height="20" Width="24" HorizontalAlignment="Left"></TextBlock>
+                            <cus:NumericUpDown Height="32" Width="110" Text="{Binding DigitNumberValue,Mode=TwoWay}"></cus:NumericUpDown>
+                        </StackPanel>
+                        <StackPanel Margin="8,0,0,0">
+                            <TextBlock Text="起始页" FontSize="12" Foreground="#666666" Height="20" Width="36" HorizontalAlignment="Left"></TextBlock>
+                            <ComboBox Height="32" Width="110" ItemsSource="{Binding StarPagetNumberList}" SelectedIndex="{Binding StarPagetNumberIndex}"></ComboBox>
+                        </StackPanel>
+                    </StackPanel>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="3" Margin="0,16,0,0" Width="228">
+                <StackPanel>
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Text="布局&amp;内容" FontSize="12" Foreground="#666666" Height="20" Width="60"></TextBlock>
+                        <Button Width="22" Height="22" Margin="146,0,0,0" Click="Button_Click" >
+                            <TextBlock Text="+" FontSize="19" HorizontalAlignment="Center" VerticalAlignment="Center"  Block.TextAlignment="Center" ></TextBlock>
+                            <Button.ContextMenu>
+                                <ContextMenu Name="contextMenu">
+                                    <MenuItem Name="ADDPages" Header="插入Bates" Click="ADDBates_Click" >
+                                    </MenuItem>
+                                </ContextMenu>
+                            </Button.ContextMenu>
+                        </Button>
+                    </StackPanel>
+                    <Grid Width="228" Height="46" Margin="0,6,0,0">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="76"></ColumnDefinition>
+                            <ColumnDefinition Width="76"></ColumnDefinition>
+                            <ColumnDefinition Width="76"></ColumnDefinition>
+                        </Grid.ColumnDefinitions>
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="23"></RowDefinition>
+                            <RowDefinition Height="23"></RowDefinition>
+                        </Grid.RowDefinitions>
+                        <RadioButton Grid.Column="0" Grid.Row="0" Tag="0" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" ></RadioButton>
+                        <RadioButton Grid.Column="1" Grid.Row="0" Tag="1" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" ></RadioButton>
+                        <RadioButton Grid.Column="2" Grid.Row="0" Tag="2" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" ></RadioButton>
+                        <RadioButton Grid.Column="0" Grid.Row="1" Tag="3" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"></RadioButton>
+                        <RadioButton Grid.Column="1" Grid.Row="1" Tag="4" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"  ></RadioButton>
+                        <RadioButton Grid.Column="2" Grid.Row="1" Tag="5" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"></RadioButton>
+                    </Grid>
+                    <TextBox Name="TextValueTextBox" Height="72" Margin="0,8,0,0" Text="{Binding TextValue}"  Foreground="{Binding SolidColorBrush}" FontSize="14"  AcceptsReturn="True">
+                        <i:Interaction.Triggers>
+                            <i:EventTrigger EventName="TextChanged">
+                                <i:InvokeCommandAction Command="{Binding TextValueChangedCommand}" CommandParameter="{Binding ElementName=TextValueTextBox}" />
+                            </i:EventTrigger>
+                        </i:Interaction.Triggers>
+                    </TextBox>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="4" Margin="0,16,0,0" Width="228">
+                <StackPanel>
+                    <TextBlock Text="页面范围" FontSize="12" Foreground="#666666" Height="20" Width="48" HorizontalAlignment="Left"></TextBlock>
+                    <cus:WritableComboBox Height="32" Margin="0,8,0,0" Text="{Binding PageRangeText,Mode=TwoWay}" SelectedIndex="{Binding PageRangeSelectIndex,Mode=TwoWay}"></cus:WritableComboBox>
+                </StackPanel>
+            </Grid>
+        </Grid>
+    </Grid>
+</UserControl>

+ 40 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContent.xaml.cs

@@ -0,0 +1,40 @@
+using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBates;
+using PDF_Office.ViewModels.EditTools.Bates;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBates
+{
+    /// <summary>
+    /// Interaction logic for HomePageBatesCreateContent
+    /// </summary>
+    public partial class HomePageBatesCreateContent : UserControl
+    {
+        private HomePageBatesCreateContentViewModel viewModel;
+        public HomePageBatesCreateContent()
+        {
+            viewModel = this.DataContext as HomePageBatesCreateContentViewModel;
+            InitializeComponent();
+            cusColor.SelectedColorHandler += cusColor_SelectedColor;
+        }
+
+        private void cusColor_SelectedColor(object sender, Color e)
+        {
+            var data = this.DataContext as BatesCreateContentViewModel;
+            if (data != null)
+            {
+                data.SelectedColorChangedCommand?.Execute(e);
+            }
+        }
+
+        private void ADDBates_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            viewModel.ADDBatesCommand?.Execute();
+        }
+
+        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            contextMenu.IsOpen = true;
+        }
+    }
+}

+ 13 - 4
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesDialog.xaml

@@ -2,6 +2,7 @@
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              xmlns:prism="http://prismlibrary.com/"
              prism:ViewModelLocator.AutoWireViewModel="True"
@@ -43,7 +44,14 @@
                     </ListView.ContextMenu>
                     <ListView.View>
                         <GridView>
-                            <GridViewColumn  Header="文档名"  Width="400" DisplayMemberBinding="{Binding FileName}"/>
+                            <GridViewColumn  Header="文档名"  Width="230" DisplayMemberBinding="{Binding FileName}"/>
+                            <GridViewColumn Header="页面范围" Width="170" >
+                                <GridViewColumn.CellTemplate>
+                                    <DataTemplate>
+                                        <cus:WritableComboBox Height="24" Width="140" Margin="0,8,0,0" Text="{Binding FilePageRangeText,Mode=TwoWay}" SelectedIndex="{Binding FilePageRangeSelectIndex,Mode=TwoWay}"></cus:WritableComboBox>
+                                    </DataTemplate>
+                                </GridViewColumn.CellTemplate>
+                            </GridViewColumn>
                             <GridViewColumn Header="大小" Width="100" DisplayMemberBinding="{Binding FileSize}"/>
                             <GridViewColumn Header="状态" Width="80" >
                                 <GridViewColumn.CellTemplate>
@@ -118,9 +126,10 @@
                 <RowDefinition Height="*"/>
                 <RowDefinition Height="72"/>
             </Grid.RowDefinitions>
-            <StackPanel Orientation="Vertical" Margin="15,16,0,0" Grid.Row="0">
-            </StackPanel>
-            <Grid Grid.Row="2">
+            <Grid Grid.Row="0" Background="#F3F3F3">
+                <ContentControl prism:RegionManager.RegionName="{Binding BatesSettingsRegionName}" Visibility="{Binding BatesSettingsVisible}"></ContentControl>
+            </Grid>
+            <Grid Grid.Row="1">
                 <Button Height="40" Width="228" Background="Black" Command="{Binding CreateCommand}">
                     <TextBlock Text="Apply" FontSize="18" Foreground="White"/>
                 </Button>

+ 128 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesTemplateListContent.xaml

@@ -0,0 +1,128 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBates.HomePageBatesTemplateListContent"
+            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"      
+             xmlns:data ="clr-namespace:PDFSettings;assembly=PDFSettings"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             mc:Ignorable="d"
+             d:DesignHeight="720"
+             d:DesignWidth="260" >
+    <UserControl.Resources>
+        <ContextMenu x:Key="FlyoutMenu" FontSize="14" >
+            <ContextMenu.ItemContainerStyle>
+                <Style TargetType="{x:Type MenuItem}">
+                    <Setter Property="Padding" Value="0,8,0,8"/>
+                    <Setter Property="VerticalContentAlignment" Value="Center"/>
+                </Style>
+            </ContextMenu.ItemContainerStyle>
+            <MenuItem Name="MenuEdit" Header="编辑模板" Click="MenuEdit_Click" >
+            </MenuItem>
+            <MenuItem Name="MenuDeleteCurrent" Header="删除模板"  Click="MenuDeleteCurrent_Click">
+            </MenuItem>
+            <MenuItem Name="MenuDeleteAll" Header="删除全部" Click="MenuDeleteAll_Click"></MenuItem>
+        </ContextMenu>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="40"></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Grid.Row="0">
+            <TextBlock Width="43" Height="24" Text="Bates" FontSize="16" Margin="16,0,16,0" HorizontalAlignment="Left"></TextBlock>
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+                <Button  Height="20" Width="20"></Button>
+                <Button  Height="20" Width="20" Margin="16,0,16,0" Command="{Binding EnterCreateCommand}"></Button>
+            </StackPanel>
+        </Grid>
+        <Grid Background="#F3F3F3" Grid.Row="1">
+            <ListBox
+                                Width="260" 
+                                BorderThickness="0"
+                                ScrollViewer.CanContentScroll="True"
+                                ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                                ScrollViewer.VerticalScrollBarVisibility="Hidden"
+                                VirtualizingPanel.IsVirtualizing="True"
+                                VirtualizingPanel.VirtualizationMode="Standard"
+                                VirtualizingPanel.CacheLengthUnit="Page"
+                                VirtualizingPanel.CacheLength="1"
+                                VirtualizingPanel.ScrollUnit="Pixel"   
+                                Background="#F3F3F3"
+                 ItemsSource="{Binding BatesModCollection}"  
+            SelectionChanged="ListBox_SelectionChanged">
+
+                <ListBox.ItemContainerStyle>
+                    <Style TargetType="ListBoxItem">
+                        <Setter Property="Margin" Value="11"/>
+                        <Setter Property="Padding" Value="0 0 0 0"/>
+                        <Setter Property="Width" Value="238"/>
+                        <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
+                        <Setter Property="Template" Value="{DynamicResource EditToolsItemControlTemplate}"/>
+                    </Style>
+                </ListBox.ItemContainerStyle>
+                <ListBox.ItemTemplate>
+                    <DataTemplate DataType="{x:Type data:BatesHeaderFooterItem}">
+                        <StackPanel Name="itemPanel" Loaded="itemPanel_Loaded">
+                            <Border BorderThickness="1" BorderBrush="#A0A2AE">
+                                <Grid  Width="238" HorizontalAlignment="Left">
+                                    <StackPanel >
+                                        <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
+                                            <TextBlock Text="页眉页脚名称" Height="22" Width="98" FontSize="14" FontWeight="Black"></TextBlock>
+                                            <TextBlock Name="TemplateIndexTextBox"  FontSize="14" Width="120"></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,8,0,0" Visibility="{Binding ElementName=LeftHeaderTextBox,Path=Visibility}">
+                                            <TextBlock Text="左侧页眉:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="LeftHeaderTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22" ></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=RightHeaderTextBox,Path=Visibility}">
+                                            <TextBlock Text="右侧页眉:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="RightHeaderTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=CenterHeaderTextBox,Path=Visibility}">
+                                            <TextBlock Text="中间页眉:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="CenterHeaderTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=LeftFooterTextBox,Path=Visibility}">
+                                            <TextBlock Text="左侧页脚:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="LeftFooterTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=RightFooterTextBox,Path=Visibility}">
+                                            <TextBlock Text="右侧页脚:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="RightFooterTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=CenterFooterTextBox,Path=Visibility}">
+                                            <TextBlock Text="中间页脚:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="CenterFooterTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
+                                        </StackPanel>
+
+                                    </StackPanel>
+                                    <Button Name="EditTemplateBtn" Height="43" Width="63" HorizontalAlignment="Left" VerticalAlignment="Bottom" Click="EditTemplateBtn_Click"></Button>
+                                    <Button Name="DeleteTemplateBtn"  Height="43" Width="63" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="DeleteTemplateBtn_Click">
+                                    </Button>
+                                </Grid>
+                            </Border>
+                        </StackPanel>
+                        <DataTemplate.Triggers>
+                            <Trigger Property="IsMouseOver" Value="True">
+                                <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Visible"/>
+                                <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Visible"/>
+                            </Trigger>
+                            <Trigger Property="IsMouseOver" Value="False">
+                                <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Collapsed"/>
+                                <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Collapsed"/>
+                            </Trigger>
+                        </DataTemplate.Triggers>
+                    </DataTemplate>
+                </ListBox.ItemTemplate>
+            </ListBox>
+            <Grid Width="140"  Margin="64,153,56,0" Visibility="{Binding CreateTemplateVisible, Mode=OneWay}">
+                <StackPanel Orientation="Vertical">
+                    <Label Height="87" Width="87" HorizontalAlignment="Center" Background="BlueViolet"></Label>
+                    <TextBlock Height="24" FontSize="14" Text="请先创建一个Bates模板" Margin="0,8,0,0" VerticalAlignment="Center" ></TextBlock>
+                    <Button Height="24" Width="44" Margin="0,12,0,0" Content ="新建" Command="{Binding AddTemplateCommand}"></Button>
+                </StackPanel>
+            </Grid>
+        </Grid>
+    </Grid>
+</UserControl>

+ 83 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesTemplateListContent.xaml.cs

@@ -0,0 +1,83 @@
+using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBates;
+using PDF_Office.ViewModels.EditTools.Bates;
+using PDFSettings;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBates
+{
+    /// <summary>
+    /// Interaction logic for HomePageBatesTemplateListContent
+    /// </summary>
+    public partial class HomePageBatesTemplateListContent : UserControl
+    {
+        private HomePageBatesTemplateListContentViewModel viewModel;
+        public HomePageBatesTemplateListContent()
+        {
+            InitializeComponent();
+            viewModel = this.DataContext as HomePageBatesTemplateListContentViewModel;
+        }
+        private void DeleteTemplateBtn_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            viewModel.DeleteTemplateItemCommand?.Execute(sender);
+        }
+
+
+        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            var listBox = sender as ListBox;
+            viewModel.SelectTemplateItemCommand?.Execute(sender);
+            listBox.SelectedIndex = -1;
+        }
+
+        private void MenuEdit_Click(object sender, RoutedEventArgs e)
+        {
+            viewModel.EditTemplateItemCommand?.Execute(sender);
+        }
+
+        private void MenuDeleteCurrent_Click(object sender, RoutedEventArgs e)
+        {
+            viewModel.DeleteTemplateItemCommand?.Execute(sender);
+        }
+
+        private void MenuDeleteAll_Click(object sender, RoutedEventArgs e)
+        {
+            viewModel.DeleteAllTemplateItemCommand?.Execute();
+        }
+
+        private void EditTemplateBtn_Click(object sender, RoutedEventArgs e)
+        {
+            viewModel.EditTemplateItemCommand?.Execute(sender);
+        }
+
+        private void itemPanel_Loaded(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                StackPanel panel = sender as StackPanel;
+                var data = panel.DataContext as BatesHeaderFooterItem;
+                var TemplateIndex = panel.FindName("TemplateIndexTextBox") as TextBlock;
+                var LeftHeader = panel.FindName("LeftHeaderTextBox") as TextBlock;
+                var RightHeader = panel.FindName("RightHeaderTextBox") as TextBlock;
+                var CenterHeader = panel.FindName("CenterHeaderTextBox") as TextBlock;
+                var LeftFooter = panel.FindName("LeftFooterTextBox") as TextBlock;
+                var RightFooter = panel.FindName("RightFooterTextBox") as TextBlock;
+                var CenterFooter = panel.FindName("CenterFooterTextBox") as TextBlock;
+                List<TextBlock> textBlocks = new List<TextBlock>() { LeftHeader, RightHeader, CenterHeader, LeftFooter, RightFooter, CenterFooter };
+                if (data.TextData != null)
+                {
+                    TemplateIndex.Text = data.ItemName;
+                    foreach (var textBlock in textBlocks)
+                    {
+                        textBlock.Text = data.TextData[textBlocks.IndexOf(textBlock)].text;
+                        if (textBlock.Text == "") { textBlock.Visibility = Visibility.Collapsed; }
+                        else { textBlock.Visibility = Visibility.Visible; }
+                    }
+                }
+            }
+            catch { }
+        }
+    }
+}
+

+ 170 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterCreateContent.xaml

@@ -0,0 +1,170 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageHeaderFooter.HomePageHeaderFooterCreateContent"
+            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+             xmlns:CompositeControl="clr-namespace:PDF_Office.CustomControl.CompositeControl"
+             mc:Ignorable="d"
+             d:DesignHeight="720"
+             d:DesignWidth="260" >
+    <UserControl.Resources>
+        <ResourceDictionary >
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../../../../Styles/RadioButtonStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="40"></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Grid.Row="0" Visibility="{Binding CreateBaseVisible, Mode=TwoWay}">
+            <Button  Height="24" Width="124" HorizontalAlignment="Left" Margin="16,0,0,0"  Command="{Binding EnterTemplateListCommand}">
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="&lt;" Margin="0,0,9,0" FontSize="16"></TextBlock>
+                    <TextBlock Text="创建页眉页脚" FontSize="16"></TextBlock>
+                </StackPanel>
+            </Button>
+            <Button  Height="20" Width="64" Margin="0,0,16,0" HorizontalAlignment="Right" Command="{Binding SaveToTemplateListCommand}">
+                <StackPanel>
+                    <TextBlock Text="保存至模板"  Foreground="#18A0FB"></TextBlock>
+                    <Rectangle Height="1" Fill="#18A0FB"></Rectangle>
+                </StackPanel>
+            </Button>
+        </Grid>
+        <Grid Grid.Row="0" Visibility="{Binding EditBaseVisible, Mode=TwoWay}">
+            <Button  Height="24" Width="90" HorizontalAlignment="Left" Margin="16,0,0,0"  Command="{Binding EnterTemplateListCommand}">
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="&lt;" Margin="0,0,9,0" FontSize="16"></TextBlock>
+                    <TextBlock Text="编辑模板" FontSize="16"></TextBlock>
+                </StackPanel>
+            </Button>
+            <Button  Height="20" Width="64" Margin="0,0,16,0" HorizontalAlignment="Right" Command="{Binding SaveToCurrentTemplateListCommand}">
+                <StackPanel>
+                    <TextBlock Text="保存"  Foreground="#18A0FB"></TextBlock>
+                    <Rectangle Height="1" Fill="#18A0FB"></Rectangle>
+                </StackPanel>
+            </Button>
+        </Grid>
+        <Grid Grid.Row="1">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="116"></RowDefinition>
+                <RowDefinition Height="116"></RowDefinition>
+                <RowDefinition Height="128"></RowDefinition>
+                <RowDefinition Height="172"></RowDefinition>
+                <RowDefinition></RowDefinition>
+            </Grid.RowDefinitions>
+            <Grid Grid.Row="0" Margin="0,16,0,0" Width="228">
+                <StackPanel>
+                    <TextBlock Text="外观" FontSize="12" Foreground="#666666" Height="20" Width="24" HorizontalAlignment="Left"></TextBlock>
+                    <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
+                        <ComboBox Width="154" Height="32" ItemsSource="{Binding FontNameList}" SelectedIndex="{Binding FontNameSelectedIndex}"></ComboBox>
+                        <ComboBox Width="66" Height="32" Margin="8,0,0,0" ItemsSource="{Binding FontSizeList}" SelectedIndex="{Binding FontSizeSelectedIndex}"></ComboBox>
+                    </StackPanel>
+                    <CompositeControl:ColorContent x:Name="cusColor" Height="32" Width="66"  Margin="0,8,0,0"  HorizontalAlignment="Left">
+                    </CompositeControl:ColorContent>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="1" Margin="0,16,0,0" Width="228">
+                <StackPanel>
+                    <TextBlock Text="页边距" FontSize="12" Foreground="#666666" Height="20" Width="36" HorizontalAlignment="Left"></TextBlock>
+                    <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
+                        <StackPanel Orientation="Vertical" Margin="0,0,0,0">
+                            <StackPanel Orientation="Horizontal">
+                                <TextBlock Text="上"  Width="14" Height="20" VerticalAlignment="Center"/>
+                                <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0" Text="{Binding MarginTopValue,Mode=TwoWay}"></cus:NumericUpDown>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
+                                <TextBlock Text="左" Width="14" Height="20" VerticalAlignment="Center"/>
+                                <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding MarginLeftValue,Mode=TwoWay}"></cus:NumericUpDown>
+                            </StackPanel>
+                        </StackPanel>
+                        <StackPanel Orientation="Vertical" Margin="51,0,0,0">
+                            <StackPanel Orientation="Horizontal">
+                                <TextBlock Text="下"  Width="14" Height="20" VerticalAlignment="Center"/>
+                                <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding MarginDownValue,Mode=TwoWay}"></cus:NumericUpDown>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
+                                <TextBlock Text="右" Width="14" Height="20" VerticalAlignment="Center"/>
+                                <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding MarginRightValue,Mode=TwoWay}"></cus:NumericUpDown>
+                            </StackPanel>
+                        </StackPanel>
+                    </StackPanel>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="2" Margin="0,16,0,0" Width="228">
+                <StackPanel>
+                    <StackPanel>
+                        <TextBlock Text="日期" FontSize="12" Foreground="#666666" Height="20" Width="24" HorizontalAlignment="Left"></TextBlock>
+                        <ComboBox  Height="32" ItemsSource="{Binding DateTimeFormatList}" SelectedIndex="{Binding DateTimeFormatIndex}"></ComboBox>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
+                        <StackPanel>
+                            <TextBlock Text="页面" FontSize="12" Foreground="#666666" Height="20" Width="24" HorizontalAlignment="Left"></TextBlock>
+                            <ComboBox Height="32" Width="110" ItemsSource="{Binding PageNumberFormatList}" SelectedIndex="{Binding PageNumberFormatIndex}"></ComboBox>
+                        </StackPanel>
+                        <StackPanel Margin="8,0,0,0">
+                            <TextBlock Text="起始页" FontSize="12" Foreground="#666666" Height="20" Width="36" HorizontalAlignment="Left"></TextBlock>
+                            <ComboBox Height="32" Width="110" ItemsSource="{Binding StarPagetNumberList}" SelectedIndex="{Binding StarPagetNumberIndex}"></ComboBox>
+                        </StackPanel>
+                    </StackPanel>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="3" Margin="0,16,0,0" Width="228">
+                <StackPanel>
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Text="布局&amp;内容" FontSize="12" Foreground="#666666" Height="20" Width="60"></TextBlock>
+                        <Button Width="22" Height="22" Margin="146,0,0,0"  Click="Button_Click">
+                            <TextBlock Text="+" FontSize="19" HorizontalAlignment="Center" VerticalAlignment="Center"  Block.TextAlignment="Center" ></TextBlock>
+                            <Button.ContextMenu>
+                                <ContextMenu Name="contextMenu">
+                                    <MenuItem Name="ADDPages" Header="插入页码"  Click="ADDPages_Click" >
+
+                                    </MenuItem>
+                                    <MenuItem Name="ADDDate" Header="插入日期"  Click="ADDDate_Click">
+
+                                    </MenuItem>
+                                </ContextMenu>
+                            </Button.ContextMenu>
+                        </Button>
+                    </StackPanel>
+                    <Grid Width="228" Height="46" Margin="0,6,0,0">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="76"></ColumnDefinition>
+                            <ColumnDefinition Width="76"></ColumnDefinition>
+                            <ColumnDefinition Width="76"></ColumnDefinition>
+                        </Grid.ColumnDefinitions>
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="23"></RowDefinition>
+                            <RowDefinition Height="23"></RowDefinition>
+                        </Grid.RowDefinitions>
+                        <RadioButton Grid.Column="0" Grid.Row="0" Tag="0" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" ></RadioButton>
+                        <RadioButton Grid.Column="1" Grid.Row="0" Tag="1" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" ></RadioButton>
+                        <RadioButton Grid.Column="2" Grid.Row="0" Tag="2" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" ></RadioButton>
+                        <RadioButton Grid.Column="0" Grid.Row="1" Tag="3" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"></RadioButton>
+                        <RadioButton Grid.Column="1" Grid.Row="1" Tag="4" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"  ></RadioButton>
+                        <RadioButton Grid.Column="2" Grid.Row="1" Tag="5" GroupName="TextLocation" Height="23" Width="76" BorderThickness="1" BorderBrush="Black" Style="{StaticResource LocationRadioBtnStyle}" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"></RadioButton>
+                    </Grid>
+                    <TextBox Name="TextValueTextBox" Height="72" Margin="0,8,0,0" Text="{Binding TextValue}"  Foreground="{Binding SolidColorBrush}" FontSize="14"  AcceptsReturn="True">
+                        <i:Interaction.Triggers>
+                            <i:EventTrigger EventName="TextChanged">
+                                <i:InvokeCommandAction Command="{Binding TextValueChangedCommand}" CommandParameter="{Binding ElementName=TextValueTextBox}" />
+                            </i:EventTrigger>
+                        </i:Interaction.Triggers>
+                    </TextBox>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="4" Margin="0,16,0,0" Width="228">
+                <StackPanel>
+                    <TextBlock Text="页面范围" FontSize="12" Foreground="#666666" Height="20" Width="48" HorizontalAlignment="Left"></TextBlock>
+                    <cus:WritableComboBox Height="32" Margin="0,8,0,0" Text="{Binding PageRangeText,Mode=TwoWay}" SelectedIndex="{Binding PageRangeSelectIndex,Mode=TwoWay}"></cus:WritableComboBox>
+                </StackPanel>
+            </Grid>
+        </Grid>
+    </Grid>
+</UserControl>

+ 48 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterCreateContent.xaml.cs

@@ -0,0 +1,48 @@
+using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageHeaderFooter;
+using PDF_Office.ViewModels.EditTools.HeaderFooter;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageHeaderFooter
+{
+    /// <summary>
+    /// Interaction logic for HomePageHeaderFooterCreateContent
+    /// </summary>
+    public partial class HomePageHeaderFooterCreateContent : UserControl
+    {
+        private HomePageHeaderFooterCreateContentViewModel viewModel;
+
+        public HomePageHeaderFooterCreateContent()
+        {
+            InitializeComponent();
+            viewModel = this.DataContext as HomePageHeaderFooterCreateContentViewModel;
+            cusColor.SelectedColorHandler += cusColor_SelectedColor;
+        }
+
+        private void cusColor_SelectedColor(object sender, Color e)
+        {
+            var data = this.DataContext as HomePageHeaderFooterCreateContentViewModel;
+            if (data != null)
+            {
+                data.SelectedColorChangedCommand?.Execute(e);
+
+            }
+        }
+
+        private void ADDDate_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            viewModel.ADDDateCommand?.Execute();
+        }
+
+        private void ADDPages_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            viewModel.ADDPagesCommand?.Execute();
+        }
+
+        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            contextMenu.IsOpen = true;
+
+        }
+    }
+}

+ 13 - 4
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterDialog.xaml

@@ -2,6 +2,7 @@
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              xmlns:prism="http://prismlibrary.com/"
              prism:ViewModelLocator.AutoWireViewModel="True"
@@ -43,7 +44,14 @@
                     </ListView.ContextMenu>
                     <ListView.View>
                         <GridView>
-                            <GridViewColumn  Header="文档名"  Width="400" DisplayMemberBinding="{Binding FileName}"/>
+                            <GridViewColumn  Header="文档名"  Width="230" DisplayMemberBinding="{Binding FileName}"/>
+                            <GridViewColumn Header="页面范围" Width="170" >
+                                <GridViewColumn.CellTemplate>
+                                    <DataTemplate>
+                                        <cus:WritableComboBox Height="24" Width="140" Margin="0,8,0,0" Text="{Binding FilePageRangeText,Mode=TwoWay}" SelectedIndex="{Binding FilePageRangeSelectIndex,Mode=TwoWay}"></cus:WritableComboBox>
+                                    </DataTemplate>
+                                </GridViewColumn.CellTemplate>
+                            </GridViewColumn>
                             <GridViewColumn Header="大小" Width="100" DisplayMemberBinding="{Binding FileSize}"/>
                             <GridViewColumn Header="状态" Width="80" >
                                 <GridViewColumn.CellTemplate>
@@ -118,9 +126,10 @@
                 <RowDefinition Height="*"/>
                 <RowDefinition Height="72"/>
             </Grid.RowDefinitions>
-            <StackPanel Orientation="Vertical" Margin="15,16,0,0" Grid.Row="0">
-            </StackPanel>
-            <Grid Grid.Row="2">
+            <Grid Grid.Row="0" Background="#F3F3F3">
+                <ContentControl prism:RegionManager.RegionName="{Binding HeaderFooterSettingsRegionName}" Visibility="{Binding HeaderFooterSettingsVisible}"></ContentControl>
+            </Grid>
+            <Grid Grid.Row="1">
                 <Button Height="40" Width="228" Background="Black" Command="{Binding CreateCommand}">
                     <TextBlock Text="Apply" FontSize="18" Foreground="White"/>
                 </Button>

+ 129 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterTemplateListContent.xaml

@@ -0,0 +1,129 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageHeaderFooter.HomePageHeaderFooterTemplateListContent"
+              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"            
+             xmlns:data ="clr-namespace:PDFSettings;assembly=PDFSettings"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             mc:Ignorable="d"
+             d:DesignHeight="720"
+             d:DesignWidth="260" >
+    <UserControl.Resources>
+        <ContextMenu x:Key="FlyoutMenu" FontSize="14" >
+            <ContextMenu.ItemContainerStyle>
+                <Style TargetType="{x:Type MenuItem}">
+                    <Setter Property="Padding" Value="0,8,0,8"/>
+                    <Setter Property="VerticalContentAlignment" Value="Center"/>
+                </Style>
+            </ContextMenu.ItemContainerStyle>
+            <MenuItem Name="MenuEdit" Header="编辑模板" Click="MenuEdit_Click" >
+            </MenuItem>
+            <MenuItem Name="MenuDeleteCurrent" Header="删除模板"  Click="MenuDeleteCurrent_Click">
+            </MenuItem>
+            <MenuItem Name="MenuDeleteAll" Header="删除全部" Click="MenuDeleteAll_Click"></MenuItem>
+        </ContextMenu>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="40"></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Grid.Row="0">
+            <TextBlock Width="64" Height="24" Text="页眉页脚" FontSize="16" Margin="16,0,16,0" HorizontalAlignment="Left"></TextBlock>
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+                <Button  Height="20" Width="20"></Button>
+                <Button  Height="20" Width="20" Margin="16,0,16,0" Command="{Binding EnterCreateCommand}"></Button>
+            </StackPanel>
+        </Grid>
+        <Grid Background="#F3F3F3" Grid.Row="1">
+            <ListBox
+                                Width="260" 
+                                BorderThickness="0"
+                                ScrollViewer.CanContentScroll="True"
+                                ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                                ScrollViewer.VerticalScrollBarVisibility="Hidden"
+                                VirtualizingPanel.IsVirtualizing="True"
+                                VirtualizingPanel.VirtualizationMode="Standard"
+                                VirtualizingPanel.CacheLengthUnit="Page"
+                                VirtualizingPanel.CacheLength="1"
+                                VirtualizingPanel.ScrollUnit="Pixel"   
+                                Background="#F3F3F3"
+                 ItemsSource="{Binding HeaderFooterModCollection}"  
+            SelectionChanged="ListBox_SelectionChanged">
+
+                <ListBox.ItemContainerStyle>
+                    <Style TargetType="ListBoxItem">
+                        <Setter Property="Margin" Value="11,0,0,0"/>
+                        <Setter Property="Padding" Value="0 0 0 0"/>
+                        <Setter Property="Width" Value="238"/>
+                        <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
+                        <Setter Property="Template" Value="{DynamicResource EditToolsItemControlTemplate}"/>
+                    </Style>
+                </ListBox.ItemContainerStyle>
+                <ListBox.ItemTemplate>
+                    <DataTemplate DataType="{x:Type data:BatesHeaderFooterItem}">
+                        <StackPanel Name="itemPanel" Loaded="itemPanel_Loaded">
+                            <Border BorderThickness="1" BorderBrush="#A0A2AE">
+                                <Grid  Width="238" HorizontalAlignment="Left">
+                                    <StackPanel >
+                                        <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
+                                            <TextBlock Text="页眉页脚名称" Height="22" Width="98" FontSize="14" FontWeight="Black"></TextBlock>
+                                            <TextBlock Name="TemplateIndexTextBox"  FontSize="14" Width="120"></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,8,0,0" Visibility="{Binding ElementName=LeftHeaderTextBox,Path=Visibility}">
+                                            <TextBlock Text="左侧页眉:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="LeftHeaderTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22" ></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=RightHeaderTextBox,Path=Visibility}">
+                                            <TextBlock Text="右侧页眉:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="RightHeaderTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=CenterHeaderTextBox,Path=Visibility}">
+                                            <TextBlock Text="中间页眉:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="CenterHeaderTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=LeftFooterTextBox,Path=Visibility}">
+                                            <TextBlock Text="左侧页脚:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="LeftFooterTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=RightFooterTextBox,Path=Visibility}">
+                                            <TextBlock Text="右侧页脚:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="RightFooterTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
+                                        </StackPanel>
+                                        <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=CenterFooterTextBox,Path=Visibility}">
+                                            <TextBlock Text="中间页脚:"  FontSize="14" Height="22" Width="70"></TextBlock>
+                                            <TextBlock Name="CenterFooterTextBox"  FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
+                                        </StackPanel>
+
+                                    </StackPanel>
+                                    <Button Name="EditTemplateBtn" Height="43" Width="63" HorizontalAlignment="Left" VerticalAlignment="Bottom" Click="EditTemplateBtn_Click"></Button>
+                                    <Button Name="DeleteTemplateBtn"  Height="43" Width="63" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="DeleteTemplateBtn_Click">
+                                    </Button>
+                                </Grid>
+                            </Border>
+                        </StackPanel>
+                        <DataTemplate.Triggers>
+                            <Trigger Property="IsMouseOver" Value="True">
+                                <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Visible"/>
+                                <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Visible"/>
+                            </Trigger>
+                            <Trigger Property="IsMouseOver" Value="False">
+                                <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Collapsed"/>
+                                <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Collapsed"/>
+                            </Trigger>
+                        </DataTemplate.Triggers>
+                    </DataTemplate>
+                </ListBox.ItemTemplate>
+            </ListBox>
+            <Grid Width="140"  Margin="64,153,56,0" Visibility="{Binding CreateTemplateVisible, Mode=OneWay}">
+                <StackPanel Orientation="Vertical">
+                    <Label Height="87" Width="87" HorizontalAlignment="Center" Background="BlueViolet"></Label>
+                    <TextBlock Height="24" FontSize="14" Text="请先创建一个页眉页脚模板" Margin="0,8,0,0" VerticalAlignment="Center" ></TextBlock>
+                    <Button Height="24" Width="44" Margin="0,12,0,0" Content ="新建" Command="{Binding AddTemplateCommand}"></Button>
+                </StackPanel>
+            </Grid>
+        </Grid>
+    </Grid>
+</UserControl>
+

+ 84 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterTemplateListContent.xaml.cs

@@ -0,0 +1,84 @@
+using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageHeaderFooter;
+using PDF_Office.ViewModels.EditTools.HeaderFooter;
+using PDFSettings;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageHeaderFooter
+{
+    /// <summary>
+    /// Interaction logic for HomePageHeaderFooterTemplateListContent
+    /// </summary>
+    public partial class HomePageHeaderFooterTemplateListContent : UserControl
+    {
+            private HomePageHeaderFooterTemplateListContentViewModel viewModel;
+
+            public HomePageHeaderFooterTemplateListContent()
+            {
+                InitializeComponent();
+                viewModel = this.DataContext as HomePageHeaderFooterTemplateListContentViewModel;
+
+            }
+            private void DeleteTemplateBtn_Click(object sender, System.Windows.RoutedEventArgs e)
+            {
+                viewModel.DeleteTemplateItemCommand?.Execute(sender);
+            }
+
+
+            private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+            {
+                var listBox = sender as ListBox;
+                viewModel.SelectTemplateItemCommand?.Execute(sender);
+                listBox.SelectedIndex = -1;
+            }
+
+            private void MenuEdit_Click(object sender, RoutedEventArgs e)
+            {
+                viewModel.EditTemplateItemCommand?.Execute(sender);
+            }
+
+            private void MenuDeleteCurrent_Click(object sender, RoutedEventArgs e)
+            {
+                viewModel.DeleteTemplateItemCommand?.Execute(sender);
+            }
+
+            private void MenuDeleteAll_Click(object sender, RoutedEventArgs e)
+            {
+                viewModel.DeleteAllTemplateItemCommand?.Execute();
+            }
+
+            private void EditTemplateBtn_Click(object sender, RoutedEventArgs e)
+            {
+                viewModel.EditTemplateItemCommand?.Execute(sender);
+            }
+
+            private void itemPanel_Loaded(object sender, RoutedEventArgs e)
+            {
+                try
+                {
+                    StackPanel panel = sender as StackPanel;
+                    var data = panel.DataContext as BatesHeaderFooterItem;
+                    var TemplateIndex = panel.FindName("TemplateIndexTextBox") as TextBlock;
+                    var LeftHeader = panel.FindName("LeftHeaderTextBox") as TextBlock;
+                    var RightHeader = panel.FindName("RightHeaderTextBox") as TextBlock;
+                    var CenterHeader = panel.FindName("CenterHeaderTextBox") as TextBlock;
+                    var LeftFooter = panel.FindName("LeftFooterTextBox") as TextBlock;
+                    var RightFooter = panel.FindName("RightFooterTextBox") as TextBlock;
+                    var CenterFooter = panel.FindName("CenterFooterTextBox") as TextBlock;
+                    List<TextBlock> textBlocks = new List<TextBlock>() { LeftHeader, RightHeader, CenterHeader, LeftFooter, RightFooter, CenterFooter };
+                    if (data.TextData != null)
+                    {
+                        TemplateIndex.Text = data.ItemName;
+                        foreach (var textBlock in textBlocks)
+                        {
+                            textBlock.Text = data.TextData[textBlocks.IndexOf(textBlock)].text;
+                            if (textBlock.Text == "") { textBlock.Visibility = Visibility.Collapsed; }
+                            else { textBlock.Visibility = Visibility.Visible; }
+                        }
+                    }
+                }
+                catch { }
+            }
+        }
+    }

+ 8 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkDialog.xaml

@@ -3,6 +3,7 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
              xmlns:prism="http://prismlibrary.com/"
              prism:ViewModelLocator.AutoWireViewModel="True"
              xmlns:convert="clr-namespace:PDF_Office.DataConvert"
@@ -44,6 +45,13 @@
                     <ListView.View>
                         <GridView>
                             <GridViewColumn  Header="文档名"  Width="400" DisplayMemberBinding="{Binding FileName}"/>
+                            <GridViewColumn Header="页面范围" Width="170" >
+                                <GridViewColumn.CellTemplate>
+                                    <DataTemplate>
+                                        <cus:WritableComboBox Height="24" Width="140" Margin="0,8,0,0" Text="{Binding FilePageRangeText,Mode=TwoWay}" SelectedIndex="{Binding FilePageRangeSelectIndex,Mode=TwoWay}"></cus:WritableComboBox>
+                                    </DataTemplate>
+                                </GridViewColumn.CellTemplate>
+                            </GridViewColumn>
                             <GridViewColumn Header="大小" Width="100" DisplayMemberBinding="{Binding FileSize}"/>
                             <GridViewColumn Header="状态" Width="80" >
                                 <GridViewColumn.CellTemplate>

+ 3 - 3
PDF Office/Views/EditTools/HeaderFooter/HeaderFooterCreateContent.xaml

@@ -123,11 +123,11 @@
                             <TextBlock Text="+" FontSize="19" HorizontalAlignment="Center" VerticalAlignment="Center"  Block.TextAlignment="Center" ></TextBlock>
                             <Button.ContextMenu>
                                 <ContextMenu Name="contextMenu">
-                                    <MenuItem Name="ADDPages" Header="插入页码"  Click="ADDPages_Click" >
+                                    <MenuItem Name="ADDPages" Header="插入页码"  Click="ADDPages_Click" >
                                    
                                     </MenuItem>
-                                    <MenuItem Name="ADDDate" Header="插入日期"  Click="ADDDate_Click">
-                                        
+                                    <MenuItem Name="ADDDate" Header="插入日期"  Click="ADDDate_Click">
+                                        
                                     </MenuItem>
                                 </ContextMenu>
                             </Button.ContextMenu>