Forráskód Böngészése

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

zhuyi 2 éve
szülő
commit
9c69661cf2
19 módosított fájl, 143 hozzáadás és 88 törlés
  1. 42 10
      PDF Office/Helper/EditToolsHelper.cs
  2. 35 17
      PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs
  3. 2 3
      PDF Office/ViewModels/Dialog/BOTA/ScreenAnnotationDialogViewModel.cs
  4. 7 8
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateColorContentViewModel.cs
  5. 7 9
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateFileContentViewModel.cs
  6. 8 6
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContentViewModel.cs
  7. 12 4
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterDialogViewModel.cs
  8. 6 7
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterCreateContentViewModel.cs
  9. 8 8
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateFileContentViewModel.cs
  10. 7 7
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateTextContentViewModel.cs
  11. 1 1
      PDF Office/ViewModels/EditTools/Bates/BatesTemplateListContentViewModel.cs
  12. 1 1
      PDF Office/ViewModels/EditTools/HeaderFooter/HeaderFooterTemplateListContentViewModel.cs
  13. 1 1
      PDF Office/ViewModels/EditTools/Watermark/WatermarkTemplateListFileContentViewModel.cs
  14. 1 1
      PDF Office/ViewModels/EditTools/Watermark/WatermarkTemplateListTextContentViewModel.cs
  15. 1 1
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateColorContent.xaml
  16. 1 1
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContent.xaml
  17. 1 1
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterCreateContent.xaml
  18. 1 1
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateFileContent.xaml
  19. 1 1
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateTextContent.xaml

+ 42 - 10
PDF Office/Helper/EditToolsHelper.cs

@@ -122,29 +122,52 @@ namespace PDF_Office.Helper
             }
         }
 
-        public static void GetPageRange(int SelectedIndex, CPDFDocument document, ref string PageRange, string pageRangeText)
+        public static void GetPageRange(int SelectedIndex, CPDFDocument document, ref string PageRange, string pageRangeText,bool isOne=false)
         {
 
             switch (SelectedIndex)
             {
                 case 0:
                     {
-                        PageRange = "0-" + (document.PageCount - 1);
+                        if (isOne)
+                        {
+                            PageRange = "1-" + (document.PageCount);
+                        }
+                        else { PageRange = "0-" + (document.PageCount - 1); }
+                        
                     }
                     break;
                 case 1:
                     {
-                        PageRange = "0";
-                        for (int i = 2; i <= (document.PageCount - 1); i += 2)
-                            PageRange = PageRange + "," + i;
+                        if (isOne)
+                        {
+                            PageRange = "1";
+                            for (int i = 3; i <= (document.PageCount); i += 2)
+                                PageRange = PageRange + "," + i;
+                        }
+                        else {
+                            PageRange = "0";
+                            for (int i = 2; i <= (document.PageCount - 1); i += 2)
+                                PageRange = PageRange + "," + i;
+                        }
+                        
                     }
                     break;
                 case 2:
                     if (document.PageCount >= 2)
                     {
-                        PageRange = "1";
-                        for (int i = 3; i <= (document.PageCount - 1); i += 2)
-                            PageRange = PageRange + "," + i;
+                        if (isOne)
+                        {
+                           PageRange = "2";
+                            for (int i = 4; i <= (document.PageCount); i += 2)
+                                PageRange = PageRange + "," + i;
+                        }
+                        else
+                        {
+                             PageRange = "1";
+                            for (int i = 3; i <= (document.PageCount - 1); i += 2)
+                                PageRange = PageRange + "," + i;
+                        }
                     }
                     else
                     {
@@ -152,8 +175,17 @@ namespace PDF_Office.Helper
                     }
                     break;
                 case 3:
-                    PageRange = ParseRange(pageRangeText);
-                    Trace.WriteLine("PageRange : " + PageRange);
+                    if (isOne)
+                    {
+                        PageRange = pageRangeText;
+                        Trace.WriteLine("PageRange : " + PageRange);
+                    }
+                    else
+                    {
+                        PageRange = ParseRange(pageRangeText);
+                        Trace.WriteLine("PageRange : " + PageRange);
+                    }
+                       
                     break;
                 default:
                     break;

+ 35 - 17
PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs

@@ -31,6 +31,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
+using System.Windows.Annotations;
 using System.Windows.Annotations.Storage;
 using System.Windows.Controls;
 using System.Windows.Data;
@@ -74,6 +75,8 @@ namespace PDF_Office.ViewModels.BOTA
         }
 
         private ObservableCollection<AnnotationHandlerEventArgs> currentAnnotationArgs = new ObservableCollection<AnnotationHandlerEventArgs>();
+        public ObservableCollection<AnnotationHandlerEventArgs> CurrentAnnotationArgs { get => currentAnnotationArgs; set => currentAnnotationArgs = value; }
+
         private AnnotationSortOrder annotationSortOrder = AnnotationSortOrder.PageIndexAscending;
 
         public AnnotationSortOrder AnnotationSortOrder
@@ -151,10 +154,10 @@ namespace PDF_Office.ViewModels.BOTA
                 }
                 PdfViewer.ReloadVisibleAnnots();
                 //提取出来的注释文件 时间为空  则显示未系统当前时间
-                currentAnnotationArgs = GetDocumentAnnotionList();
+                CurrentAnnotationArgs = GetDocumentAnnotionList();
 
                 AnnotationListItems.Clear();
-                AnnotationListItems.AddRange(currentAnnotationArgs);
+                AnnotationListItems.AddRange(CurrentAnnotationArgs);
                 await Task.Delay(5);
                 RefreshAnnotationListItems(null);
 
@@ -230,7 +233,7 @@ namespace PDF_Office.ViewModels.BOTA
             }
             PdfViewer.RemovePageAnnot(deleteLists);
             AnnotationListItems.Clear();
-            currentAnnotationArgs.Clear();
+            CurrentAnnotationArgs.Clear();
             PdfViewer.UndoManager.CanSave = true;
         }
 
@@ -248,7 +251,8 @@ namespace PDF_Office.ViewModels.BOTA
                     if (result)
                     {
                         AnnotationListItems.Remove(annotation);
-                        currentAnnotationArgs.Remove(annotation);
+                        var annotation1 = CurrentAnnotationArgs.FirstOrDefault(x => x.PageIndex == annotation.PageIndex && x.AnnotIndex == annotation.AnnotIndex);
+                        CurrentAnnotationArgs.Remove(annotation1);
                         //记录是删除了哪些页面的注释,然后更新对应页面的注释即可
                         UpdateAnnotListAfterDelete(annotation.PageIndex, annotation.AnnotIndex);
                         PdfViewer.UndoManager.CanSave = true;
@@ -341,7 +345,7 @@ namespace PDF_Office.ViewModels.BOTA
             if (obj is System.Windows.Controls.Button button)
             {
                 DialogParameters value = new DialogParameters();
-                value.Add(ParameterNames.AnnotationList, currentAnnotationArgs);
+                value.Add(ParameterNames.AnnotationList, CurrentAnnotationArgs);
                 value.Add(ParameterNames.AnnotArgsTypes, annotArgsTypes);
                 value.Add(ParameterNames.AnnotationColors, colors);
                 value.Add(ParameterNames.AnnotationAuthor, authors);
@@ -359,7 +363,7 @@ namespace PDF_Office.ViewModels.BOTA
                                   authors.Clear();
                                   annotArgsTypes.Clear();
                                   AnnotationListItems.Clear();
-                                  AnnotationListItems.AddRange(currentAnnotationArgs);
+                                  AnnotationListItems.AddRange(CurrentAnnotationArgs);
                                   RefreshAnnotationListItems(button);
                               }
                               else
@@ -391,7 +395,7 @@ namespace PDF_Office.ViewModels.BOTA
                           authors.Clear();
                           annotArgsTypes.Clear();
                           AnnotationListItems.Clear();
-                          AnnotationListItems.AddRange(currentAnnotationArgs);
+                          AnnotationListItems.AddRange(CurrentAnnotationArgs);
 
                           RefreshAnnotationListItems(button);
                       }
@@ -456,7 +460,7 @@ namespace PDF_Office.ViewModels.BOTA
 
             if (annotArgsTypes.Count > 0 && colors.Count > 0 && authors.Count > 0)
             {
-                foreach (var item in currentAnnotationArgs)
+                foreach (var item in CurrentAnnotationArgs)
                 {
                     foreach (var type in annotArgsTypes)
                     {
@@ -480,7 +484,7 @@ namespace PDF_Office.ViewModels.BOTA
 
             else if (colors.Count > 0 && authors.Count > 0)
             {
-                foreach (var item in currentAnnotationArgs)
+                foreach (var item in CurrentAnnotationArgs)
                 {
                     foreach (var color in colors)
                     {
@@ -501,7 +505,7 @@ namespace PDF_Office.ViewModels.BOTA
 
             else if (annotArgsTypes.Count > 0 && authors.Count > 0)
             {
-                foreach (var item in currentAnnotationArgs)
+                foreach (var item in CurrentAnnotationArgs)
                 {
                     foreach (var type in annotArgsTypes)
                     {
@@ -522,7 +526,7 @@ namespace PDF_Office.ViewModels.BOTA
 
             else if (annotArgsTypes.Count > 0 && colors.Count > 0)
             {
-                foreach (var item in currentAnnotationArgs)
+                foreach (var item in CurrentAnnotationArgs)
                 {
                     foreach (var type in annotArgsTypes)
                     {
@@ -543,7 +547,7 @@ namespace PDF_Office.ViewModels.BOTA
 
             else if (annotArgsTypes.Count > 0)
             {
-                foreach (var item in currentAnnotationArgs)
+                foreach (var item in CurrentAnnotationArgs)
                 {
                     foreach (var type in annotArgsTypes)
                     {
@@ -561,7 +565,7 @@ namespace PDF_Office.ViewModels.BOTA
 
             else if (colors.Count > 0)
             {
-                foreach (var item in currentAnnotationArgs)
+                foreach (var item in CurrentAnnotationArgs)
                 {
                     foreach (var color in colors)
                     {
@@ -576,7 +580,7 @@ namespace PDF_Office.ViewModels.BOTA
 
             else if (authors.Count > 0)
             {
-                foreach (var item in currentAnnotationArgs)
+                foreach (var item in CurrentAnnotationArgs)
                 {
                     foreach (var author in authors)
                     {
@@ -773,6 +777,7 @@ namespace PDF_Office.ViewModels.BOTA
                     if (args.AnnotHandlerEventArgs != null)
                     {
                         AnnotationListItems.Add(args);
+                        CurrentAnnotationArgs.Add(args);
                         await Task.Delay(1);//不加延时 每页的第一个注释不会展开
                         ExpandGroupHeader(args, listBox);
                         listBox.SelectedItem = item;
@@ -804,7 +809,8 @@ namespace PDF_Office.ViewModels.BOTA
                         if (AnnotationListItems[k].PageIndex == pageIndex && AnnotationListItems[k].AnnotIndex == annotIndex)
                         {
                             AnnotationListItems.RemoveAt(k);
-                            currentAnnotationArgs.RemoveAt(k);
+                            AnnotationHandlerEventArgs annotation1 = CurrentAnnotationArgs.FirstOrDefault(x => x.PageIndex == AnnotationListItems[k].PageIndex && x.AnnotIndex == AnnotationListItems[k].AnnotIndex);
+                            CurrentAnnotationArgs.Remove(annotation1);
                             UpdateAnnotListAfterDelete(pageIndex, annotIndex);
                             return;
                         }
@@ -819,7 +825,8 @@ namespace PDF_Office.ViewModels.BOTA
                         if (AnnotationListItems[k].PageIndex == pageIndex && AnnotationListItems[k].AnnotIndex == annotIndex)
                         {
                             AnnotationListItems.RemoveAt(k);
-                            currentAnnotationArgs.RemoveAt(k);
+                            AnnotationHandlerEventArgs annotation1 = CurrentAnnotationArgs.FirstOrDefault(x => x.PageIndex == AnnotationListItems[k].PageIndex && x.AnnotIndex == AnnotationListItems[k].AnnotIndex);
+                            CurrentAnnotationArgs.Remove(annotation1);
                             UpdateAnnotListAfterDelete(pageIndex, annotIndex);
                             return;
                         }
@@ -834,6 +841,16 @@ namespace PDF_Office.ViewModels.BOTA
                         {
                             AnnotationHandlerEventArgs args = GetAddAnnotEventArgs(items[j]);
                             AnnotationListItems[k] = args;
+
+                            AnnotationHandlerEventArgs annotation1 = CurrentAnnotationArgs.FirstOrDefault(x => x.PageIndex == AnnotationListItems[k].PageIndex && x.AnnotIndex == AnnotationListItems[k].AnnotIndex);
+                            for (int i = 0; i < CurrentAnnotationArgs.Count; i++)
+                            {
+                                if (annotation1 == CurrentAnnotationArgs[i])
+                                {
+                                    CurrentAnnotationArgs[i] = args;
+                                    break;
+                                }
+                            }
                             if (!listBox.SelectedItems.Contains(AnnotationListItems[k]))
                             {
                                 listBox.SelectedItem = AnnotationListItems[k];
@@ -914,7 +931,7 @@ namespace PDF_Office.ViewModels.BOTA
                 AnnotationListItems = new ObservableCollection<AnnotationHandlerEventArgs>();
 
                 AnnotationListItems = GetDocumentAnnotionList();
-                currentAnnotationArgs.AddRange(AnnotationListItems);
+                CurrentAnnotationArgs.AddRange(AnnotationListItems);
                 AnnotationListItems.CollectionChanged += AnnotationListItems_CollectionChanged;
             }
         }
@@ -1097,6 +1114,7 @@ namespace PDF_Office.ViewModels.BOTA
                 if (obsSender.Count < 1)
                 {
                     IsEmptyPanelVisibility = Visibility.Visible;
+                    //currentAnnotationArgs.Clear();
                 }
                 else
                 {

+ 2 - 3
PDF Office/ViewModels/Dialog/BOTA/ScreenAnnotationDialogViewModel.cs

@@ -141,7 +141,7 @@ namespace PDF_Office.ViewModels.Dialog.BOTA
         /// <summary>
         /// 链接
         /// </summary>
-        private Visibility annotLinkVisible;
+        private Visibility annotLinkVisible = Visibility.Collapsed;
 
         public Visibility AnnotLinkVisible
         {
@@ -718,7 +718,7 @@ namespace PDF_Office.ViewModels.Dialog.BOTA
                         break;
 
                     case AnnotArgsType.AnnotLine:
-                        if(data is LineAnnotArgs lineAnnotArgs)
+                        if (data is LineAnnotArgs lineAnnotArgs)
                         {
                             if (lineAnnotArgs.HeadLineType >= (C_LINE_TYPE)1 || lineAnnotArgs.TailLineType >= (C_LINE_TYPE)1)
                             {
@@ -732,7 +732,6 @@ namespace PDF_Office.ViewModels.Dialog.BOTA
                             }
                             GetAnnotationColors(lineAnnotArgs.LineColor);
                         }
-                       
 
                         break;
 

+ 7 - 8
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateColorContentViewModel.cs

@@ -167,15 +167,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             get { return _pageRangeText; }
             set
             {
-                List<int> PageIndexLists = new List<int>();
                 _pageRangeText = value;
                 BackgroundInfo.PageRange = PageRangeText;
-                if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, PageRangeText, 99999, new char[] { ',' }, new char[] { '-' }))
-                {
-                    BackgroundInfo.PageRangeIndex = 0;
-                }
-                BackgroundInfo.PageRangeIndex = 3;
-
             }
         }
 
@@ -327,9 +320,15 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 backgroundItem.opacity = backgroundInfo.Opacity;
                 backgroundItem.rotation = backgroundInfo.Rotation;
                 backgroundItem.PageRangeIndex = backgroundInfo.PageRangeIndex;
-                backgroundItem.pageRange = backgroundInfo.PageRange;
+                
                 backgroundItem.isRelativeScale = backgroundInfo.IsRelativeScale;
                 backgroundItem.scale = backgroundInfo.Scale;
+                List<int> PageIndexLists = new List<int>();
+                if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, backgroundInfo.PageRange, 99999, new char[] { ',' }, new char[] { '-' }))
+                {
+                    backgroundInfo.PageRangeIndex = 0;
+                }
+                backgroundItem.pageRange = backgroundInfo.PageRange;
             }
 
         }

+ 7 - 9
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateFileContentViewModel.cs

@@ -230,16 +230,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             get { return _pageRangeText; }
             set
             {
-                List<int> PageIndexLists = new List<int>();
                 _pageRangeText = value;
                 BackgroundInfo.PageRange = PageRangeText;
-                if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, PageRangeText, 99999, new char[] { ',' }, new char[] { '-' }))
-                {
-                    BackgroundInfo.PageRangeIndex = 0;
-                }
-                BackgroundInfo.PageRangeIndex = 3;
-
-
+                
             }
         }
 
@@ -404,8 +397,13 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             backgroundItem.rotation = backgroundInfo.Rotation;
             backgroundItem.isRelativeScale = backgroundInfo.IsRelativeScale;
             backgroundItem.scale = backgroundInfo.Scale;
-            backgroundItem.PageRangeIndex = backgroundInfo.PageRangeIndex;
             backgroundItem.pageRange = backgroundInfo.PageRange;
+            List<int> PageIndexLists = new List<int>();
+            if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, backgroundInfo.PageRange, 99999, new char[] { ',' }, new char[] { '-' }))
+            {
+                backgroundInfo.PageRangeIndex = 0;
+            }
+            backgroundItem.PageRangeIndex = backgroundInfo.PageRangeIndex;
             //backgroundItem.pagRangeMode = backgroundInfo.PageRange;
         }
 

+ 8 - 6
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContentViewModel.cs

@@ -145,13 +145,11 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             get { return _pageRangeText; }
             set
             {
-                List<int> PageIndexLists = new List<int>();
+               
                 _pageRangeText = value;
                 BatesInfo.PageRange =PageRangeText;
-                if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, PageRangeText, 99999, new char[] { ',' }, new char[] { '-' })) {
-                    BatesInfo.PageRangeIndex = 0;
-                }
-                BatesInfo.PageRangeIndex = 3;
+                
+                
                 //CommonHelper.GetPagesInRange(ref PageIndexLists, PageRangeText, 99999, new char[] { ',' }, new char[] { '-' });
                 //foreach (var a in PageIndexLists) {
                 //    Trace.WriteLine("页面范围:" + a);
@@ -588,8 +586,12 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             batesItem.StarPagetNumber = batesInfo.StarPagetNumber;
             batesItem.margin = batesInfo.margin;
             batesItem.PageRange = batesInfo.PageRange;
+            List<int> PageIndexLists = new List<int>();
+            if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, BatesInfo.PageRange, 9999, new char[] { ',' }, new char[] { '-' }))
+            {
+                batesInfo.PageRangeIndex = 0;
+            }
             batesItem.PageRangeIndex = batesInfo.PageRangeIndex;
-
         }
 
         public void ConvertItemToInfo(BatesHeaderFooterItem batesItem, ref BatesInfo batesInfo)

+ 12 - 4
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterDialogViewModel.cs

@@ -265,11 +265,19 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                         continue;
                     }
                 }
-                if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(),document.PageCount, enumerationSeparator, rangeSeparator))
+                string pageRange = getFilePageRange(document, PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeText"].ToString(), PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeSelectIndex"].ToString());
+                if (!CommonHelper.GetPagesInRange(ref PageIndexLists, pageRange, document.PageCount, enumerationSeparator, rangeSeparator))
                 { //TODO
-                    Trace.WriteLine("输入不对");
+                    
                     MessageBoxEx.Show("输入不对");
-                    return;
+                    PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                    PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                    fileNamesIndex++;
+                    continue;
+                }
+                for (int index=0; index< PageIndexLists.Count;index++) {
+                    PageIndexLists[index]++;
+                
                 }
                 switch (ConverterTypeIndex)
                 {
@@ -507,7 +515,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public string getFilePageRange(CPDFDocument document, string pagerangetext = "1", string pagerangeselectindex = "0")
         {
             string filePageRange = "1";
-            EditToolsHelper.GetPageRange(int.Parse(pagerangeselectindex), document, ref filePageRange, pagerangetext);
+            EditToolsHelper.GetPageRange(int.Parse(pagerangeselectindex), document, ref filePageRange, pagerangetext,true);
             return filePageRange;
         }
 

+ 6 - 7
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterCreateContentViewModel.cs

@@ -221,15 +221,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             get { return _pageRangeText; }
             set
             {
-               
-                List<int> PageIndexLists = new List<int>();
                 _pageRangeText = value;
                 HeaderFooterInfo.PageRange = PageRangeText;
-                if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, PageRangeText, 99999, new char[] { ',' }, new char[] { '-' }))
-                {
-                    HeaderFooterInfo.PageRangeIndex = 0;
-                }
-                HeaderFooterInfo.PageRangeIndex = 3;
+               
                 //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref HeaderFooterInfo.PageRange, PageRangeText);
 
             }
@@ -600,6 +594,11 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             headerFooterItem.PageNumberFormat = headerFooterInfo.PageNumberFormat;
             headerFooterItem.margin = headerFooterInfo.margin;
             headerFooterItem.PageRange = headerFooterInfo.PageRange;
+            List<int> PageIndexLists = new List<int>();
+            if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, headerFooterInfo.PageRange, 9999, new char[] { ',' }, new char[] { '-' }))
+            {
+                headerFooterInfo.PageRangeIndex = 0;
+            }
             headerFooterItem.PageRangeIndex = headerFooterInfo.PageRangeIndex;
         }
 

+ 8 - 8
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateFileContentViewModel.cs

@@ -232,15 +232,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             get { return _pageRangeText; }
             set
             {
-                
-                List<int> PageIndexLists = new List<int>();
                 _pageRangeText = value;
                 WatermarkInfo.PageRange = PageRangeText;
-                if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, PageRangeText, 99999, new char[] { ',' }, new char[] { '-' }))
-                {
-                    WatermarkInfo.PageRangeIndex = 0;
-                }
-                WatermarkInfo.PageRangeIndex = 3;
                 //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref WatermarkInfo.PageRange, PageRangeText);
 
             }
@@ -371,8 +364,15 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 watermarkItem.horizOffset = watermarkInfo.HorizOffset;
                 watermarkItem.verticalSpacing = watermarkInfo.VerticalSpacing;
                 watermarkItem.horizontalSpacing = watermarkInfo.HorizontalSpacing;
-                watermarkItem.pageRangeIndex = watermarkInfo.PageRangeIndex;
+                
                 watermarkItem.pageRange = watermarkInfo.PageRange;
+
+                List<int> PageIndexLists = new List<int>();
+                if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, watermarkInfo.PageRange, 99999, new char[] { ',' }, new char[] { '-' }))
+                {
+                    watermarkInfo.PageRangeIndex = 0;
+                }
+                watermarkItem.pageRangeIndex = watermarkInfo.PageRangeIndex;
             }
         }
 

+ 7 - 7
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateTextContentViewModel.cs

@@ -370,14 +370,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             get { return _pageRangeText; }
             set
             {
-                List<int> PageIndexLists = new List<int>();
                 _pageRangeText = value;
                 WatermarkInfo.PageRange = PageRangeText;
-                if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, PageRangeText, 99999, new char[] { ',' }, new char[] { '-' }))
-                {
-                    WatermarkInfo.PageRangeIndex = 0;
-                }
-                WatermarkInfo.PageRangeIndex = 3;
+                
 
             }
         }
@@ -455,8 +450,13 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 watermarkItem.horizOffset = watermarkInfo.HorizOffset;
                 watermarkItem.verticalSpacing = watermarkInfo.VerticalSpacing;
                 watermarkItem.horizontalSpacing = watermarkInfo.HorizontalSpacing;
-                watermarkItem.pageRangeIndex = watermarkInfo.PageRangeIndex;
                 watermarkItem.pageRange = watermarkInfo.PageRange;
+                List<int> PageIndexLists = new List<int>();
+                if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, watermarkInfo.PageRange, 99999, new char[] { ',' }, new char[] { '-' }))
+                {
+                    watermarkInfo.PageRangeIndex = 0;
+                }
+                watermarkItem.pageRangeIndex = watermarkInfo.PageRangeIndex;
             }
         }
 

+ 1 - 1
PDF Office/ViewModels/EditTools/Bates/BatesTemplateListContentViewModel.cs

@@ -203,7 +203,7 @@ namespace PDF_Office.ViewModels.EditTools.Bates
             batesInfo.StarPagetNumber = batesItem.StarPagetNumber;
             batesInfo.margin = batesItem.margin;
             batesInfo.PageRangeIndex = batesItem.PageRangeIndex;
-            EditToolsHelper.GetPageRange(batesInfo.PageRangeIndex, PDFViewer.Document, ref batesInfo.PageRange, batesItem.PageRange);
+            batesInfo.PageRange= batesItem.PageRange;
 
         }
         private void CheckTemplateListIsEmpty(List<BatesHeaderFooterItem> batesTemplateList)

+ 1 - 1
PDF Office/ViewModels/EditTools/HeaderFooter/HeaderFooterTemplateListContentViewModel.cs

@@ -199,7 +199,7 @@ namespace PDF_Office.ViewModels.EditTools.HeaderFooter
             headerFooterInfo.PageNumberFormat = headerFooterItem.PageNumberFormat;
             headerFooterInfo.margin = headerFooterItem.margin;
             headerFooterInfo.PageRangeIndex = headerFooterItem.PageRangeIndex;
-            EditToolsHelper.GetPageRange(headerFooterInfo.PageRangeIndex, PDFViewer.Document, ref headerFooterInfo.PageRange, headerFooterItem.PageRange);
+            headerFooterInfo.PageRange=headerFooterItem.PageRange;
         }
         private void CheckTemplateListIsEmpty(List<BatesHeaderFooterItem> headerFooterTemplateList)
         {

+ 1 - 1
PDF Office/ViewModels/EditTools/Watermark/WatermarkTemplateListFileContentViewModel.cs

@@ -274,7 +274,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
                 watermarkInfo.VerticalSpacing = watermarkItem.verticalSpacing;
                 watermarkInfo.HorizontalSpacing = watermarkItem.horizontalSpacing;
                 watermarkInfo.PageRangeIndex = watermarkItem.pageRangeIndex;
-                EditToolsHelper.GetPageRange(watermarkItem.pageRangeIndex, CurrentPDFViewer.Document, ref WatermarkInfo.PageRange, watermarkItem.pageRange);
+                watermarkInfo.PageRange = watermarkItem.pageRange;
             }
         }
 

+ 1 - 1
PDF Office/ViewModels/EditTools/Watermark/WatermarkTemplateListTextContentViewModel.cs

@@ -241,7 +241,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
                 watermarkInfo.VerticalSpacing = watermarkItem.verticalSpacing;
                 watermarkInfo.HorizontalSpacing = watermarkItem.horizontalSpacing;
                 watermarkInfo.PageRangeIndex = watermarkItem.pageRangeIndex;
-                EditToolsHelper.GetPageRange(watermarkItem.pageRangeIndex, CurrentPDFViewer.Document, ref WatermarkInfo.PageRange, watermarkItem.pageRange);
+                watermarkInfo.PageRange = watermarkItem.pageRange;
             }
 
         }

+ 1 - 1
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateColorContent.xaml

@@ -128,7 +128,7 @@
         <Grid Grid.Row="3" Margin="0,16,0,0">
             <StackPanel Orientation="Vertical">
                 <TextBlock Text="页面范围" FontSize="12" Foreground="#666666" Height="20" Width="48" HorizontalAlignment="Left"></TextBlock>
-                <cus:WritableComboBox  Height="32" Width="228" Margin="0,8,0,0" HorizontalAlignment="Left" Text="{Binding PageRangeText,Mode=TwoWay}" SelectedIndex="{Binding PageRangeSelectIndex,Mode=TwoWay}" MaxPageRange="99999"></cus:WritableComboBox>
+                <cus:WritableComboBox  Height="32" Width="228" Margin="0,8,0,0" HorizontalAlignment="Left" Text="{Binding PageRangeText,Mode=TwoWay}" SelectedIndex="{Binding PageRangeSelectIndex,Mode=TwoWay}" MaxPageRange="9999"></cus:WritableComboBox>
             </StackPanel>
         </Grid>
         <Grid Grid.Row="4">

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

@@ -179,7 +179,7 @@
                 <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}" MaxPageRange="99999"></cus:WritableComboBox>
+                        <cus:WritableComboBox Height="32" Margin="0,8,0,0" Text="{Binding PageRangeText,Mode=TwoWay}" SelectedIndex="{Binding PageRangeSelectIndex,Mode=TwoWay}" MaxPageRange="9999"></cus:WritableComboBox>
                     </StackPanel>
                 </Grid>
             </Grid>

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

@@ -167,7 +167,7 @@
                 <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}" MaxPageRange="99999"></cus:WritableComboBox>
+                        <cus:WritableComboBox Height="32" Margin="0,8,0,0" Text="{Binding PageRangeText,Mode=TwoWay}" SelectedIndex="{Binding PageRangeSelectIndex,Mode=TwoWay}" MaxPageRange="9999"></cus:WritableComboBox>
                     </StackPanel>
                 </Grid>
             </Grid>

+ 1 - 1
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateFileContent.xaml

@@ -107,7 +107,7 @@
             <Grid Width="228" Grid.Row="2"  Margin="16,10,16,4" Grid.RowSpan="2">
                 <StackPanel Orientation="Vertical">
                     <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}" MaxPageRange="99999"></cus:WritableComboBox>
+                    <cus:WritableComboBox Height="32" Margin="0,8,0,0" Text="{Binding PageRangeText,Mode=TwoWay}" SelectedIndex="{Binding PageRangeSelectIndex,Mode=TwoWay}" MaxPageRange="9999"></cus:WritableComboBox>
                 </StackPanel>
             </Grid>
         </Grid>

+ 1 - 1
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateTextContent.xaml

@@ -125,7 +125,7 @@
         <Grid Width="228" Grid.Row="4"  Margin="0,8,0,4">
             <StackPanel Orientation="Vertical">
                 <TextBlock Text="页面范围" FontSize="12" Foreground="#666666" Height="20" Width="24" HorizontalAlignment="Left"></TextBlock>
-                <cus:WritableComboBox Height="32" Margin="0,8,0,0" Text="{Binding PageRangeText,Mode=TwoWay}" SelectedIndex="{Binding PageRangeSelectIndex,Mode=TwoWay}" MaxPageRange="99999"></cus:WritableComboBox>
+                <cus:WritableComboBox Height="32" Margin="0,8,0,0" Text="{Binding PageRangeText,Mode=TwoWay}" SelectedIndex="{Binding PageRangeSelectIndex,Mode=TwoWay}" MaxPageRange="9999"></cus:WritableComboBox>
             </StackPanel>
         </Grid>
     </Grid>