liyijie 2 rokov pred
rodič
commit
e1f7cd04e1

+ 1 - 0
PDF Office/CustomControl/WritableComboBox.xaml

@@ -28,6 +28,7 @@
         <TextBox
             x:Name="writableTextBox"
             Grid.Column="0"
+            Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBox}, Path=Text}"
             MinHeight="{Binding ElementName=writableComboBox, Path=MinHeight}"
             HorizontalAlignment="Left"
             VerticalContentAlignment="Center"

+ 72 - 20
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundDialogViewModel.cs

@@ -85,6 +85,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         private int fileNamesIndex = 0;
 
+        private int FileNameNumber = 0;
+
         private string backgroundGridIsEnabled = "True";
         public string BackgroundGridIsEnabled
         {
@@ -121,6 +123,16 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
         }
 
+        private DataTable pdfCurrentDataTable = new DataTable();
+        public DataTable PDFCurrentDataTable
+        {
+            get { return pdfCurrentDataTable; }
+            set
+            {
+                SetProperty(ref pdfCurrentDataTable, value);
+            }
+        }
+
         private string removeIsEnable = "False";
         public string RemoveIsEnable
         {
@@ -190,6 +202,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             this.eventAggregator = eventAggregator;
             this.backgroundRegion = backgroundRegion;
+            PDFCurrentDataTable.Columns.Add("FilePageRangeText");
+            PDFCurrentDataTable.Columns.Add("FilePageRangeSelectIndex");
+            PDFCurrentDataTable.Columns.Add("FileState");
             PDFDataTable.Columns.Add("FileName");
             PDFDataTable.Columns.Add("FilePageRangeText");
             PDFDataTable.Columns.Add("FilePageRangeSelectIndex");
@@ -280,26 +295,30 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             BackgroundGridIsEnabled = "False";
             foreach (var filename in fileNames)
             {
-                FileInfo fileinfo = new FileInfo(filename);
-                string OutputPath = fileinfo.DirectoryName;
-                char[] enumerationSeparator = new char[] { ',' };
-                char[] rangeSeparator = new char[] { '-' };
-                List<int> PageIndexLists = new List<int>();
-                CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
-                if (document == null)
-                {
-                    PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
-                    continue;
-                }
-                if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(), document.PageCount, enumerationSeparator, rangeSeparator))
-                { //TODO
-                    Trace.WriteLine("输入不对");
-                    MessageBoxEx.Show("输入不对");
-                    return;
-                }
-
-                document.Release();
+            //    FileInfo fileinfo = new FileInfo(filename);
+            //    string OutputPath = fileinfo.DirectoryName;
+            //    char[] enumerationSeparator = new char[] { ',' };
+            //    char[] rangeSeparator = new char[] { '-' };
+            //    List<int> PageIndexLists = new List<int>();
+            //    CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
+            //    if (document == null)
+            //    {
+            //        PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+            //        continue;
+            //    }
+            //    if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(), document.PageCount, enumerationSeparator, rangeSeparator))
+            //    { //TODO
+            //        Trace.WriteLine("输入不对");
+            //        MessageBoxEx.Show("输入不对");
+            //        return;
+            //    }
+
+            //    document.Release();
+                PDFDataTable.Rows[fileNamesIndex]["FilePageRangeSelectIndex"] = "2";
                 PDFDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeText"] = "2";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeSelectIndex"] = "2";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
                 fileNamesIndex++;
             }
             BackgroundGridIsEnabled = "True";
@@ -312,6 +331,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicture()
         {
+            FileNameNumber = fileNames.Count;
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = true;
             dlg.Filter = "PDF|*.pdf;*.PDF;";
@@ -327,6 +347,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public void addPDFFiles(string filename)
         {
+            FileNameNumber = fileNames.Count;
             fileNames.Add(filename);
             RemoveExcess(ref fileNames);
             SetBackgroundGridIsEnabled = "True";
@@ -356,6 +377,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicturefiles()
         {
+            FileNameNumber = fileNames.Count;
             FolderBrowserDialog dialog = new FolderBrowserDialog();
             dialog.Description = "请选择文件路径";
             if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
@@ -384,21 +406,50 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void updateListview(string state)
         {
+            updateCurrentListview();
             DataTable pdfdatatable = new DataTable();
             pdfdatatable.Columns.Add("FileName");
+            pdfdatatable.Columns.Add("FilePageRangeText");
+            pdfdatatable.Columns.Add("FilePageRangeSelectIndex");
             pdfdatatable.Columns.Add("FileSize");
             pdfdatatable.Columns.Add("FileState");
+            int datatableindex = 0;
             foreach (var fileName in fileNames)
             {
                 string file_all = fileName;
                 FileInfo f = new FileInfo(file_all);
                 string file_size = (((float)f.Length) / 1024).ToString() + " K";
-                pdfdatatable.Rows.Add(f.Name, file_size, state);
+                pdfdatatable.Rows.Add(f.Name, PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeText"], PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"], file_size, PDFCurrentDataTable.Rows[datatableindex]["FileState"]); 
+                datatableindex++;
             }
             PDFDataTable = pdfdatatable;
             HomePageBatchProcessingDialogModel.FilePaths = fileNames;
 
         }
+
+        /// <summary>
+        /// 更新Currentlistview显示
+        /// pagerangetext 自定义页面范围字符串  pagerangeselectindex combobox下拉索引(0全部页面 1奇数页 2偶数页 3自定义页面) state 状态显示字符串
+        /// </summary>
+        public void updateCurrentListview(string pagerangetext = "1", string pagerangeselectindex = "0", string state = "待完成")
+        {
+            if (fileNames.Count >= FileNameNumber)
+            {
+                for (int i = 0; fileNames.Count - FileNameNumber > i; i++)
+                {
+                    PDFCurrentDataTable.Rows.Add(pagerangetext, pagerangeselectindex, state);
+                }
+            }
+            else
+            {
+                Reverseorder(ref fileNamesView);
+                foreach (int filenamesview in fileNamesView)
+                {
+                    PDFCurrentDataTable.Rows.RemoveAt(filenamesview);
+                }
+            }
+        }
+
         /// <summary>
         /// 逆序int类型集合
         /// </summary>
@@ -425,6 +476,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void removepdffile()
         {
+            FileNameNumber = fileNames.Count;
             Reverseorder(ref fileNamesView);
             foreach (int filenamesview in fileNamesView)
             {

+ 85 - 22
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesDialogViewModel.cs

@@ -18,6 +18,7 @@ using ComPDFKitViewer.PdfViewer;
 using Prism.Events;
 using PDF_Office.EventAggregators;
 using PDFSettings;
+using ImTools;
 
 namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBates
 {
@@ -49,6 +50,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         private int fileNamesIndex = 0;
 
+        private int FileNameNumber = 0;
+
         private string _batesSettingsRegionName;
         /// <summary>
         /// 属性设置Region
@@ -105,6 +108,16 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
         }
 
+        private DataTable pdfCurrentDataTable = new DataTable();
+        public DataTable PDFCurrentDataTable
+        {
+            get { return pdfCurrentDataTable; }
+            set
+            {
+                SetProperty(ref pdfCurrentDataTable, value);
+            }
+        }
+
         private string removeIsEnable = "False";
         public string RemoveIsEnable
         {
@@ -163,6 +176,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             this.batesRegion = batesRegion;
             BatesSettingsRegionName = Guid.NewGuid().ToString();
             Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
+            PDFCurrentDataTable.Columns.Add("FilePageRangeText");
+            PDFCurrentDataTable.Columns.Add("FilePageRangeSelectIndex");
+            PDFCurrentDataTable.Columns.Add("FileState");
             PDFDataTable.Columns.Add("FileName");
             PDFDataTable.Columns.Add("FilePageRangeText");
             PDFDataTable.Columns.Add("FilePageRangeSelectIndex");
@@ -214,26 +230,30 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             BatesGridIsEnabled = "False";
             foreach (var filename in fileNames)
             {
-                FileInfo fileinfo = new FileInfo(filename);
-                string OutputPath = fileinfo.DirectoryName;
-                char[] enumerationSeparator = new char[] { ',' };
-                char[] rangeSeparator = new char[] { '-' };
-                List<int> PageIndexLists = new List<int>();
-                CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
-                if (document == null)
-                {
-                    PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
-                    continue;
-                }
-                if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(), document.PageCount, enumerationSeparator, rangeSeparator))
-                { //TODO
-                    Trace.WriteLine("输入不对");
-                    MessageBoxEx.Show("输入不对");
-                    return;
-                }
-
-                document.Release();
+                //FileInfo fileinfo = new FileInfo(filename);
+                //string OutputPath = fileinfo.DirectoryName;
+                //char[] enumerationSeparator = new char[] { ',' };
+                //char[] rangeSeparator = new char[] { '-' };
+                //List<int> PageIndexLists = new List<int>();
+                //CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
+                //if (document == null)
+                //{
+                //    PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                //    continue;
+                //}
+                //if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(), document.PageCount, enumerationSeparator, rangeSeparator))
+                //{ //TODO
+                //    Trace.WriteLine("输入不对");
+                //    MessageBoxEx.Show("输入不对");
+                //    return;
+                //}
+
+                //document.Release();
+                PDFDataTable.Rows[fileNamesIndex]["FilePageRangeSelectIndex"] = "2";
                 PDFDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeText"] = "2";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeSelectIndex"] = "2";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
                 fileNamesIndex++;
             }
             BatesGridIsEnabled = "True";
@@ -246,6 +266,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicture()
         {
+            FileNameNumber = fileNames.Count;
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = true;
             dlg.Filter = "PDF|*.pdf;*.PDF;";
@@ -258,9 +279,12 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 updateListview("待确定");
             }
         }
-
+        /// <summary>
+        /// 拖拽添加PDF文件
+        /// </summary>
         public void addPDFFiles(string filename)
         {
+            FileNameNumber = fileNames.Count;
             fileNames.Add(filename);
             RemoveExcess(ref fileNames);
             SetBatesGridIsEnabled = "True";
@@ -290,6 +314,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicturefiles()
         {
+            FileNameNumber = fileNames.Count;
             FolderBrowserDialog dialog = new FolderBrowserDialog();
             dialog.Description = "请选择文件路径";
             if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
@@ -318,22 +343,56 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void updateListview(string state)
         {
+            updateCurrentListview();
             DataTable pdfdatatable = new DataTable();
             pdfdatatable.Columns.Add("FileName");
+            pdfdatatable.Columns.Add("FilePageRangeText");
+            pdfdatatable.Columns.Add("FilePageRangeSelectIndex");
             pdfdatatable.Columns.Add("FileSize");
             pdfdatatable.Columns.Add("FileState");
+            int datatableindex = 0;
             foreach (var fileName in fileNames)
             {
                 string file_all = fileName;
                 FileInfo f = new FileInfo(file_all);
                 string file_size = (((float)f.Length) / 1024).ToString() + " K";
-                pdfdatatable.Rows.Add(f.Name, file_size, state);
+
+                pdfdatatable.Rows.Add(f.Name, PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeText"], PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"], file_size, PDFCurrentDataTable.Rows[datatableindex]["FileState"]);
+                datatableindex++;
+
+
+
             }
             PDFDataTable = pdfdatatable;
             HomePageBatchProcessingDialogModel.FilePaths = fileNames;
 
         }
         /// <summary>
+        /// 更新Currentlistview显示
+        /// pagerangetext 自定义页面范围字符串  pagerangeselectindex combobox下拉索引(0全部页面 1奇数页 2偶数页 3自定义页面) state 状态显示字符串
+        /// </summary>
+        public void updateCurrentListview(string pagerangetext = "1", string pagerangeselectindex = "0", string state = "待完成")
+        {
+            if (fileNames.Count >= FileNameNumber)
+            {
+                for (int i = 0; fileNames.Count - FileNameNumber > i; i++)
+                {
+                    PDFCurrentDataTable.Rows.Add(pagerangetext, pagerangeselectindex, state);
+                    //PDFCurrentDataTable.Rows[i]["FilePageRangeText"] = pagerangetext;
+                    //PDFCurrentDataTable.Rows[i]["FilePageRangeSelectIndex"] = pagerangeselectindex;
+                    //PDFCurrentDataTable.Rows[i]["FileState"] = state;
+                }
+            }
+            else
+            {
+                Reverseorder(ref fileNamesView);
+                foreach (int filenamesview in fileNamesView)
+                {
+                    PDFCurrentDataTable.Rows.RemoveAt(filenamesview);
+                }
+            }
+        }
+        /// <summary>
         /// 逆序int类型集合
         /// </summary>
         public void Reverseorder(ref List<int> Numbers)
@@ -359,6 +418,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void removepdffile()
         {
+            FileNameNumber = fileNames.Count;
             Reverseorder(ref fileNamesView);
             foreach (int filenamesview in fileNamesView)
             {
@@ -370,6 +430,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 SetBatesGridIsEnabled = "False";
                 AddFileVisibility = Visibility.Visible;
             }
+
             updateListview("待确定");
         }
 
@@ -388,6 +449,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
         }
 
+
+
         #endregion
 
         #region 构架行为
@@ -396,7 +459,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             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)
             {

+ 47 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageCompressDialogViewModel.cs

@@ -30,6 +30,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         private int fileNamesIndex = 0;
 
+        private int FileNameNumber = 0;
+
         private IntPtr compressingIntpr = IntPtr.Zero;
 
         private CPDFDocument.GetPageIndexDelegate indexDelegate = null;
@@ -46,6 +48,16 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
         }
 
+        private DataTable pdfCurrentDataTable = new DataTable();
+        public DataTable PDFCurrentDataTable
+        {
+            get { return pdfCurrentDataTable; }
+            set
+            {
+                SetProperty(ref pdfCurrentDataTable, value);
+            }
+        }
+
         private string compressGridIsEnabled="True";
         public string CompressGridIsEnabled
         {
@@ -119,6 +131,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public HomePageCompressDialogViewModel()
         {
+            PDFCurrentDataTable.Columns.Add("FileState");
             PDFDataTable.Columns.Add("FileName");
             PDFDataTable.Columns.Add("FileSize");
             PDFDataTable.Columns.Add("FileState");
@@ -168,6 +181,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
                 if (document == null) {
                     PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                    PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
                     continue;
                 }
                 FileInfo fileinfo = new FileInfo(filename);
@@ -177,6 +191,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 tempDocument = document;
                 await Task.Run<bool>(() => { return document.CompressFile_Start(compressingIntpr, filename+"compress.pdf"); });
                 PDFDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
                 fileNamesIndex++;
                 document.Release();
             }
@@ -192,6 +207,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicture()
         {
+            FileNameNumber = fileNames.Count;
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = true;
             dlg.Filter = "PDF|*.pdf;*.PDF;";
@@ -207,6 +223,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public void addPDFFiles(string filename)
         {
+            FileNameNumber = fileNames.Count;
             fileNames.Add(filename);
             RemoveExcess(ref fileNames);
             SetCompressGridIsEnabled = "True";
@@ -236,6 +253,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicturefiles()
         {
+            FileNameNumber = fileNames.Count;
             FolderBrowserDialog dialog = new FolderBrowserDialog();
             dialog.Description = "请选择文件路径";
             if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
@@ -264,21 +282,48 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void updateListview(string state)
         {
+            updateCurrentListview();
             DataTable pdfdatatable = new DataTable();
             pdfdatatable.Columns.Add("FileName");
             pdfdatatable.Columns.Add("FileSize");
             pdfdatatable.Columns.Add("FileState");
+            int datatableindex = 0;
             foreach (var fileName in fileNames)
             {
                 string file_all = fileName;
                 FileInfo f = new FileInfo(file_all);
                 string file_size = (((float)f.Length) / 1024).ToString() + " K";
-                pdfdatatable.Rows.Add(f.Name, file_size, state);
+                pdfdatatable.Rows.Add(f.Name, file_size, PDFCurrentDataTable.Rows[datatableindex]["FileState"]);
+                datatableindex++;
             }
             PDFDataTable = pdfdatatable;
             HomePageBatchProcessingDialogModel.FilePaths = fileNames;
 
         }
+
+        /// <summary>
+        /// 更新Currentlistview显示
+        /// state 状态显示字符串
+        /// </summary>
+        public void updateCurrentListview(string state = "待完成")
+        {
+            if (fileNames.Count >= FileNameNumber)
+            {
+                for (int i = 0; fileNames.Count - FileNameNumber > i; i++)
+                {
+                    PDFCurrentDataTable.Rows.Add(state);
+                }
+            }
+            else
+            {
+                Reverseorder(ref fileNamesView);
+                foreach (int filenamesview in fileNamesView)
+                {
+                    PDFCurrentDataTable.Rows.RemoveAt(filenamesview);
+                }
+            }
+        }
+
         /// <summary>
         /// 逆序int类型集合
         /// </summary>
@@ -305,6 +350,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void removepdffile()
         {
+            FileNameNumber = fileNames.Count;
             Reverseorder(ref fileNamesView);
             foreach (int filenamesview in fileNamesView)
             {

+ 47 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterDialogViewModel.cs

@@ -50,6 +50,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         private int fileNamesIndex = 0;
 
+        private int FileNameNumber = 0;
+
         public List<string> ConverterTypeFamily { set; get; } = new List<string>();
 
         private void SetImageTypeOrigin()
@@ -100,6 +102,16 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
         }
 
+        private DataTable pdfCurrentDataTable = new DataTable();
+        public DataTable PDFCurrentDataTable
+        {
+            get { return pdfCurrentDataTable; }
+            set
+            {
+                SetProperty(ref pdfCurrentDataTable, value);
+            }
+        }
+
         private string removeIsEnable = "False";
         public string RemoveIsEnable
         {
@@ -167,6 +179,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
 
             SetImageTypeOrigin();
+            PDFCurrentDataTable.Columns.Add("FileState");
             PDFDataTable.Columns.Add("FileName");
             PDFDataTable.Columns.Add("FileSize");
             PDFDataTable.Columns.Add("FileState");
@@ -203,6 +216,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 if (document == null)
                 {
                     PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                    PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
                     continue;
                 }
                 if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(),document.PageCount, enumerationSeparator, rangeSeparator))
@@ -280,6 +294,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 }
                 document.Release();
                 PDFDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
                 fileNamesIndex++;
             }
             ConverterGridIsEnabled = "True";
@@ -292,6 +307,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicture()
         {
+            FileNameNumber = fileNames.Count;
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = true;
             dlg.Filter = "PDF|*.pdf;*.PDF;";
@@ -307,6 +323,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public void addPDFFiles(string filename)
         {
+            FileNameNumber = fileNames.Count;
             fileNames.Add(filename);
             RemoveExcess(ref fileNames);
             SetConverterGridIsEnabled = "True"; 
@@ -336,6 +353,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicturefiles()
         {
+            FileNameNumber = fileNames.Count;
             FolderBrowserDialog dialog = new FolderBrowserDialog();
             dialog.Description = "请选择文件路径";
             if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
@@ -364,21 +382,48 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void updateListview(string state)
         {
+            updateCurrentListview();
             DataTable pdfdatatable = new DataTable();
             pdfdatatable.Columns.Add("FileName");
             pdfdatatable.Columns.Add("FileSize");
             pdfdatatable.Columns.Add("FileState");
+            int datatableindex = 0;
             foreach (var fileName in fileNames)
             {
                 string file_all = fileName;
                 FileInfo f = new FileInfo(file_all);
                 string file_size = (((float)f.Length) / 1024).ToString() + " K";
-                pdfdatatable.Rows.Add(f.Name, file_size, state);
+                pdfdatatable.Rows.Add(f.Name, file_size, PDFCurrentDataTable.Rows[datatableindex]["FileState"]);
+                datatableindex++;
             }
             PDFDataTable = pdfdatatable;
             HomePageBatchProcessingDialogModel.FilePaths = fileNames;
 
         }
+
+        /// <summary>
+        /// 更新Currentlistview显示
+        /// state 状态显示字符串
+        /// </summary>
+        public void updateCurrentListview(string state = "待完成")
+        {
+            if (fileNames.Count >= FileNameNumber)
+            {
+                for (int i = 0; fileNames.Count - FileNameNumber > i; i++)
+                {
+                    PDFCurrentDataTable.Rows.Add(state);
+                }
+            }
+            else
+            {
+                Reverseorder(ref fileNamesView);
+                foreach (int filenamesview in fileNamesView)
+                {
+                    PDFCurrentDataTable.Rows.RemoveAt(filenamesview);
+                }
+            }
+        }
+
         /// <summary>
         /// 逆序int类型集合
         /// </summary>
@@ -405,6 +450,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void removepdffile()
         {
+            FileNameNumber = fileNames.Count;
             Reverseorder(ref fileNamesView);
             foreach (int filenamesview in fileNamesView)
             {

+ 72 - 21
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterDialogViewModel.cs

@@ -68,6 +68,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         private int fileNamesIndex = 0;
 
+        private int FileNameNumber = 0;
+
         private string headerFooterGridIsEnabled = "True";
         public string HeaderFooterGridIsEnabled
         {
@@ -104,6 +106,16 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
         }
 
+        private DataTable pdfCurrentDataTable = new DataTable();
+        public DataTable PDFCurrentDataTable
+        {
+            get { return pdfCurrentDataTable; }
+            set
+            {
+                SetProperty(ref pdfCurrentDataTable, value);
+            }
+        }
+
         private string removeIsEnable = "False";
         public string RemoveIsEnable
         {
@@ -176,7 +188,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
             HeaderFooterSettingsRegionName = Guid.NewGuid().ToString();
             Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
-
+            PDFCurrentDataTable.Columns.Add("FilePageRangeText");
+            PDFCurrentDataTable.Columns.Add("FilePageRangeSelectIndex");
+            PDFCurrentDataTable.Columns.Add("FileState");
             PDFDataTable.Columns.Add("FileName");
             PDFDataTable.Columns.Add("FilePageRangeText");
             PDFDataTable.Columns.Add("FilePageRangeSelectIndex");
@@ -229,26 +243,30 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             HeaderFooterGridIsEnabled = "False";
             foreach (var filename in fileNames)
             {
-                FileInfo fileinfo = new FileInfo(filename);
-                string OutputPath = fileinfo.DirectoryName;
-                char[] enumerationSeparator = new char[] { ',' };
-                char[] rangeSeparator = new char[] { '-' };
-                List<int> PageIndexLists = new List<int>();
-                CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
-                if (document == null)
-                {
-                    PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
-                    continue;
-                }
-                if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(), document.PageCount, enumerationSeparator, rangeSeparator))
-                { //TODO
-                    Trace.WriteLine("输入不对");
-                    MessageBoxEx.Show("输入不对");
-                    return;
-                }
-               
-                document.Release();
+                //FileInfo fileinfo = new FileInfo(filename);
+                //string OutputPath = fileinfo.DirectoryName;
+                //char[] enumerationSeparator = new char[] { ',' };
+                //char[] rangeSeparator = new char[] { '-' };
+                //List<int> PageIndexLists = new List<int>();
+                //CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
+                //if (document == null)
+                //{
+                //    PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                //    continue;
+                //}
+                //if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(), document.PageCount, enumerationSeparator, rangeSeparator))
+                //{ //TODO
+                //    Trace.WriteLine("输入不对");
+                //    MessageBoxEx.Show("输入不对");
+                //    return;
+                //}
+
+                //document.Release();
+                PDFDataTable.Rows[fileNamesIndex]["FilePageRangeSelectIndex"] = "2";
                 PDFDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeText"] = "2";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeSelectIndex"] = "2";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
                 fileNamesIndex++;
             }
             HeaderFooterGridIsEnabled = "True";
@@ -261,6 +279,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicture()
         {
+            FileNameNumber = fileNames.Count;
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = true;
             dlg.Filter = "PDF|*.pdf;*.PDF;";
@@ -276,6 +295,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public void addPDFFiles(string filename)
         {
+            FileNameNumber = fileNames.Count;
             fileNames.Add(filename);
             RemoveExcess(ref fileNames);
             SetHeaderFooterGridIsEnabled = "True";
@@ -305,6 +325,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicturefiles()
         {
+            FileNameNumber = fileNames.Count;
             FolderBrowserDialog dialog = new FolderBrowserDialog();
             dialog.Description = "请选择文件路径";
             if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
@@ -333,21 +354,50 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void updateListview(string state)
         {
+            updateCurrentListview();
             DataTable pdfdatatable = new DataTable();
             pdfdatatable.Columns.Add("FileName");
+            pdfdatatable.Columns.Add("FilePageRangeText");
+            pdfdatatable.Columns.Add("FilePageRangeSelectIndex");
             pdfdatatable.Columns.Add("FileSize");
             pdfdatatable.Columns.Add("FileState");
+            int datatableindex = 0;
             foreach (var fileName in fileNames)
             {
                 string file_all = fileName;
                 FileInfo f = new FileInfo(file_all);
                 string file_size = (((float)f.Length) / 1024).ToString() + " K";
-                pdfdatatable.Rows.Add(f.Name, file_size, state);
+                pdfdatatable.Rows.Add(f.Name, PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeText"], PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"], file_size, PDFCurrentDataTable.Rows[datatableindex]["FileState"]); 
+                datatableindex++;
             }
             PDFDataTable = pdfdatatable;
             HomePageBatchProcessingDialogModel.FilePaths = fileNames;
 
         }
+
+        /// <summary>
+        /// 更新Currentlistview显示
+        /// pagerangetext 自定义页面范围字符串  pagerangeselectindex combobox下拉索引(0全部页面 1奇数页 2偶数页 3自定义页面) state 状态显示字符串
+        /// </summary>
+        public void updateCurrentListview(string pagerangetext = "1", string pagerangeselectindex = "0", string state = "待完成")
+        {
+            if (fileNames.Count >= FileNameNumber)
+            {
+                for (int i = 0; fileNames.Count - FileNameNumber > i; i++)
+                {
+                    PDFCurrentDataTable.Rows.Add(pagerangetext, pagerangeselectindex, state);
+                }
+            }
+            else
+            {
+                Reverseorder(ref fileNamesView);
+                foreach (int filenamesview in fileNamesView)
+                {
+                    PDFCurrentDataTable.Rows.RemoveAt(filenamesview);
+                }
+            }
+        }
+
         /// <summary>
         /// 逆序int类型集合
         /// </summary>
@@ -374,6 +424,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void removepdffile()
         {
+            FileNameNumber = fileNames.Count;
             Reverseorder(ref fileNamesView);
             foreach (int filenamesview in fileNamesView)
             {

+ 48 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageRemoveDialogViewModel.cs

@@ -35,6 +35,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         private int fileNamesIndex = 0;
 
+        private int FileNameNumber = 0;
+
         HomePageCompressDialogModel homePageCompressDialogModel = new HomePageCompressDialogModel();
 
         private DataTable pdfDataTable = new DataTable();
@@ -47,6 +49,16 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
         }
 
+        private DataTable pdfCurrentDataTable = new DataTable();
+        public DataTable PDFCurrentDataTable
+        {
+            get { return pdfCurrentDataTable; }
+            set
+            {
+                SetProperty(ref pdfCurrentDataTable, value);
+            }
+        }
+
         private string optionsRemoveGridIsEnabled = "True";
         public string OptionsRemoveGridIsEnabled
         {
@@ -169,6 +181,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageRemoveDialogViewModel(IDialogService dialogService)
         {
             dialogs = dialogService;
+            PDFCurrentDataTable.Columns.Add("FileState");
             PDFDataTable.Columns.Add("FileName");
             PDFDataTable.Columns.Add("FileSize");
             PDFDataTable.Columns.Add("FileState");
@@ -235,6 +248,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 if (document == null)
                 {
                     PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                    PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
                     continue;
                 }
                 FileInfo fileinfo = new FileInfo(filename);
@@ -258,6 +272,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                         //未成功解密文档时,释放Document对象,返回
                         document.Release();
                         PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                        PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
                         continue;
                     }
                 }
@@ -287,6 +302,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                     document.WriteToFilePath(filename + "_Remove.pdf");
                 }
                 PDFDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
                 fileNamesIndex++;
                 document.Release();
             }
@@ -300,6 +316,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicture()
         {
+            FileNameNumber = fileNames.Count;
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = true;
             dlg.Filter = "PDF|*.pdf;*.PDF;";
@@ -314,6 +331,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         }
 
         public void addPDFFiles(string filename) {
+            FileNameNumber = fileNames.Count;
             fileNames.Add(filename);
             RemoveExcess(ref fileNames);
             SetOptionsRemoveGridIsEnabled = "True";
@@ -344,6 +362,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicturefiles()
         {
+            FileNameNumber = fileNames.Count;
             FolderBrowserDialog dialog = new FolderBrowserDialog();
             dialog.Description = "请选择文件路径";
             if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
@@ -372,21 +391,49 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void updateListview(string state)
         {
+            updateCurrentListview();
             DataTable pdfdatatable = new DataTable();
             pdfdatatable.Columns.Add("FileName");
             pdfdatatable.Columns.Add("FileSize");
             pdfdatatable.Columns.Add("FileState");
+            int datatableindex = 0;
             foreach (var fileName in fileNames)
             {
                 string file_all = fileName;
                 FileInfo f = new FileInfo(file_all);
                 string file_size = (((float)f.Length) / 1024).ToString() + " K";
                 pdfdatatable.Rows.Add(f.Name, file_size, state);
+                pdfdatatable.Rows.Add(f.Name, file_size, PDFCurrentDataTable.Rows[datatableindex]["FileState"]);
+                datatableindex++;
             }
             PDFDataTable = pdfdatatable;
             HomePageBatchProcessingDialogModel.FilePaths = fileNames;
 
         }
+
+        /// <summary>
+        /// 更新Currentlistview显示
+        /// state 状态显示字符串
+        /// </summary>
+        public void updateCurrentListview(string state = "待完成")
+        {
+            if (fileNames.Count >= FileNameNumber)
+            {
+                for (int i = 0; fileNames.Count - FileNameNumber > i; i++)
+                {
+                    PDFCurrentDataTable.Rows.Add(state);
+                }
+            }
+            else
+            {
+                Reverseorder(ref fileNamesView);
+                foreach (int filenamesview in fileNamesView)
+                {
+                    PDFCurrentDataTable.Rows.RemoveAt(filenamesview);
+                }
+            }
+        }
+
         /// <summary>
         /// 逆序int类型集合
         /// </summary>
@@ -413,6 +460,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void removepdffile()
         {
+            FileNameNumber = fileNames.Count;
             Reverseorder(ref fileNamesView);
             foreach (int filenamesview in fileNamesView)
             {

+ 45 - 2
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageSetPasswordDialogViewModel.cs

@@ -23,6 +23,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         private int fileNamesIndex = 0;
 
+        private int FileNameNumber = 0;
+
         private HomePageSetPasswordDialogModel setPasswordDialogModel = new HomePageSetPasswordDialogModel();
 
         public List<int> fileNamesView = new List<int>();
@@ -127,6 +129,16 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
         }
 
+        private DataTable pdfCurrentDataTable = new DataTable();
+        public DataTable PDFCurrentDataTable
+        {
+            get { return pdfCurrentDataTable; }
+            set
+            {
+                SetProperty(ref pdfCurrentDataTable, value);
+            }
+        }
+
         private string removeIsEnable = "False";
         public string RemoveIsEnable
         {
@@ -183,6 +195,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public HomePageSetPasswordDialogViewModel()
         {
+            PDFCurrentDataTable.Columns.Add("FileState");
             PDFDataTable.Columns.Add("FileName");
             PDFDataTable.Columns.Add("FileSize");
             PDFDataTable.Columns.Add("FileState");
@@ -288,6 +301,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 if (document == null)
                 {
                     PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                    PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
                     continue;
                 }
                 FileInfo fileinfo = new FileInfo(filename);
@@ -300,6 +314,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 document.WriteToFilePath(filename + "SetPassword");
 
                 PDFDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
                 fileNamesIndex++;
                 document.Release();
             }
@@ -314,6 +329,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpdf()
         {
+            FileNameNumber = fileNames.Count;
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = true;
             dlg.Filter = "PDF|*.pdf;*.PDF;";
@@ -329,6 +345,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public void addPDFFiles(string filename)
         {
+            FileNameNumber = fileNames.Count;
             fileNames.Add(filename);
             RemoveExcess(ref fileNames);
             SetSafetyGridIsEnabled = "True";
@@ -358,6 +375,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpdffiles()
         {
+            FileNameNumber = fileNames.Count;
             FolderBrowserDialog dialog = new FolderBrowserDialog();
             dialog.Description = "请选择文件路径";
             if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
@@ -386,23 +404,47 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void updateListview(string state)
         {
+            updateCurrentListview();
             DataTable pdfdatatable = new DataTable();
             pdfdatatable.Columns.Add("FileName");
             pdfdatatable.Columns.Add("FileSize");
             pdfdatatable.Columns.Add("FileState");
+            int datatableindex = 0;
             foreach (var fileName in fileNames)
             {
                 string file_all = fileName;
                 FileInfo f = new FileInfo(file_all);
                 string file_size = (((float)f.Length) / 1024).ToString() + " K";
-                pdfdatatable.Rows.Add(f.Name, file_size, state);
+                pdfdatatable.Rows.Add(f.Name, file_size, PDFCurrentDataTable.Rows[datatableindex]["FileState"]);
+                datatableindex++;
             }
             PDFDataTable = pdfdatatable;
             HomePageBatchProcessingDialogModel.FilePaths = fileNames;
 
         }
 
-        
+        /// <summary>
+        /// 更新Currentlistview显示
+        /// state 状态显示字符串
+        /// </summary>
+        public void updateCurrentListview( string state = "待完成")
+        {
+            if (fileNames.Count >= FileNameNumber)
+            {
+                for (int i = 0; fileNames.Count - FileNameNumber > i; i++)
+                {
+                    PDFCurrentDataTable.Rows.Add(state);
+                }
+            }
+            else
+            {
+                Reverseorder(ref fileNamesView);
+                foreach (int filenamesview in fileNamesView)
+                {
+                    PDFCurrentDataTable.Rows.RemoveAt(filenamesview);
+                }
+            }
+        }
 
         /// <summary>
         /// 逆序int类型集合
@@ -430,6 +472,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void removepdffile()
         {
+            FileNameNumber = fileNames.Count;
             Reverseorder(ref fileNamesView);
             foreach (int filenamesview in fileNamesView)
             {

+ 72 - 20
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkDialogViewModel.cs

@@ -79,6 +79,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         private int fileNamesIndex = 0;
 
+        private int FileNameNumber = 0;
+
         private string watermarkGridIsEnabled = "True";
         public string WatermarkGridIsEnabled
         {
@@ -115,6 +117,16 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             }
         }
 
+        private DataTable pdfCurrentDataTable = new DataTable();
+        public DataTable PDFCurrentDataTable
+        {
+            get { return pdfCurrentDataTable; }
+            set
+            {
+                SetProperty(ref pdfCurrentDataTable, value);
+            }
+        }
+
         private string removeIsEnable = "False";
         public string RemoveIsEnable
         {
@@ -186,6 +198,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             this.watermarkRegion = watermarkRegion;
             Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             WatermarkSettingsVisible = Visibility.Visible;
+            PDFCurrentDataTable.Columns.Add("FilePageRangeText");
+            PDFCurrentDataTable.Columns.Add("FilePageRangeSelectIndex");
+            PDFCurrentDataTable.Columns.Add("FileState");
             PDFDataTable.Columns.Add("FileName");
             PDFDataTable.Columns.Add("FilePageRangeText");
             PDFDataTable.Columns.Add("FilePageRangeSelectIndex");
@@ -282,26 +297,30 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             WatermarkGridIsEnabled = "False";
             foreach (var filename in fileNames)
             {
-                FileInfo fileinfo = new FileInfo(filename);
-                string OutputPath = fileinfo.DirectoryName;
-                char[] enumerationSeparator = new char[] { ',' };
-                char[] rangeSeparator = new char[] { '-' };
-                List<int> PageIndexLists = new List<int>();
-                CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
-                if (document == null)
-                {
-                    PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
-                    continue;
-                }
-                if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(), document.PageCount, enumerationSeparator, rangeSeparator))
-                { //TODO
-                    Trace.WriteLine("输入不对");
-                    MessageBoxEx.Show("输入不对");
-                    return;
-                }
-
-                document.Release();
+                //FileInfo fileinfo = new FileInfo(filename);
+                //string OutputPath = fileinfo.DirectoryName;
+                //char[] enumerationSeparator = new char[] { ',' };
+                //char[] rangeSeparator = new char[] { '-' };
+                //List<int> PageIndexLists = new List<int>();
+                //CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
+                //if (document == null)
+                //{
+                //    PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
+                //    continue;
+                //}
+                //if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(), document.PageCount, enumerationSeparator, rangeSeparator))
+                //{ //TODO
+                //    Trace.WriteLine("输入不对");
+                //    MessageBoxEx.Show("输入不对");
+                //    return;
+                //}
+
+                //document.Release();
+                PDFDataTable.Rows[fileNamesIndex]["FilePageRangeSelectIndex"] = "2";
                 PDFDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeText"] = "2";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeSelectIndex"] = "2";
+                PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
                 fileNamesIndex++;
             }
             WatermarkGridIsEnabled = "True";
@@ -314,6 +333,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicture()
         {
+            FileNameNumber = fileNames.Count;
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = true;
             dlg.Filter = "PDF|*.pdf;*.PDF;";
@@ -329,6 +349,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public void addPDFFiles(string filename)
         {
+            FileNameNumber = fileNames.Count;
             fileNames.Add(filename);
             RemoveExcess(ref fileNames);
             SetWatermarkGridIsEnabled = "True";
@@ -358,6 +379,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         private void addpicturefiles()
         {
+            FileNameNumber = fileNames.Count;
             FolderBrowserDialog dialog = new FolderBrowserDialog();
             dialog.Description = "请选择文件路径";
             if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
@@ -386,21 +408,50 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void updateListview(string state)
         {
+            updateCurrentListview();
             DataTable pdfdatatable = new DataTable();
             pdfdatatable.Columns.Add("FileName");
+            pdfdatatable.Columns.Add("FilePageRangeText");
+            pdfdatatable.Columns.Add("FilePageRangeSelectIndex");
             pdfdatatable.Columns.Add("FileSize");
             pdfdatatable.Columns.Add("FileState");
+            int datatableindex = 0;
             foreach (var fileName in fileNames)
             {
                 string file_all = fileName;
                 FileInfo f = new FileInfo(file_all);
                 string file_size = (((float)f.Length) / 1024).ToString() + " K";
-                pdfdatatable.Rows.Add(f.Name, file_size, state);
+                pdfdatatable.Rows.Add(f.Name, PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeText"], PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"], file_size, PDFCurrentDataTable.Rows[datatableindex]["FileState"]);
+                datatableindex++;
             }
             PDFDataTable = pdfdatatable;
             HomePageBatchProcessingDialogModel.FilePaths = fileNames;
 
         }
+
+        /// <summary>
+        /// 更新Currentlistview显示
+        /// pagerangetext 自定义页面范围字符串  pagerangeselectindex combobox下拉索引(0全部页面 1奇数页 2偶数页 3自定义页面) state 状态显示字符串
+        /// </summary>
+        public void updateCurrentListview(string pagerangetext = "1", string pagerangeselectindex = "0", string state = "待完成")
+        {
+            if (fileNames.Count >= FileNameNumber)
+            {
+                for (int i = 0; fileNames.Count - FileNameNumber > i; i++)
+                {
+                    PDFCurrentDataTable.Rows.Add(pagerangetext, pagerangeselectindex, state);
+                }
+            }
+            else
+            {
+                Reverseorder(ref fileNamesView);
+                foreach (int filenamesview in fileNamesView)
+                {
+                    PDFCurrentDataTable.Rows.RemoveAt(filenamesview);
+                }
+            }
+        }
+
         /// <summary>
         /// 逆序int类型集合
         /// </summary>
@@ -427,6 +478,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         /// </summary>
         public void removepdffile()
         {
+            FileNameNumber = fileNames.Count;
             Reverseorder(ref fileNamesView);
             foreach (int filenamesview in fileNamesView)
             {