Pārlūkot izejas kodu

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

# Conflicts:
#	PDF Office/PDF Office.csproj
liuaoran 2 gadi atpakaļ
vecāks
revīzija
41746e1923
66 mainītis faili ar 1092 papildinājumiem un 167 dzēšanām
  1. 1 0
      PDF Office/App.xaml.cs
  2. BIN
      PDF Office/ComPDFKit.Desk.dll
  3. 41 25
      PDF Office/CustomControl/NumericUpDown.xaml
  4. 13 0
      PDF Office/CustomControl/ScanViewControl/BoxSelection.cs
  5. 2 2
      PDF Office/CustomControl/ScanViewControl/CustomDraw.cs
  6. 41 7
      PDF Office/CustomControl/ScanViewControl/CustomPanel.cs
  7. 33 0
      PDF Office/DataConvert/BoolToBrushConvert.cs
  8. 15 0
      PDF Office/EventAggregators/ScanEvent.cs
  9. 15 18
      PDF Office/Helper/CacheFilePath.cs
  10. 0 16
      PDF Office/Helper/CommomEvent.cs
  11. 3 3
      PDF Office/Helper/CommonHelper.cs
  12. 1 1
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageExtractDialogModel.cs
  13. 1 1
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageSplitDialogModel.cs
  14. 5 0
      PDF Office/Model/DialogNames.cs
  15. 17 2
      PDF Office/PDF Office.csproj
  16. 151 2
      PDF Office/Styles/TabControlStyle.xaml
  17. 29 0
      PDF Office/ViewModels/BottomToolContentViewModel.cs
  18. 5 3
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterImgDialogViewModel.cs
  19. 3 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateBaseContentViewModel.cs
  20. 1 2
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateColorContentViewModel.cs
  21. 2 4
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateFileContentViewModel.cs
  22. 3 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundDialogViewModel.cs
  23. 2 2
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundTemplateListBaseContentViewModel.cs
  24. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundTemplateListColorContentViewModel.cs
  25. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundTemplateListFileContentViewModel.cs
  26. 4 2
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContentViewModel.cs
  27. 3 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesDialogViewModel.cs
  28. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesTemplateListContentViewModel.cs
  29. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterCreateContentViewModel.cs
  30. 3 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterDialogViewModel.cs
  31. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterTemplateListContentViewModel.cs
  32. 3 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateBaseContentViewModel.cs
  33. 2 2
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateFileContentViewModel.cs
  34. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateTextContentViewModel.cs
  35. 3 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkDialogViewModel.cs
  36. 4 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkTemplateListBaseContentViewModel.cs
  37. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkTemplateListFileContentViewModel.cs
  38. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkTemplateListTextContentViewModel.cs
  39. 30 0
      PDF Office/ViewModels/Dialog/InfoDialogViewModel.cs
  40. 1 1
      PDF Office/ViewModels/EditTools/Bates/BatesContentViewModel.cs
  41. 3 0
      PDF Office/ViewModels/EditTools/Bates/BatesCreateContentViewModel.cs
  42. 1 0
      PDF Office/ViewModels/EditTools/Bates/BatesDocumentContentViewModel.cs
  43. 1 1
      PDF Office/ViewModels/EditTools/HeaderFooter/HeaderFooterContentViewModel.cs
  44. 2 0
      PDF Office/ViewModels/EditTools/HeaderFooter/HeaderFooterDocumentContentViewModel.cs
  45. 5 1
      PDF Office/ViewModels/EditTools/Watermark/WatermarkDocumentContentViewModel.cs
  46. 6 5
      PDF Office/ViewModels/EditTools/Watermark/WatermarkTemplateListBaseContentViewModel.cs
  47. 6 5
      PDF Office/ViewModels/EditTools/Watermark/WatermarkTemplateListFileContentViewModel.cs
  48. 6 5
      PDF Office/ViewModels/EditTools/Watermark/WatermarkTemplateListTextContentViewModel.cs
  49. 2 2
      PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs
  50. 56 2
      PDF Office/ViewModels/Scan/ScanViwerViewModel.cs
  51. 43 8
      PDF Office/ViewModels/ViewContentViewModel.cs
  52. 31 5
      PDF Office/Views/BottomToolContent.xaml
  53. 1 1
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateFileContent.xaml
  54. 1 1
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContent.xaml.cs
  55. 234 0
      PDF Office/Views/Dialog/InfoDialog.xaml
  56. 28 0
      PDF Office/Views/Dialog/InfoDialog.xaml.cs
  57. 2 1
      PDF Office/Views/EditTools/Bates/BatesCreateContent.xaml.cs
  58. 1 1
      PDF Office/Views/EditTools/Bates/BatesTemplateListContent.xaml
  59. 9 0
      PDF Office/Views/MainWindow.xaml
  60. 32 0
      PDF Office/Views/Scan/Redress.xaml
  61. 58 0
      PDF Office/Views/Scan/Redress.xaml.cs
  62. 19 1
      PDF Office/Views/Scan/ScanViwer.xaml
  63. 45 1
      PDF Office/Views/Scan/ScanViwer.xaml.cs
  64. 43 19
      PDF Office/Views/ViewContent.xaml
  65. 12 0
      PDF Office/Views/ViewContent.xaml.cs
  66. BIN
      PDF Office/x64/ComPDFKit.dll

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

@@ -312,6 +312,7 @@ namespace PDF_Office
             containerRegistry.RegisterDialog<MarkSettingDialog>(DialogNames.MarkSettingDialog);
             containerRegistry.RegisterDialog<PageMarkDialog>(DialogNames.PageMarkDialog);
             containerRegistry.RegisterDialog<RepeatMarkDialog>(DialogNames.RepeatMarkDialog);
+            containerRegistry.RegisterDialog<InfoDialog>(DialogNames.InfoDialog);
 
             #endregion 注册弹窗
         }

BIN
PDF Office/ComPDFKit.Desk.dll


+ 41 - 25
PDF Office/CustomControl/NumericUpDown.xaml

@@ -7,7 +7,6 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     d:DesignHeight="32"
     d:DesignWidth="80"
-    Background="#EEEEEE"
     FontSize="20"
     mc:Ignorable="d">
     <Border>
@@ -16,6 +15,11 @@
                 <ColumnDefinition Width="*" />
                 <ColumnDefinition Width="auto" />
             </Grid.ColumnDefinitions>
+            <Border
+                Background="{StaticResource color.field.bg.def}"
+                BorderBrush="{StaticResource color.field.border.norm}"
+                BorderThickness="1,1,0,1"
+                CornerRadius="4,0,0,4" />
             <TextBox
                 Name="TextBox_Num"
                 MinWidth="80"
@@ -37,32 +41,44 @@
                     <RowDefinition />
                     <RowDefinition />
                 </Grid.RowDefinitions>
-                <Button
-                    Name="Button_Add"
+                <Border
                     Grid.Row="0"
-                    Background="Transparent"
-                    BorderBrush="Transparent"
-                    BorderThickness="0"
-                    Click="Button_Add_Click">
-                    <Path
-                        HorizontalAlignment="Center"
-                        Data="M8 4.29102L2.14648 10.1445L2.85547 10.8535L8 5.70898L13.1445 10.8535L13.8535 10.1445L8 4.29102Z"
-                        Fill="Black"
-                        Stretch="Uniform"
-                        Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
-                </Button>
-                <Button
-                    Name="Button_Sub"
+                    Background="{StaticResource color.field.bg.def}"
+                    BorderBrush="{StaticResource color.field.border.norm}"
+                    BorderThickness="1,1,1,0.5"
+                    CornerRadius="0,4,0,0">
+                    <Button
+                        Name="Button_Add"
+                        Background="Transparent"
+                        BorderBrush="Transparent"
+                        BorderThickness="0"
+                        Click="Button_Add_Click">
+                        <Path
+                            HorizontalAlignment="Center"
+                            Data="M10 5.93571L13.9696 9.90532L15.0303 8.84466L10.5303 4.34472C10.2374 4.05183 9.76257 4.05183 9.46967 4.34472L4.96974 8.84466L6.0304 9.90532L10 5.93571Z"
+                            Fill="{StaticResource color.icon.arrow.gray.def}"
+                            Stretch="Uniform"
+                            Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
+                    </Button>
+                </Border>
+                <Border
                     Grid.Row="1"
-                    Background="Transparent"
-                    BorderThickness="00"
-                    Click="Button_Sub_Click">
-                    <Path
-                        Data="M13.8535 5.85547L13.1445 5.14648L8 10.291L2.85547 5.14648L2.14648 5.85547L8 11.709L13.8535 5.85547Z"
-                        Fill="Black"
-                        Stretch="Uniform"
-                        Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
-                </Button>
+                    Background="{StaticResource color.field.bg.def}"
+                    BorderBrush="{StaticResource color.field.border.norm}"
+                    BorderThickness="1,0.5,1,1"
+                    CornerRadius="0,0,4,0">
+                    <Button
+                        Name="Button_Sub"
+                        Background="Transparent"
+                        BorderThickness="00"
+                        Click="Button_Sub_Click">
+                        <Path
+                            Data="M10 9.06427L6.03039 5.09467L4.96973 6.15533L9.46967 10.6553C9.76256 10.9482 10.2374 10.9482 10.5303 10.6553L15.0303 6.15533L13.9696 5.09467L10 9.06427Z"
+                            Fill="{StaticResource color.icon.arrow.gray.def}"
+                            Stretch="Uniform"
+                            Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
+                    </Button>
+                </Border>
             </Grid>
         </Grid>
     </Border>

+ 13 - 0
PDF Office/CustomControl/ScanViewControl/BoxSelection.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PDF_Office.CustomControl.ScanViewControl
+{
+    public class BoxSelection : FrameworkElement
+    {
+    }
+}

+ 2 - 2
PDF Office/CustomControl/ScanViewControl/CustomDraw.cs

@@ -9,7 +9,7 @@ using System.Windows.Media;
 
 namespace PDF_Office.CustomControl.ScanViewControl
 {
-    class CustomDraw : DrawingVisual
+    public class CustomDraw : DrawingVisual
     {
         public Rect PaintRect;
         public Rect RawRect;
@@ -34,7 +34,7 @@ namespace PDF_Office.CustomControl.ScanViewControl
                     FlowDirection.LeftToRight,
                     new Typeface(new FontFamily("Arial"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
                     fontSize,
-                    Brushes.Green,Helper.DpiHelpers.Dpi/96F);
+                    Brushes.Green, Helper.DpiHelpers.Dpi / 96F);
                 while (formatText.Width + fontSize < PaintRect.Width && formatText.Height < PaintRect.Height)
                 {
                     fontSize += 1;

+ 41 - 7
PDF Office/CustomControl/ScanViewControl/CustomPanel.cs

@@ -11,9 +11,9 @@ using System.Windows.Media.Imaging;
 
 namespace PDF_Office.CustomControl.ScanViewControl
 {
-    class CustomPanel: Panel
+    class CustomPanel : Panel
     {
-        public SolidColorBrush CoverBrush { get; set; } = new SolidColorBrush(Color.FromArgb(0xA0, 0xFF, 0xFF, 0xFF));
+        public SolidColorBrush CoverBrush { get; set; } = new SolidColorBrush(Color.FromArgb(0xCC, 0xFF, 0xFF, 0xFF));
         public bool DrawCover { get; set; } = false;
 
         private WriteableBitmap BackgroundImage = null;
@@ -33,19 +33,19 @@ namespace PDF_Office.CustomControl.ScanViewControl
         public WriteableBitmap BGImage
         {
             get { return (WriteableBitmap)GetValue(BGImageProperty); }
-            set 
-            { 
-                SetValue(BGImageProperty, value); 
+            set
+            {
+                SetValue(BGImageProperty, value);
             }
         }
 
         // Using a DependencyProperty as the backing store for BGImage.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty BGImageProperty =
-            DependencyProperty.Register("BGImage", typeof(WriteableBitmap), typeof(CustomPanel), new FrameworkPropertyMetadata(null,new PropertyChangedCallback(OnImageChanged)));
+            DependencyProperty.Register("BGImage", typeof(WriteableBitmap), typeof(CustomPanel), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnImageChanged)));
 
         private static void OnImageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
         {
-            if ((e.NewValue as  WriteableBitmap)!=null)
+            if ((e.NewValue as WriteableBitmap) != null)
             {
                 (d as CustomPanel).SetBackgroundImage(e.NewValue as WriteableBitmap);
             }
@@ -174,6 +174,40 @@ namespace PDF_Office.CustomControl.ScanViewControl
             }
         }
 
+        public void DisplayContent(CustomDraw custom)
+        {
+            if (custom != null)
+            {
+                if (HoverChild == null)
+                {
+                    HoverChild = custom;
+                    HoverChild.DrawBounds();
+                    if (ParentBlock != null)
+                    {
+                        ParentBlock.Text = HoverChild.PaintText;
+                    }
+                }
+                else
+                {
+                    if (HoverChild != custom)
+                    {
+                        HoverChild?.Draw();
+                        HoverChild = custom;
+                        HoverChild.DrawBounds();
+                    }
+                }
+            }
+            else
+            {
+                if (HoverChild != null)
+                {
+                    HoverChild.Draw();
+                    HoverChild = null;
+                }
+            }
+
+        }
+
         public int GetBackgroundImageWidth()
         {
             if (BackgroundImage != null)

+ 33 - 0
PDF Office/DataConvert/BoolToBrushConvert.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace PDF_Office.DataConvert
+{
+    internal class BoolToBrushConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value is bool flag)
+            {
+                if (flag)
+                {
+                    //Color color = (Color)App.Current.FindResource("color.sys.text.accent.norm");
+                    return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1770F4"));
+                    //return new SolidColorBrush(color);
+                }
+            }
+            return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#616469"));
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            return null;
+        }
+    }
+}

+ 15 - 0
PDF Office/EventAggregators/ScanEvent.cs

@@ -95,4 +95,19 @@ namespace PDF_Office.EventAggregators
     {
 
     }
+    class a : ComPDFKitViewer.IHistory
+    {
+        List<int> x;
+        public bool Redo()
+        {
+            x.Add(1);
+            return true;
+        }
+
+        public bool Undo()
+        {
+            x.Remove(1);
+            return true;
+        }
+    }
 }

+ 15 - 18
PDF Office/Helper/CacheFilePath.cs

@@ -15,7 +15,7 @@ namespace PDF_Office.Helper
     /// 功能模块需要创建缓存文件夹时,统一在此类里处理
     /// 临时文件在app启动时进行删除
     /// </summary>
-    public class CacheFilePath:BindableBase
+    public class CacheFilePath : BindableBase
     {
         private static readonly CacheFilePath instance = new CacheFilePath();
 
@@ -23,7 +23,7 @@ namespace PDF_Office.Helper
         /// 图章缓存文件夹路径
         /// </summary>
         List<string> CustomStamp = new List<string> { "CustomStamp" };
-        List<string> SignatureFreeHand = new List<string> { "Signature" ,"FreeHand" };
+        List<string> SignatureFreeHand = new List<string> { "Signature", "FreeHand" };
         List<string> SignatureStamp = new List<string> { "Signature", "Stamp" };
         List<string> MergeFile = new List<string> { "Temp" };
 
@@ -48,9 +48,9 @@ namespace PDF_Office.Helper
 
         }
 
-        ~ CacheFilePath()
+        ~CacheFilePath()
         {
-            if(CopyDoc!=null)
+            if (CopyDoc != null)
             {
                 CopyDoc.Release();
             }
@@ -63,7 +63,7 @@ namespace PDF_Office.Helper
         {
             get
             {
-               return CreateCacheDirectory(CustomStamp);
+                return CreateCacheDirectory(CustomStamp);
             }
         }
 
@@ -74,7 +74,7 @@ namespace PDF_Office.Helper
         {
             get
             {
-               return CreateCacheDirectory(SignatureStamp);
+                return CreateCacheDirectory(SignatureStamp);
             }
         }
         /// <summary>
@@ -84,7 +84,7 @@ namespace PDF_Office.Helper
         {
             get
             {
-               return CreateCacheDirectory(SignatureFreeHand);
+                return CreateCacheDirectory(SignatureFreeHand);
             }
         }
 
@@ -95,10 +95,10 @@ namespace PDF_Office.Helper
         {
             get
             {
-               return CreateCacheDirectory(MergeFile);
+                return CreateCacheDirectory(MergeFile);
             }
         }
-        
+
         /// <summary>
         ///  在“文档”路径下创建缓存文件夹,传C:\Users\kdan\Documents\PDF Office 以后的文件夹名
         /// </summary>
@@ -113,7 +113,7 @@ namespace PDF_Office.Helper
                 {
                     Path = System.IO.Path.Combine(Path, directoryName[i]);
                 }
-           
+
                 System.IO.DirectoryInfo directoryInfo = System.IO.Directory.CreateDirectory(Path);
                 if (directoryInfo.Exists
                    && (directoryInfo.Attributes & System.IO.FileAttributes.ReadOnly) != System.IO.FileAttributes.ReadOnly
@@ -155,7 +155,7 @@ namespace PDF_Office.Helper
 
         public void AddToDeleteFiles(List<string> files)
         {
-            foreach(string file in files)
+            foreach (string file in files)
             {
                 AddToDeleteFiles(file);
             }
@@ -177,15 +177,12 @@ namespace PDF_Office.Helper
                 }
                 Settings.Default.AppProperties.NeedToDeletePath.Clear();
 
-                //清楚Temp 文件夹下的临时文件
-                DirectoryInfo tempfolder = new DirectoryInfo(Path.Combine(App.CurrentPath, "Temp"));
+                //清除Temp文件夹及该目录中的所有子内容
+                string TempPath= Path.Combine(App.CurrentPath, "Temp");
+                DirectoryInfo tempfolder = new DirectoryInfo(TempPath);
                 if (tempfolder.Exists)
                 {
-                    foreach (var file in tempfolder.GetFiles())
-                    {
-                        if (file.Exists)
-                            file.Delete();
-                    }
+                    Directory.Delete(TempPath, true);
                 }
             }
             catch { }

+ 0 - 16
PDF Office/Helper/CommomEvent.cs

@@ -1,16 +0,0 @@
-using ComPDFKitViewer.PdfViewer;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.Helper
-{
-    /// <summary>
-    /// 可以复用的事件,避免重复写相同的逻辑
-    /// </summary>
-    public static class CommomEvent
-    {
-    }
-}

+ 3 - 3
PDF Office/Helper/CommonHelper.cs

@@ -387,15 +387,15 @@ namespace PDF_Office.Helper
             switch (unit)
             {
                 case PageItemUnits.MM:
-                    sizeWithUnit = (size * 96 / 72.0) / GetDpi() * 25.4;
+                    sizeWithUnit = size / 72 * 25.4;
                     break;
 
                 case PageItemUnits.CM:
-                    sizeWithUnit = (size * 96 / 72.0) / GetDpi() * 25.4 / 10.0;
+                    sizeWithUnit = size / 72 * 25.4/ 10.0;
                     break;
 
                 case PageItemUnits.IN:
-                    sizeWithUnit = (size * 96 / 72.0) / GetDpi();
+                    sizeWithUnit = size / 72;
                     break;
 
                 default:

+ 1 - 1
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageExtractDialogModel.cs

@@ -15,7 +15,7 @@ namespace PDF_Office.Model.HomePageToolsDialogs
         /// <summary>
         /// 页码 存入页码范围;
         /// </summary>
-        public string PageRange = "1,3-4,10";
+        public string PageRange = "";
         /// <summary>
         /// 是否拆分为单文件
         /// </summary>

+ 1 - 1
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageSplitDialogModel.cs

@@ -25,7 +25,7 @@ namespace PDF_Office.Model.HomePageToolsDialogs
         /// <summary>
         /// 页面信息
         /// </summary>
-        public string PageRange = "1,3-4,10";
+        public string PageRange = "";
 
         private int pageSelectedIndex = 1;
 

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

@@ -11,6 +11,11 @@ namespace PDF_Office.Model
     /// </summary>
     public static class DialogNames
     {
+        /// <summary>
+        /// 偏好设置
+        /// </summary>
+        public static string InfoDialog = "InfoDialog";
+
         /// <summary>
         /// 文档解密弹窗 需要传参PDFDocument对象
         /// </summary>

+ 17 - 2
PDF Office/PDF Office.csproj

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <Import Project="packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.props" Condition="Exists('packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.props')" />
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
@@ -283,6 +283,7 @@
       <DependentUpon>WritableComboBox.xaml</DependentUpon>
     </Compile>
     <Compile Include="DataConvert\AnnotateFontSizeConverter.cs" />
+    <Compile Include="DataConvert\BoolToBrushConvert.cs" />
     <Compile Include="DataConvert\BoolToTextWrapConvert.cs" />
     <Compile Include="DataConvert\CenterToolTipConverter .cs" />
     <Compile Include="DataConvert\ColorBrushConvert.cs" />
@@ -393,7 +394,6 @@
     <Compile Include="DataConvert\VisibleToBoolConvert.cs" />
     <Compile Include="EventAggregators\DragablzWindowEvent.cs" />
     <Compile Include="EventAggregators\OpenFileEvent.cs" />
-    <Compile Include="Helper\CommomEvent.cs" />
     <Compile Include="Helper\CommonHelper.cs" />
     <Compile Include="Properties\Resources.Designer.cs">
       <DependentUpon>Resources.resx</DependentUpon>
@@ -401,6 +401,7 @@
       <AutoGen>True</AutoGen>
     </Compile>
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\CreateFromHtmlDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\InfoDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\Redaction\MarkSettingDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\Redaction\PageMarkDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\Redaction\RepeatMarkDialogViewModel.cs" />
@@ -745,6 +746,9 @@
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageSplitDialog.xaml.cs">
       <DependentUpon>HomePageSplitDialog.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Dialog\InfoDialog.xaml.cs">
+      <DependentUpon>InfoDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Dialog\PageEditDialogs\ExtractDialog.xaml.cs">
       <DependentUpon>ExtractDialog.xaml</DependentUpon>
     </Compile>
@@ -1032,6 +1036,9 @@
     <Compile Include="Views\PropertyPanel\ViewModular\ViewModularContent.xaml.cs">
       <DependentUpon>ViewModularContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Scan\Redress.xaml.cs">
+      <DependentUpon>Redress.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Scan\ScanViwer.xaml.cs">
       <DependentUpon>ScanViwer.xaml</DependentUpon>
     </Compile>
@@ -1413,6 +1420,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Dialog\InfoDialog.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Views\Dialog\PageEditDialogs\SplitDialog.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1872,6 +1883,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Views\Scan\Redress.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Scan\ScanViwer.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 151 - 2
PDF Office/Styles/TabControlStyle.xaml

@@ -76,7 +76,6 @@
                             <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
                             <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
                             <Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
-
                         </Trigger>
                         <Trigger Property="TabStripPlacement" Value="Left">
                             <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
@@ -196,7 +195,6 @@
                                 <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Right" />
                             </MultiDataTrigger.Conditions>
                             <Setter TargetName="templateRoot" Property="Opacity" Value="0.56" />
-
                         </MultiDataTrigger>
                         <MultiDataTrigger>
                             <MultiDataTrigger.Conditions>
@@ -510,6 +508,7 @@
                                 x:Name="PART_SelectedContentHost"
                                 Margin="{TemplateBinding Padding}"
                                 ContentSource="SelectedContent"
+
                                 SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                         </Border>
                     </Grid>
@@ -551,4 +550,154 @@
             </Setter.Value>
         </Setter>
     </Style>
+
+    <Style x:Key="InfoTabControl" TargetType="{x:Type TabControl}">
+        <Setter Property="Padding" Value="8" />
+        <Setter Property="HorizontalContentAlignment" Value="Left" />
+        <Setter Property="VerticalContentAlignment" Value="Center" />
+        <Setter Property="BorderThickness" Value="0" />
+        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type TabControl}">
+                    <Grid
+                        x:Name="templateRoot"
+                        ClipToBounds="true"
+                        KeyboardNavigation.TabNavigation="Local"
+                        SnapsToDevicePixels="true">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition x:Name="ColumnDefinition0" Width="200" />
+                            <ColumnDefinition x:Name="ColumnDefinition1" Width="500" />
+                        </Grid.ColumnDefinitions>
+                        <Border
+                            Grid.Column="0"
+                            Width="200"
+                            HorizontalAlignment="Stretch"
+                            VerticalAlignment="Stretch"
+                            Background="{StaticResource color.sys.layout.mg}"
+                            BorderThickness="1"
+                            CornerRadius="4">
+                            <TabPanel
+                                x:Name="headerPanel"
+                                Width="180"
+                                HorizontalAlignment="Center"
+                                VerticalAlignment="Stretch"
+                                Panel.ZIndex="1"
+                                Background="Transparent"
+                                IsItemsHost="true"
+                                KeyboardNavigation.TabIndex="1" />
+                        </Border>
+                        <Border
+                            x:Name="contentPanel"
+                            Grid.Column="1"
+                            Background="{TemplateBinding Background}"
+                            BorderBrush="{TemplateBinding BorderBrush}"
+                            BorderThickness="{TemplateBinding BorderThickness}"
+                            KeyboardNavigation.DirectionalNavigation="Contained"
+                            KeyboardNavigation.TabIndex="2"
+                            KeyboardNavigation.TabNavigation="Local">
+                            <ContentPresenter
+                                x:Name="PART_SelectedContentHost"
+                                Margin="{TemplateBinding Margin}"
+                                ContentSource="SelectedContent"
+                                HorizontalAlignment="Right"
+                                VerticalAlignment="Center"
+                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                        </Border>
+                    </Grid>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="TabStripPlacement" Value="Bottom">
+                            <Setter TargetName="headerPanel" Property="Grid.Row" Value="1" />
+                            <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
+                            <Setter TargetName="headerPanel" Property="Margin" Value="2,0,2,2" />
+                        </Trigger>
+                        <Trigger Property="TabStripPlacement" Value="Left">
+                            <Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
+                            <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
+                            <Setter TargetName="headerPanel" Property="Grid.Column" Value="0" />
+                            <Setter TargetName="contentPanel" Property="Grid.Column" Value="1" />
+                            <Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
+                            <Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
+                            <Setter TargetName="headerPanel" Property="Margin" Value="2,2,0,2" />
+                        </Trigger>
+                        <Trigger Property="TabStripPlacement" Value="Right">
+                            <Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
+                            <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
+                            <Setter TargetName="headerPanel" Property="Grid.Column" Value="1" />
+                            <Setter TargetName="contentPanel" Property="Grid.Column" Value="0" />
+                            <Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
+                            <Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
+                            <Setter TargetName="headerPanel" Property="Margin" Value="0,2,2,2" />
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+    <Style x:Key="InfoTabItem" TargetType="{x:Type TabItem}">
+        <Setter Property="Height" Value="50" />
+        <Setter Property="Width" Value="200" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type TabItem}">
+                    <Grid>
+                        <Border
+                            Name="Border"
+                            Padding="8,0"
+                            Height="32"
+                            Background="Transparent"
+                            BorderBrush="Transparent"
+                            BorderThickness="1"
+                            CornerRadius="4">
+                            <ContentPresenter
+                                x:Name="ContentSite"
+                                HorizontalAlignment="Left"
+                                VerticalAlignment="Center"
+                                ContentSource="Header"
+                                RecognizesAccessKey="True" />
+                        </Border>
+                    </Grid>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsSelected" Value="True">
+                            <Setter Property="Panel.ZIndex" Value="100" />
+                            <Setter TargetName="Border" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv1}" />
+                            <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
+                        </Trigger>
+                        <Trigger Property="IsSelected" Value="False">
+                            <Setter Property="Panel.ZIndex" Value="100" />
+                            <Setter TargetName="Border" Property="Background" Value="Transparent" />
+                            <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+    <!--<Style x:Key="InfoTabItem" TargetType="{x:Type TabItem}">
+    <Setter Property="HeaderTemplate">
+
+    <Setter.Value>
+    -->
+    <!--<DataTemplate>
+    <DataTemplate.Triggers>
+    <Trigger Property="IsSelected" Value="True">
+    <Setter TargetName="img" Property="Source" Value="images/customimage.png" />
+    </Trigger>
+    </DataTemplate.Triggers>
+    </DataTemplate>-->
+    <!--
+    <ControlTemplate TargetType="{x:Type TabItem}">
+    <ContentPresenter />
+    <ControlTemplate.Triggers>
+    <Trigger Property="IsSelected" Value="True">
+    <Setter TargetName="img" Property="Source" Value="images/customimage.png" />
+    </Trigger>
+    </ControlTemplate.Triggers>
+    </ControlTemplate>
+    </Setter.Value>
+    </Setter>
+    </Style>-->
 </ResourceDictionary>

+ 29 - 0
PDF Office/ViewModels/BottomToolContentViewModel.cs

@@ -170,6 +170,18 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        private bool rightPanelEnable = true;
+
+        public bool RightPanelEnable
+        {
+            get { return rightPanelEnable; }
+            set
+            {
+                SetProperty(ref rightPanelEnable, value);
+            }
+        }
+
+
         public CPDFViewer PDFViewer { get; set; }
 
         public ViewContentViewModel ViewContentViewModel { get; set; }
@@ -562,6 +574,8 @@ namespace PDF_Office.ViewModels
             {
                 this.ViewContentViewModel = viewContentViewModel;
                 IsShowViewModular = viewContentViewModel.IsPropertyOpen;
+                viewContentViewModel.PropertyChanged -= ViewContentViewModel_PropertyChanged;
+                viewContentViewModel.PropertyChanged += ViewContentViewModel_PropertyChanged;
             }
 
             var pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
@@ -577,6 +591,21 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        private void ViewContentViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+        {
+            if(e.PropertyName == "OCRContentVisible")
+            {
+                if(ViewContentViewModel.OCRContentVisible == Visibility.Visible)
+                {
+                    RightPanelEnable = false;
+                }
+                else
+                {
+                    RightPanelEnable = true;
+                }
+            }
+        }
+
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;

+ 5 - 3
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterImgDialogViewModel.cs

@@ -50,7 +50,7 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
 
         public List<string> ImageTypeFamily { set; get; } = new List<string>();
 
-        private int imageTypeSelectedIndex;
+        private int imageTypeSelectedIndex=0;
         /// <summary>
         /// 图像类型的下拉框索引值
         /// 如果只需要根据选中项的索引判断,则可以不用再采取command绑定命令的形式,而是可以通过一个int类型属性绑定的形式,然后在set方法里进行处理
@@ -126,6 +126,8 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
             CmbPageSelectionChanged = new DelegateCommand<object>(CmbPageSelectionChangedEvent);
             CmbPageTextChanged = new DelegateCommand<object>(CmbPageTextChangedEvent);
             BatchConverterCommand = new DelegateCommand(BatchConverter);
+            SetImageTypeOrigin();
+            SetImageDPIOrigin();
             dialogs = dialogService;
         }
 
@@ -348,10 +350,10 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 MaxPageRange = currentViewer.Document.PageCount;
                 if (currentViewer.Tag != null) { ConverterImgModel.Pawssword = currentViewer.Tag.ToString(); }
                 ConverterImgModel.InputPath = pdfViewer.Document.FilePath;
+                ImageTypeSelectedIndex = 0;
                 FileInfo fileinfo = new FileInfo(ConverterImgModel.InputPath);
                 ConverterImgModel.OutputPath = fileinfo.DirectoryName;
-                SetImageTypeOrigin();
-                SetImageDPIOrigin();
+                
             }
         }
         #endregion

+ 3 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateBaseContentViewModel.cs

@@ -107,7 +107,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             this.eventAggregator = eventAggregator;
             this.backgroundCreateRegion = regionManager;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             BackgroundCreateRegionName = Guid.NewGuid().ToString();
             ChangeCreateModCommand = new DelegateCommand<object>(ChangeCreateMod);
             EnterTemplateListCommand = new DelegateCommand(EnterTemplateList);
@@ -159,6 +158,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void EnterSelectedCreateMod(string currentCreateName)
         {
             NavigationParameters param = new NavigationParameters();
+            param.Add("Unicode", Unicode);
             param.Add(ParameterNames.PDFViewer, PDFViewer);
             backgroundCreateRegion.RequestNavigate(BackgroundCreateRegionName, currentCreateName, param);
             backgroundCreateVisible = System.Windows.Visibility.Visible;
@@ -170,6 +170,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, PDFViewer);
+            param.Add("Unicode", Unicode);
             param.Add("BackgroundItem", BackgroundItem);
             backgroundCreateRegion.RequestNavigate(BackgroundCreateRegionName, currentCreateName, param);
             backgroundCreateVisible = System.Windows.Visibility.Visible;
@@ -214,6 +215,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<EnumColorOrFile>("CurrentTemplateListModName", out CurrentTemplateListMod);
             if (CurrentTemplateListMod == EnumColorOrFile.StatusColor)

+ 1 - 2
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateColorContentViewModel.cs

@@ -222,7 +222,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageBackgroundCreateColorContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
             ChangeColorCommand = new DelegateCommand<object>(ChangeColor);
             BackgroundInfo.Color = EditToolsHelper.ConvertColor(Color.FromArgb(0xFF, 0xFF, 0x00, 0x00));
@@ -548,7 +547,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
-
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref BackgroundInfo.PageRange, PageRangeText);
             if (navigationContext.Parameters.TryGetValue<BackgroundItem>("BackgroundItem", out TemplateBackgroundItem))

+ 2 - 4
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundCreateFileContentViewModel.cs

@@ -204,13 +204,11 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public DelegateCommand OpenFileCommand { get; set; }
         public DelegateCommand<object> ChangeLocationCommand { get; set; }
 
-        public string unicode = null;
         public string Unicode = null;
 
         public HomePageBackgroundCreateFileContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             BackgroundInfo.BackgroundType = C_Background_Type.BG_TYPE_IMAGE;
             ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
             InitComponent();
@@ -515,7 +513,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                     //预览图缓存
                     string saveName = Guid.NewGuid().ToString();
                     string savePath = Path.Combine(folderPath, saveName);
-                    System.Windows.Size pageSize = PDFViewer.Document.GetPageSize(0);
+                    System.Windows.Size pageSize = new Size { Width = 128, Height = 160 };
                     CPDFDocument tempDocument = CPDFDocument.CreateDocument();
                     if (tempDocument != null)
                     {
@@ -590,7 +588,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
-            navigationContext.Parameters.TryGetValue<string>("UniCode", out unicode);
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             if (navigationContext.Parameters.TryGetValue<BackgroundItem>("BackgroundItem", out TemplateBackgroundItem))
             {
                 InitComponentBySelectedInfo();

+ 3 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundDialogViewModel.cs

@@ -246,7 +246,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             PDFDataTable.Columns.Add("MaxPageRange");
             PDFDataTable.Columns.Add("FileSize");
             PDFDataTable.Columns.Add("FileState");
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
+            Unicode = Guid.NewGuid().ToString() ;
             BackgroundSettingsVisible = Visibility.Visible;
             ADDPDFCommand = new DelegateCommand(addpicture);
             ADDPDFFilesCommand = new DelegateCommand(addpicturefiles);
@@ -280,6 +280,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, PDFViewer);
+            param.Add("Unicode", Unicode);
             param.Add("ViewModel", this);
             if (SelectedContentName == TemplateListBaseName)
             {
@@ -325,6 +326,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, PDFViewer);
             param.Add("CurrentTemplateListModName", CurrentTemplateListMod);
+            param.Add("Unicode", Unicode);
             param.Add("BackgroundItem", backgroundItem);
             backgroundRegion.RequestNavigate(BackgroundSettingsRegionName, CreateBaseName, param);
             BackgroundSettingsVisible = Visibility.Visible;

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

@@ -54,14 +54,12 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public DelegateCommand<object> ChangeTemplateListModCommand { get; set; }
         public DelegateCommand EnterCreateCommand { get; set; }
 
-        public string unicode = null;
         public string Unicode = null;
 
         public HomePageBackgroundTemplateListBaseContentViewModel(IRegionManager backgroundTemplateListRegion, IEventAggregator eventAggregator)
         {
             this.backgroundTemplateListRegion = backgroundTemplateListRegion;
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             BackgroundTemplateListRegionName = Guid.NewGuid().ToString();
             ChangeTemplateListModCommand = new DelegateCommand<object>(ChangeTemplateListMod);
             EnterCreateCommand = new DelegateCommand(EnterCreate);
@@ -75,6 +73,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void EnterSelectedTemplateListMod(string currentTemplateListName)
         {
             NavigationParameters param = new NavigationParameters();
+            param.Add("Unicode", Unicode);
             param.Add("ViewModel", homePageBackgroundDialogViewModel);
             backgroundTemplateListRegion.RequestNavigate(BackgroundTemplateListRegionName, currentTemplateListName,param);
             backgroundTemplateListVisible = System.Windows.Visibility.Visible;
@@ -107,6 +106,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<HomePageBackgroundDialogViewModel>("ViewModel", out homePageBackgroundDialogViewModel);
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             if (IsFirstEnter)
             {
                 CurrentTemplateListModName = BackgroundTemplateListColorContentName;

+ 1 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundTemplateListColorContentViewModel.cs

@@ -56,7 +56,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public HomePageBackgroundTemplateListColorContentViewModel(IEventAggregator eventAggregator)
         {
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             this.eventAggregator = eventAggregator;
             AddTemplateCommand = new DelegateCommand(AddTemplate);
             EditTemplateItemCommand = new DelegateCommand<object>(RequestEditTemplateItem);
@@ -243,6 +242,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             navigationContext.Parameters.TryGetValue<HomePageBackgroundDialogViewModel>("ViewModel", out homePageBackgroundDialogViewModel);
             InitBackgroundTemplateList();
         }

+ 1 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBackground/HomePageBackgroundTemplateListFileContentViewModel.cs

@@ -59,7 +59,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public HomePageBackgroundTemplateListFileContentViewModel(IEventAggregator eventAggregator)
         {
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             this.eventAggregator = eventAggregator;
             AddTemplateCommand = new DelegateCommand(AddTemplate);
             EditTemplateItemCommand = new DelegateCommand<object>(RequestEditTemplateItem);
@@ -254,6 +253,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             navigationContext.Parameters.TryGetValue<HomePageBackgroundDialogViewModel>("ViewModel", out homePageBackgroundDialogViewModel);
             InitBackgroundTemplateList();
         }

+ 4 - 2
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesCreateContentViewModel.cs

@@ -395,7 +395,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageBatesCreateContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             for (int i = 0; i <= 5; i++)
             {
                 BatesInfo.TextData[i].Color = EditToolsHelper.ConvertColor(Color.FromArgb(0xFF, 0xFF, 0x00, 0x00));
@@ -530,6 +529,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                                 TextEQ = false;
                             }
                             BatesInfo.Prefix = textValue.Text;
+                            PrefixTextValue = textValue.Text;
 
                             break;
                         case "SuffixTextValueTextBox":
@@ -538,6 +538,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                                 TextEQ = false;
                             }
                             BatesInfo.Suffix = textValue.Text;
+                            SurfixTextValue = textValue.Text;
                             break;
                         default:
                             break;
@@ -572,6 +573,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             {
                 GetTextValueFromNumber[GetLocationIndex.ToString()] = GetTextValueFromNumber[GetLocationIndex.ToString()] + "<<" + "#" + DigitNumberValue + "#" + (StarPagetNumberIndex + 1).ToString() + "#" + PrefixTextValue + "#" + SurfixTextValue + ">>";
             }
+            TextValue = GetTextValueFromNumber[GetLocationIndex.ToString()];
             BatesInfo.TextData[GetLocationIndex].text = GetTextValueFromNumber[GetLocationIndex.ToString()];
             
         }
@@ -719,7 +721,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
 
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref BatesInfo.PageRange, PageRangeText);
-
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             if (navigationContext.Parameters.TryGetValue<BatesHeaderFooterItem>("BatesItem", out TemplateBatesItem))
             {
                 CreateOrEdit = EnumCreateOrEdit.StatusEdit;

+ 3 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageBates/HomePageBatesDialogViewModel.cs

@@ -211,7 +211,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             this.batesRegion = batesRegion;
             this.dialogs = dialogs;
             BatesSettingsRegionName = Guid.NewGuid().ToString();
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
+            Unicode = Guid.NewGuid().ToString();
             PDFCurrentDataTable.Columns.Add("FilePageRangeText");
             PDFCurrentDataTable.Columns.Add("FilePageRangeSelectIndex");
             PDFCurrentDataTable.Columns.Add("IsEvenPageIsEnabled");
@@ -235,6 +235,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             BatesHeaderFooterItem batesItem = batesItemunicode.Status;
             NavigationParameters param = new NavigationParameters();
+            param.Add("Unicode", Unicode);
             param.Add(ParameterNames.PDFViewer, PDFViewer);
             param.Add("BatesItem", batesItem);
             batesRegion.RequestNavigate(BatesSettingsRegionName, CreateName, param);
@@ -263,6 +264,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void EnterSelectedContent(string SelectedContentName)
         {
             NavigationParameters param = new NavigationParameters();
+            param.Add("Unicode", Unicode);
             param.Add(ParameterNames.PDFViewer, PDFViewer);
             param.Add("ViewModel", this);
             batesRegion.RequestNavigate(BatesSettingsRegionName, SelectedContentName, param);

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

@@ -61,7 +61,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageBatesTemplateListContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             EnterCreateCommand = new DelegateCommand(EnterCreate);
             AddTemplateCommand = new DelegateCommand(AddTemplate);
             EditTemplateItemCommand = new DelegateCommand<object>(RequestEditTemplateItem);
@@ -235,6 +234,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<HomePageBatesDialogViewModel>("ViewModel", out homePageBatesDialogViewModel);
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             InitBackgroundTemplateList();
         }
     }

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

@@ -425,7 +425,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageHeaderFooterCreateContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             for (int i = 0; i <= 5; i++)
             {
                 HeaderFooterInfo.TextData[i].Color = EditToolsHelper.ConvertColor(Color.FromArgb(0xFF, 0xFF, 0x00, 0x00));
@@ -725,6 +724,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref HeaderFooterInfo.PageRange, PageRangeText);
             if (navigationContext.Parameters.TryGetValue<BatesHeaderFooterItem>("HeaderFooterItem", out TemplateHeaderFooterItem))
             {

+ 3 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageHeaderFooter/HomePageHeaderFooterDialogViewModel.cs

@@ -218,7 +218,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             this.headerFooterRegion = regionManager;
             this.dialogs = dialogs;
             HeaderFooterSettingsRegionName = Guid.NewGuid().ToString();
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
+            Unicode = Guid.NewGuid().ToString();
             PDFCurrentDataTable.Columns.Add("FilePageRangeText");
             PDFCurrentDataTable.Columns.Add("FilePageRangeSelectIndex");
             PDFCurrentDataTable.Columns.Add("IsEvenPageIsEnabled");
@@ -243,6 +243,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             BatesHeaderFooterItem headerfooterItem = headerfooterItemunicode.Status;
             NavigationParameters param = new NavigationParameters();
+            param.Add("Unicode", Unicode);
             param.Add(ParameterNames.PDFViewer, PDFViewer);
             param.Add("HeaderFooterItem", headerfooterItem);
             headerFooterRegion.RequestNavigate(HeaderFooterSettingsRegionName, CreateName, param);
@@ -271,6 +272,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void EnterSelectedContent(string SelectedContentName)
         {
             NavigationParameters param = new NavigationParameters();
+            param.Add("Unicode", Unicode);
             param.Add(ParameterNames.PDFViewer, PDFViewer);
             param.Add("ViewModel", this);
             headerFooterRegion.RequestNavigate(HeaderFooterSettingsRegionName, SelectedContentName, param);

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

@@ -60,7 +60,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageHeaderFooterTemplateListContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             EnterCreateCommand = new DelegateCommand(EnterCreate);
             AddTemplateCommand = new DelegateCommand(AddTemplate);
             EditTemplateItemCommand = new DelegateCommand<object>(RequestEditTemplateItem);
@@ -233,6 +232,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<HomePageHeaderFooterDialogViewModel>("ViewModel", out homePageHeaderFooterDialogViewModel);
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             InitBackgroundTemplateList();
         }
     }

+ 3 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkCreateBaseContentViewModel.cs

@@ -104,7 +104,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             this.eventAggregator = eventAggregator;
             this.watermarkCreateRegion = regionManager;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             WatermarkCreateRegionName = Guid.NewGuid().ToString();
             ChangeCreateModCommand = new DelegateCommand<object>(ChangeCreateMod);
             EnterTemplateListCommand = new DelegateCommand(EnterTemplateList);
@@ -164,6 +163,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, PDFViewer);
+            param.Add("Unicode", Unicode);
             watermarkCreateRegion.RequestNavigate(WatermarkCreateRegionName, currentCreateName, param);
             watermarkCreateVisible = System.Windows.Visibility.Visible;
         }
@@ -172,6 +172,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, PDFViewer);
+            param.Add("Unicode", Unicode);
             param.Add("WatermarkItem", WatermarkItem);
             watermarkCreateRegion.RequestNavigate(WatermarkCreateRegionName, currentCreateName, param);
             watermarkCreateVisible = System.Windows.Visibility.Visible;
@@ -217,6 +218,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             navigationContext.Parameters.TryGetValue<EnumTextOrFile>("CurrentTemplateListModName", out CurrentTemplateListMod);
             if (CurrentTemplateListMod == EnumTextOrFile.StatusText)
             {

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

@@ -323,7 +323,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageWatermarkCreateFileContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             WatermarkInfo.WatermarkType = C_Watermark_Type.WATERMARK_TYPE_IMG;
             ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
             OpenFileCommand = new DelegateCommand(OpenFile);
@@ -368,7 +367,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 watermarkItem.pageRange = watermarkInfo.PageRange;
 
                 List<int> PageIndexLists = new List<int>();
-                if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, watermarkInfo.PageRange, 99999, new char[] { ',' }, new char[] { '-' }))
+                if (PageRangeSelectIndex == 3 && !CommonHelper.GetPagesInRange(ref PageIndexLists, watermarkInfo.PageRange, 9999, new char[] { ',' }, new char[] { '-' }))
                 {
                     watermarkInfo.PageRangeIndex = 0;
                 }
@@ -721,6 +720,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref WatermarkInfo.PageRange, PageRangeText);
             if (navigationContext.Parameters.TryGetValue<WatermarkItem>("WatermarkItem", out TemplateWatermarkItem))
             {

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

@@ -408,7 +408,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageWatermarkCreateTextContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             WatermarkInfo.WatermarkType = C_Watermark_Type.WATERMARK_TYPE_TEXT;
             ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
             SelectedColorChangedCommand = new DelegateCommand<object>(ChangedColor);
@@ -798,6 +797,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             //EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref WatermarkInfo.PageRange, PageRangeText);
             if (navigationContext.Parameters.TryGetValue<WatermarkItem>("WatermarkItem", out TemplateWatermarkItem))
             {

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

@@ -230,7 +230,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             this.eventAggregator = eventAggregator;
             this.watermarkRegion = watermarkRegion;
             this.dialogs = dialogs;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
+            Unicode = Guid.NewGuid().ToString();
             WatermarkSettingsVisible = Visibility.Visible;
             PDFCurrentDataTable.Columns.Add("FilePageRangeText");
             PDFCurrentDataTable.Columns.Add("FilePageRangeSelectIndex");
@@ -276,6 +276,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, PDFViewer);
+            param.Add("Unicode", Unicode);
             param.Add("ViewModel", this);
             if (SelectedContentName == TemplateListName)
             {
@@ -325,6 +326,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             WatermarkItem watermarkItem = watermarkItemunicode.Status;
             NavigationParameters param = new NavigationParameters();
+            param.Add("Unicode", Unicode);
             param.Add(ParameterNames.PDFViewer, PDFViewer);
             param.Add("CurrentTemplateListModName", CurrentTemplateListMod);
             param.Add("WatermarkItem", watermarkItem);

+ 4 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageWatermark/HomePageWatermarkTemplateListBaseContentViewModel.cs

@@ -11,6 +11,8 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Windows.Controls;
+using System.Windows.Forms;
+using Button = System.Windows.Controls.Button;
 
 namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageWatermark
 {
@@ -62,7 +64,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             this.watermarkTemplateListRegion = watermarkTemplateListRegion;
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             WatermarkTemplateListRegionName = Guid.NewGuid().ToString();
             ChangeTemplateListModCommand = new DelegateCommand<object>(ChangeTemplateListMod);
             EnterCreateCommand = new DelegateCommand(EnterCreate);
@@ -109,6 +110,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         {
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, CurrentPDFViewer);
+            param.Add("Unicode", Unicode);
             param.Add("ViewModel",homePageWatermarkDialogViewModel);
             watermarkTemplateListRegion.RequestNavigate(WatermarkTemplateListRegionName, currentTemplateListName, param);
             eventAggregator.GetEvent<CurrentWatermarkPDFViewerEvent>().Publish(new CPDFViewerUnicode
@@ -146,6 +148,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<HomePageWatermarkDialogViewModel>("ViewModel", out homePageWatermarkDialogViewModel);
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             if (IsFirstEnter)
             {
                 CurrentTemplateListModName = WatermarkTemplateListTextContentName;

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

@@ -74,7 +74,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageWatermarkTemplateListFileContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             AddTemplateCommand = new DelegateCommand(AddTemplate);
             DeleteTemplateItemCommand = new DelegateCommand<object>(DeleteTemplateItem);
             EditTemplateItemCommand = new DelegateCommand<object>(RequestEditTemplateItem);
@@ -317,6 +316,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<HomePageWatermarkDialogViewModel>("ViewModel",out homePageWatermarkDialogViewModel);
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             InitWatermarkTemplateList();
         }
     }

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

@@ -66,7 +66,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public HomePageWatermarkTemplateListTextContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             AddTemplateCommand = new DelegateCommand(AddTemplate);
             DeleteTemplateItemCommand = new DelegateCommand<object>(DeleteTemplateItem);
             DeleteAllTemplateItemCommand = new DelegateCommand(DeleteAllTemplateItem);
@@ -277,6 +276,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<HomePageWatermarkDialogViewModel>("ViewModel", out homePageWatermarkDialogViewModel);
+            navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             InitWatermarkTemplateList();
         }
     }

+ 30 - 0
PDF Office/ViewModels/Dialog/InfoDialogViewModel.cs

@@ -0,0 +1,30 @@
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.Dialog
+{
+    internal class InfoDialogViewModel : BindableBase, IDialogAware
+    {
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+        }
+    }
+}

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

@@ -106,7 +106,7 @@ namespace PDF_Office.ViewModels.EditTools.Bates
         private void DeleteBates()
         {
             AlertsMessage alertsMessage = new AlertsMessage();
-            alertsMessage.ShowDialog("确定要删除背景吗?", "", "取消", "删除");
+            alertsMessage.ShowDialog("确定要删除Bates吗?", "", "取消", "删除");
             if (alertsMessage.result == ContentResult.Ok)
             {
                 this.eventAggregator.GetEvent<DeleteBatesEvent>().Publish(new EnumDeleteUnicode

+ 3 - 0
PDF Office/ViewModels/EditTools/Bates/BatesCreateContentViewModel.cs

@@ -567,6 +567,7 @@ namespace PDF_Office.ViewModels.EditTools.Bates
                                 TextEQ = false;
                             }
                             BatesInfo.Prefix = textValue.Text;
+                            PrefixTextValue= textValue.Text;
 
                             break;
                         case "SuffixTextValueTextBox":
@@ -575,6 +576,7 @@ namespace PDF_Office.ViewModels.EditTools.Bates
                                 TextEQ = false;
                             }
                             BatesInfo.Suffix = textValue.Text;
+                            SurfixTextValue = textValue.Text;
                             break;
                         default:
                             break;
@@ -614,6 +616,7 @@ namespace PDF_Office.ViewModels.EditTools.Bates
                 GetTextValueFromNumber[GetLocationIndex.ToString()] = GetTextValueFromNumber[GetLocationIndex.ToString()] + "<<" + "#" + DigitNumberValue + "#" + (StarPagetNumberIndex + 1).ToString() + "#" + PrefixTextValue + "#" + SurfixTextValue + ">>";
             }
             BatesInfo.TextData[GetLocationIndex].text = GetTextValueFromNumber[GetLocationIndex.ToString()];
+            TextValue= GetTextValueFromNumber[GetLocationIndex.ToString()];
             eventAggregator.GetEvent<SetBatesEvent>().Publish(new BatesInfoUnicode
             {
                 Unicode = Unicode,

+ 1 - 0
PDF Office/ViewModels/EditTools/Bates/BatesDocumentContentViewModel.cs

@@ -150,6 +150,7 @@ namespace PDF_Office.ViewModels.EditTools.Bates
         {
             EnumDelete = EnumDelete.StatusCreate;
             BatesInfo batesInfo = batesInfoUnicode.Status;
+            EditToolsHelper.GetPageRange(batesInfo.PageRangeIndex, PDFViewer.Document, ref batesInfo.PageRange, batesInfo.PageRange);
             this.batesInfo = batesInfo;
             PDFViewer.InvalidChildVisual(false);
         }

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

@@ -105,7 +105,7 @@ namespace PDF_Office.ViewModels.EditTools.HeaderFooter
         private void DeleteHeaderFooter()
         {
             AlertsMessage alertsMessage = new AlertsMessage();
-            alertsMessage.ShowDialog("确定要删除背景吗?", "", "取消", "删除");
+            alertsMessage.ShowDialog("确定要删除页眉页脚吗?", "", "取消", "删除");
             if (alertsMessage.result == ContentResult.Ok)
             {
                 this.eventAggregator.GetEvent<DeleteHeaderFooterEvent>().Publish(new EnumDeleteUnicode

+ 2 - 0
PDF Office/ViewModels/EditTools/HeaderFooter/HeaderFooterDocumentContentViewModel.cs

@@ -24,6 +24,7 @@ using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrayNotify;
 using ComPDFKit.PDFWatermark;
 using PDF_Office.Model.EditTools.Watermark;
 using Microsoft.Office.Core;
+using PDF_Office.Model.EditTools.Bates;
 
 namespace PDF_Office.ViewModels.EditTools.HeaderFooter
 {
@@ -155,6 +156,7 @@ namespace PDF_Office.ViewModels.EditTools.HeaderFooter
         {
             EnumDelete = EnumDelete.StatusCreate;
             HeaderFooterInfo headerFooterInfo = headerFooterInfoUnicode.Status;
+            EditToolsHelper.GetPageRange(headerFooterInfo.PageRangeIndex, PDFViewer.Document, ref headerFooterInfo.PageRange, headerFooterInfo.PageRange);
             this.headerFooterInfo = headerFooterInfo;
             //CreateHeaderFooter(PDFViewer.Document);
             PDFViewer.InvalidChildVisual(false);

+ 5 - 1
PDF Office/ViewModels/EditTools/Watermark/WatermarkDocumentContentViewModel.cs

@@ -29,6 +29,7 @@ using PDF_Office.ViewModels.Tools;
 using static System.Windows.Forms.VisualStyles.VisualStyleElement;
 using System.Text.RegularExpressions;
 using TextBox = System.Windows.Controls.TextBox;
+using PDFSettings;
 
 namespace PDF_Office.ViewModels.EditTools.Watermark
 {
@@ -165,6 +166,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
         public void SetWatermark(WatermarkInfoUnicode watermarkInfounicode)
         {
             WatermarkInfo watermarkInfo = watermarkInfounicode.Status;
+            EditToolsHelper.GetPageRange(watermarkInfo.PageRangeIndex, PDFViewer.Document, ref watermarkInfo.PageRange, watermarkInfo.PageRange);
             this.watermarkInfo = watermarkInfo;
             EnumDelete = EnumDelete.StatusCreate;
             PDFViewer.InvalidChildVisual(false);
@@ -205,7 +207,9 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
                 watermark.SetHorizontalSpacing(watermarkInfo.HorizontalSpacing);
                 watermark.SetVerticalSpacing(watermarkInfo.VerticalSpacing);
                 if (IsNewDoc) { watermark.SetPages("0"); }
-                else { watermark.SetPages(watermarkInfo.PageRange); }
+                else {
+                    
+                    watermark.SetPages(watermarkInfo.PageRange); }
                 Trace.WriteLine("IsCreateWatermark: " + watermark.CreateWatermark());
                 Trace.WriteLine("IsUpdateWatermark: " + watermark.UpdateWatermark());
             }

+ 6 - 5
PDF Office/ViewModels/EditTools/Watermark/WatermarkTemplateListBaseContentViewModel.cs

@@ -90,11 +90,12 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
                 }
                 else
                 {
-                    this.eventAggregator.GetEvent<DeleteWatermarkEvent>().Publish(new EnumDeleteUnicode
-                    {
-                        Unicode = Unicode,
-                        Status = EnumDelete.StatusCreate
-                    });
+                    //this.eventAggregator.GetEvent<DeleteWatermarkEvent>().Publish(new EnumDeleteUnicode
+                    //{
+                    //    Unicode = Unicode,
+                    //    Status = EnumDelete.StatusCreate
+                    //});
+                    return;
                 }
             }
             this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(new EnumTemplateListOrCreateUnicode

+ 6 - 5
PDF Office/ViewModels/EditTools/Watermark/WatermarkTemplateListFileContentViewModel.cs

@@ -227,11 +227,12 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
                 }
                 else
                 {
-                    this.eventAggregator.GetEvent<DeleteWatermarkEvent>().Publish(new EnumDeleteUnicode
-                    {
-                        Unicode = Unicode,
-                        Status = EnumDelete.StatusCreate
-                    });
+                    //this.eventAggregator.GetEvent<DeleteWatermarkEvent>().Publish(new EnumDeleteUnicode
+                    //{
+                    //    Unicode = Unicode,
+                    //    Status = EnumDelete.StatusCreate
+                    //});
+                    return;
                 }
             }
             var listBox = e as ListBox;

+ 6 - 5
PDF Office/ViewModels/EditTools/Watermark/WatermarkTemplateListTextContentViewModel.cs

@@ -200,11 +200,12 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
                 }
                 else
                 {
-                    this.eventAggregator.GetEvent<DeleteWatermarkEvent>().Publish(new EnumDeleteUnicode
-                    {
-                        Unicode = Unicode,
-                        Status = EnumDelete.StatusCreate
-                    });
+                    //this.eventAggregator.GetEvent<DeleteWatermarkEvent>().Publish(new EnumDeleteUnicode
+                    //{
+                    //    Unicode = Unicode,
+                    //    Status = EnumDelete.StatusCreate
+                    //});
+                    return;
                 }
             }
             var listBox = e as ListBox;

+ 2 - 2
PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs

@@ -1748,9 +1748,9 @@ namespace PDF_Office.ViewModels.PageEdit
             item.PageNumber = index + 1;
             var pagesize = PDFViewer.Document.GetPageSize(index);
             item.Size = pagesize;
-            double width = CommonHelper.GetUnitsFromPageSize(pagesize.Width);
+            double width =  CommonHelper.GetUnitsFromPageSize(pagesize.Width);
             double height = CommonHelper.GetUnitsFromPageSize(pagesize.Height);
-            item.PageSize = $"{width.ToString("F2")}mm*{height.ToString("F2")} mm";
+            item.PageSize = $"{width.ToString("F0")}mm*{height.ToString("F0")} mm";
             return item;
         }
 

+ 56 - 2
PDF Office/ViewModels/Scan/ScanViwerViewModel.cs

@@ -6,6 +6,7 @@ using ComPDFKitViewer.PdfViewer;
 using PDF_Office.EventAggregators;
 using PDF_Office.Helper;
 using PDF_Office.Model;
+using Prism.Commands;
 using Prism.Events;
 using Prism.Mvvm;
 using Prism.Regions;
@@ -47,8 +48,11 @@ namespace PDF_Office.ViewModels.Scan
                 SetProperty(ref textRectList, value);
             }
         }
-        private bool isEnhanced;
 
+        private bool isEnhanced;
+        /// <summary>
+        /// 当前是否为增强扫描状态
+        /// </summary>
         public bool IsEnhanced
         {
             get { return isEnhanced; }
@@ -63,11 +67,25 @@ namespace PDF_Office.ViewModels.Scan
         /// 增强扫描结果路径
         /// </summary>
         public List<string> EnhancedFilePathList;
+
         /// <summary>
         /// OCR结果路径
         /// </summary>
         private Dictionary<int, List<KeyValuePair<Rect, string>>> cacahe;
 
+        private Visibility showTooltip = Visibility.Collapsed;
+
+        public Visibility ShowTooltip
+        {
+            get { return showTooltip; }
+            set
+            {
+                SetProperty(ref showTooltip, value);
+            }
+        }
+
+        public DelegateCommand CloseTooltipCommand { get; set; }
+        public DelegateCommand CancelEnhancedCommand { get; set; }
 
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
@@ -143,10 +161,43 @@ namespace PDF_Office.ViewModels.Scan
 
         public ScanViwerViewModel(IEventAggregator eventAggregator)
         {
+            CloseTooltipCommand = new DelegateCommand(CloseTooltip);
+            CancelEnhancedCommand = new DelegateCommand(CancelEnhanced);
             EnhancedFilePathList = new List<string>();
             eventAggregator.GetEvent<ScanEvent>().Subscribe(ChangeScanMode, e => e.Unicode == App.mainWindowViewModel.SelectedItem.Unicode);
             cacahe = new Dictionary<int, List<KeyValuePair<Rect, string>>>();
         }
+
+        private void CancelEnhanced()
+        {
+            ShowTooltip = Visibility.Collapsed;
+            IsEnhanced = false;
+            CPDFPage pdfPage = PDFViewer.Document.PageAtIndex(PDFViewer.CurrentIndex);
+            float zoom = (float)(DpiHelpers.Dpi / 72D);
+            int renderWidth = (int)(pdfPage.PageSize.Width * zoom);
+            int renderHeight = (int)(pdfPage.PageSize.Height * zoom);
+            byte[] Data = new byte[renderWidth * renderHeight * 4];
+            pdfPage.RenderPageBitmapWithMatrix(zoom, new Rect(0, 0, renderWidth, renderHeight), 0xFFFFFFFF, Data, 0);
+            BgImage = new WriteableBitmap(renderWidth, renderHeight, DpiHelpers.Dpi, DpiHelpers.Dpi, PixelFormats.Bgra32, null);
+            BgImage.WritePixels(new Int32Rect(0, 0, renderWidth, renderHeight), Data, BgImage.BackBufferStride, 0);
+
+            if (cacahe.Count > 0)
+            {
+                if (cacahe.ContainsKey(PDFViewer.CurrentIndex))
+                {
+                    TextRectList = cacahe[PDFViewer.CurrentIndex];
+                }
+                else
+                {
+                    TextRectList = null;
+                }
+            }
+        }
+        private void CloseTooltip()
+        {
+            ShowTooltip = Visibility.Collapsed;
+        }
+
         /// <summary>
         /// 根据Vm事件通知处理OCR与区域识别或者增强扫描事件
         /// </summary>
@@ -178,6 +229,9 @@ namespace PDF_Office.ViewModels.Scan
             }
         }
 
+        /// <summary>
+        /// 增强扫描
+        /// </summary>
         private void EnhancedProcess(ScanEventArgs args)
         {
             CPDFDocument CurrentDoc = PDFViewer.Document;
@@ -232,6 +286,7 @@ namespace PDF_Office.ViewModels.Scan
                     BgImage = new WriteableBitmap(image);
                 });
                 imEngine.Release();
+                ShowTooltip = Visibility.Visible;
             });
         }
 
@@ -244,7 +299,6 @@ namespace PDF_Office.ViewModels.Scan
             Task.Run(() =>
             {
                 COCREngine imEngine = new COCREngine(App.modelFolderPath);
-                //CIMEngine imEngine = new CIMEngine(App.modelFolderPath);
 
                 string path = App.CachePath.MergeFilePath;
                 string name = Guid.NewGuid().ToString();

+ 43 - 8
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -441,6 +441,10 @@ namespace PDF_Office.ViewModels
 
         public DelegateCommand PrintCommand { get; set; }
 
+        public DelegateCommand SettingsCommand { get; set; }
+
+        public DelegateCommand ShareCommand { get; set; }
+
         #endregion 命令
 
         public ViewContentViewModel(IRegionManager regionManager, IDialogService dialogService, IEventAggregator eventAggregator)
@@ -452,10 +456,11 @@ namespace PDF_Office.ViewModels
             unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             LoadFile = new DelegateCommand(loadFile);
             Load = new DelegateCommand(LoadControl);
-            SaveFile = new DelegateCommand(() => { saveFile(); });
+            SaveFile = new DelegateCommand(() => { saveFile(); }, CanSaveExcute).ObservesProperty(() => CanSave);
             SaveAsFile = new DelegateCommand(() => { saveAsFile(); });
             UndoCommand = new DelegateCommand(Undo);
             RedoCommand = new DelegateCommand(Redo);
+            ShareCommand = new DelegateCommand(share);
             TabControlSelectionChangedCommand = new DelegateCommand<object>(TabControlSelectonChangedEvent);
 
             ViwerRegionName = RegionNames.ViwerRegionName;
@@ -468,6 +473,7 @@ namespace PDF_Office.ViewModels
 
             PrintCommand = new DelegateCommand(ShowPrintDialog);
 
+            SettingsCommand = new DelegateCommand(SettingsEvent);
             //未显示时无法注册上Region名称
             ToolContentVisible = Visibility.Visible;
             ToolsBarContentVisible = Visibility.Visible;
@@ -493,6 +499,35 @@ namespace PDF_Office.ViewModels
             EnterSelectedBar("TabItemAnnotation");
         }
 
+        private void share()
+        {
+            try
+            {
+                var path = PDFViewer.Document.FilePath;
+                string subject = "分享至" + " " + PDFViewer.Document.FileName;
+                System.Diagnostics.Process.Start("outlook", "/a,\"" + path + "\"" + "/m \"" + "&subject=" + subject + "\"");
+            }
+            catch
+            {
+                AlertsMessage alertsMessage = new AlertsMessage();
+                alertsMessage.ShowDialog("","未检测到Ooutlook软件,请先安装Outlook","OK");
+            }
+        }
+        private void SettingsEvent()
+        {
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.PDFViewer, PDFViewer);
+            value.Add(ParameterNames.ViewContentViewModel, this);
+            dialogs.ShowDialog(DialogNames.InfoDialog, value, e =>
+            {
+            });
+        }
+
+        private bool CanSaveExcute()
+        {
+            return CanSave;
+        }
+
         private void MenuEnterReadModeEvent(object obj)
         {
         }
@@ -1004,7 +1039,7 @@ namespace PDF_Office.ViewModels
         /// <summary>
         /// 另存为或新文档保存逻辑
         /// </summary>
-        public bool saveAsFile(bool isApplyRedaction = false,bool isEraseRedaction = false)
+        public bool saveAsFile(bool isApplyRedaction = false, bool isEraseRedaction = false)
         {
             var dlg = new SaveFileDialog();
             dlg.Filter = Properties.Resources.OpenDialogFilter;
@@ -1024,7 +1059,7 @@ namespace PDF_Office.ViewModels
                     }
                     catch { }
                 }
-                else if(isEraseRedaction)
+                else if (isEraseRedaction)
                 {
                     EraseReadction();
                 }
@@ -1055,17 +1090,17 @@ namespace PDF_Office.ViewModels
 
         private void EraseReadction()
         {
-            for(int i=0;i<PDFViewer.Document.PageCount;i++)
+            for (int i = 0; i < PDFViewer.Document.PageCount; i++)
             {
                 //获取页面Page对象
                 var page = PDFViewer.Document.PageAtIndex(i);
-                var annots = PDFViewer.GetAnnotCommentList(i,PDFViewer.Document);
+                var annots = PDFViewer.GetAnnotCommentList(i, PDFViewer.Document);
                 //循环擦除当前页的标记密文
                 for (int j = 0; j < annots.Count; j++)
-                { 
-                    if(annots[j].EventType == AnnotArgsType.AnnotRedaction)
+                {
+                    if (annots[j].EventType == AnnotArgsType.AnnotRedaction)
                     {
-                        foreach(var rect in (annots[j] as RedactionAnnotArgs).QuardRects)
+                        foreach (var rect in (annots[j] as RedactionAnnotArgs).QuardRects)
                         {
                             page.ErasureRedaction(rect);
                         }

+ 31 - 5
PDF Office/Views/BottomToolContent.xaml

@@ -2,6 +2,7 @@
     x:Class="PDF_Office.Views.BottomToolContent"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
     xmlns:local="clr-namespace:PDF_Office.Views"
@@ -60,12 +61,13 @@
                     </Polygon.RenderTransform>
                 </Polygon>
             </Button>
-            <TextBox
-                Width="48"
+            <cus:TextBoxEx
+                Width="57"
                 Height="24"
                 Padding="10,0,0,0"
                 VerticalAlignment="Center"
                 VerticalContentAlignment="Center"
+                CornerRadius="4"
                 FontSize="12"
                 InputMethod.IsInputMethodEnabled="False"
                 Text="{Binding CurrentPage}">
@@ -77,11 +79,15 @@
                         <i:InvokeCommandAction Command="{Binding PageTextPreviewKeyDownCommand}" PassEventArgsToCommand="True" />
                     </i:EventTrigger>
                 </i:Interaction.Triggers>
-            </TextBox>
+            </cus:TextBoxEx>
             <TextBlock
-                MinWidth="50"
+                Margin="8,0"
                 VerticalAlignment="Center"
-                Text="{Binding PageCount, StringFormat=/{0}}" />
+                Text="/" />
+            <TextBlock
+                MinWidth="13"
+                VerticalAlignment="Center"
+                Text="{Binding PageCount, StringFormat={}{0}}" />
             <Button
                 Width="24"
                 Height="24"
@@ -111,11 +117,31 @@
                     </Path.RenderTransform>
                 </Path>
             </Button>
+
+            <Separator Margin="4,0,0,0" Style="{StaticResource VerticalSeparatorStyle}" />
+            <Button
+                Width="24"
+                Height="24"
+                Margin="8,0">
+                <Path
+                    Width="16"
+                    Height="16"
+                    Data="M2.56067 7.28028L5.7803 4.06066L4.71964 3L0.21967 7.49997C-0.0732233 7.79286 -0.0732233 8.26774 0.21967 8.56063L4.71964 13.0606L5.7803 11.9999L2.56065 8.78028L15.75 8.78029V7.28029L2.56067 7.28028Z"
+                    Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
+            </Button>
+            <Button Width="24" Height="24">
+                <Path
+                    Width="16"
+                    Height="16"
+                    Data="M13.1893 8.78026L9.9697 11.9999L11.0304 13.0605L15.5303 8.56058C15.8232 8.26768 15.8232 7.79281 15.5303 7.49992L11.0304 2.99995L9.9697 4.06061L13.1894 7.28026L0 7.28026V8.78026L13.1893 8.78026Z"
+                    Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
+            </Button>
         </StackPanel>
         <StackPanel
             x:Name="StkPnlRight"
             Grid.Column="2"
             HorizontalAlignment="Right"
+            IsEnabled="{Binding RightPanelEnable}"
             Orientation="Horizontal">
             <ToggleButton
                 Width="24"

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

@@ -99,7 +99,7 @@
             <Grid Grid.Row="2" Margin="0,16,0,0" VerticalAlignment="Bottom">
                 <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>

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

@@ -13,8 +13,8 @@ namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.H
         private HomePageBatesCreateContentViewModel viewModel;
         public HomePageBatesCreateContent()
         {
-            viewModel = this.DataContext as HomePageBatesCreateContentViewModel;
             InitializeComponent();
+            viewModel = this.DataContext as HomePageBatesCreateContentViewModel;
             cusColor.SelectedColorHandler += cusColor_SelectedColor;
         }
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 234 - 0
PDF Office/Views/Dialog/InfoDialog.xaml


+ 28 - 0
PDF Office/Views/Dialog/InfoDialog.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Dialog
+{
+    /// <summary>
+    /// InfoDialog.xaml 的交互逻辑
+    /// </summary>
+    public partial class InfoDialog : UserControl
+    {
+        public InfoDialog()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 2 - 1
PDF Office/Views/EditTools/Bates/BatesCreateContent.xaml.cs

@@ -13,8 +13,9 @@ namespace PDF_Office.Views.EditTools.Bates
         private BatesCreateContentViewModel viewModel;
         public BatesCreateContent()
         {
-            viewModel=this.DataContext as BatesCreateContentViewModel;
+
             InitializeComponent();
+            viewModel = this.DataContext as BatesCreateContentViewModel;
             cusColor.SelectedColorHandler += cusColor_SelectedColor;
         }
 

+ 1 - 1
PDF Office/Views/EditTools/Bates/BatesTemplateListContent.xaml

@@ -68,7 +68,7 @@
                                 <Grid  Width="238" HorizontalAlignment="Left">
                                     <StackPanel >
                                         <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
-                                            <TextBlock Text="页眉页脚名称" Height="22" Width="98" FontSize="14" FontWeight="Black"></TextBlock>
+                                            <TextBlock Text="Bates名称" Height="22" Width="98" FontSize="14" FontWeight="Black"></TextBlock>
                                             <TextBlock Name="TemplateIndexTextBox"  FontSize="14" Width="120"></TextBlock>
                                         </StackPanel>
                                         <StackPanel Orientation="Horizontal" Margin="0,8,0,0" Visibility="{Binding ElementName=LeftHeaderTextBox,Path=Visibility}">

+ 9 - 0
PDF Office/Views/MainWindow.xaml

@@ -109,6 +109,15 @@
                                         </Button>
                                     </Grid>
                                 </Border>
+                                <Grid.ContextMenu>
+                                    <ContextMenu>
+                                        <MenuItem Header="Rename" />
+                                        <MenuItem Header="Show In Folder" />
+                                        <MenuItem Header="Close Tab" />
+                                        <MenuItem Header="Close All Tab" />
+                                        <MenuItem Header="Open In New Window" />
+                                    </ContextMenu>
+                                </Grid.ContextMenu>
                             </Grid>
                             <ControlTemplate.Triggers>
                                 <Trigger Property="IsSelected" Value="True">

+ 32 - 0
PDF Office/Views/Scan/Redress.xaml

@@ -0,0 +1,32 @@
+<UserControl x:Class="PDF_Office.Views.Scan.Redress"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PDF_Office.Views.Scan"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Border Background="{StaticResource color.sys.layout.anti}" Width="320" Height="144" CornerRadius="8" >
+        <Grid>
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="16"/>
+                <ColumnDefinition Width="*"/>
+                <ColumnDefinition Width="16"/>
+            </Grid.ColumnDefinitions>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="16"/>
+                <RowDefinition Height="*"/>
+                <RowDefinition Height="16"/>
+                <RowDefinition Height="auto"/>
+                <RowDefinition Height="16"/>
+            </Grid.RowDefinitions>
+            <TextBox x:Name="TextInput" 
+                     Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Redress}, Path=TextBoxContext}"
+                     Grid.Row="1" Grid.Column="1" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"/>
+            <StackPanel Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal">
+                <Button x:Name="BtnApply" Content="Apply" Style="{StaticResource Btn.cta}" Width="80" Height="32" Click="BtnApply_Click" />
+                <Button x:Name="BtnCancel" Content="Cancel" Style="{StaticResource btn.sec}" Width="80" Height="32" Margin="16,0,0,0" Click="BtnCancel_Click"/>
+            </StackPanel>
+        </Grid>
+    </Border>
+</UserControl>

+ 58 - 0
PDF Office/Views/Scan/Redress.xaml.cs

@@ -0,0 +1,58 @@
+using PDF_Office.CustomControl.ScanViewControl;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Scan
+{
+    /// <summary>
+    /// Redress.xaml 的交互逻辑
+    /// </summary>
+    public partial class Redress : UserControl
+    {
+        public Redress()
+        {
+            InitializeComponent();
+        }
+        public string TextBoxContext
+        {
+            get { return (string)GetValue(TextBoxContextProperty); }
+            set
+            {
+                SetValue(TextBoxContextProperty, value);
+            }
+        }
+        public CustomDraw HitChild { get; set; }
+
+        // Using a DependencyProperty as the backing store for TextBoxContext.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty TextBoxContextProperty =
+            DependencyProperty.Register("TextBoxContext", typeof(string), typeof(Redress), new PropertyMetadata(""));
+
+        private void BtnCancel_Click(object sender, RoutedEventArgs e)
+        {
+            Visibility = Visibility.Collapsed;
+        }
+        public void SelectAll()
+        {
+           TextInput.SelectAll();
+           TextInput.Focus();
+        }
+
+        public event EventHandler ApplyCommandHandler;
+        private void BtnApply_Click(object sender, RoutedEventArgs e)
+        {
+            ApplyCommandHandler.Invoke(sender, e);
+        }
+    }
+}

+ 19 - 1
PDF Office/Views/Scan/ScanViwer.xaml

@@ -10,8 +10,26 @@
     <Grid PreviewMouseWheel="Grid_MouseWheel" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" Background="LightGray">
         <ScrollViewer HorizontalScrollBarVisibility="Auto" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
             <Grid x:Name="ImageGrid" HorizontalAlignment="Center"  VerticalAlignment="Center" Width="500" Height="500">
-                <scanviewcontrol:CustomPanel BGImage="{Binding BgImage}" OCRTextRectList="{Binding TextRectList}"/>
+                <scanviewcontrol:CustomPanel x:Name="BitmapPanel" BGImage="{Binding BgImage}" OCRTextRectList="{Binding TextRectList}" MouseDown="CustomPanel_MouseDown"/>
+                <Canvas>
+                    <local:Redress x:Name="RedressControl" Visibility="Collapsed" IsVisibleChanged="RedressControl_IsVisibleChanged"  ApplyCommandHandler="RedressControl_ApplyCommandHandler"/>
+                </Canvas>
             </Grid>
         </ScrollViewer>
+        <Grid Width="318" Height="128" Background="{StaticResource color.sys.layout.state.note}" VerticalAlignment="Top" HorizontalAlignment="Right" Visibility="{Binding ShowTooltip}"> 
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="8"/>
+                <ColumnDefinition Width="*"/>
+                <ColumnDefinition Width="8"/>
+            </Grid.ColumnDefinitions>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="8"/>
+                <RowDefinition Height="*"/>
+                <RowDefinition Height="8"/>
+            </Grid.RowDefinitions>
+            <TextBlock Grid.Row="1" Grid.Column="1" Text="增强扫描已完成"/>
+            <Button Grid.Row="1" Grid.Column="1" Content="取消增强效果" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="50" Height="50" Command="{Binding CancelEnhancedCommand}"/>
+            <Button Grid.Row="1" Grid.Column="1" Content="取消" HorizontalAlignment="Right" VerticalAlignment="Top" Width="20" Height="20" Command="{Binding CloseTooltipCommand}"/>
+        </Grid>
     </Grid>
 </UserControl>

+ 45 - 1
PDF Office/Views/Scan/ScanViwer.xaml.cs

@@ -1,4 +1,5 @@
-using System;
+using PDF_Office.CustomControl.ScanViewControl;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -47,7 +48,50 @@ namespace PDF_Office.Views.Scan
 
                 }
             }
+            RedressControl.Visibility = Visibility.Collapsed;
+        }
 
+        private Point MouseDownPos;
+        private async void CustomPanel_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            RedressControl.Visibility = Visibility.Visible;
+            MouseDownPos = e.GetPosition(BitmapPanel);
+            HitTestResult hitResult = VisualTreeHelper.HitTest(BitmapPanel, MouseDownPos);
+            if (hitResult != null && hitResult.VisualHit is CustomDraw)
+            {
+                CustomDraw hitChild = (CustomDraw)hitResult.VisualHit;
+                BitmapPanel.DisplayContent(hitChild);
+                RedressControl.SetValue(Canvas.LeftProperty, hitChild.PaintRect.Left + (hitChild.PaintRect.Width / 2 - RedressControl.ActualWidth / 2));
+                if (hitChild.PaintRect.Top - RedressControl.ActualHeight > 0)
+                {
+                    RedressControl.SetValue(Canvas.TopProperty, hitChild.PaintRect.Top - RedressControl.ActualHeight);
+                }
+                else
+                {
+                    RedressControl.SetValue(Canvas.TopProperty, hitChild.PaintRect.Bottom);
+                }
+                RedressControl.HitChild = hitChild;
+                RedressControl.TextBoxContext = hitChild.PaintText;
+                await Task.Delay(5);
+                RedressControl.SelectAll();
+                return;
+            }
+            RedressControl.Visibility = Visibility.Collapsed;
+        }
+
+        private void RedressControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
+        {
+            if (!(bool)e.NewValue)
+            {
+                BitmapPanel.DisplayContent(null);
+            }
+        }
+
+        private void RedressControl_ApplyCommandHandler(object sender, EventArgs e)
+        {
+            RedressControl.HitChild.PaintText = RedressControl.TextBoxContext;
+            RedressControl.HitChild.Draw(); 
+            RedressControl.Visibility = Visibility.Collapsed;
         }
     }
 }

+ 43 - 19
PDF Office/Views/ViewContent.xaml

@@ -52,29 +52,52 @@
                 Orientation="Horizontal"
                 Visibility="{Binding IsReadMode}">
                 <Button
+                    Name="BtnFile"
+                    Click="BtnFile_Click"
                     Content="Files"
+                    Initialized="BtnFile_Initialized"
                     Style="{StaticResource subToolBar}"
                     ToolTip="File">
                     <Button.ContextMenu>
-                        <ContextMenu>
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
-                            <MenuItem />
+                        <ContextMenu Name="FileMenu">
+                            <MenuItem Header="Open Files" InputGestureText="Ctrl+O" />
+                            <MenuItem Header="Open Recent">
+                                <MenuItem />
+                            </MenuItem>
+                            <Separator Margin="8,0" Style="{StaticResource HorizontalSeparatorStyle}" />
+                            <MenuItem Header="Create Files" />
+                            <MenuItem Header="New Tab" InputGestureText="Ctrl+T" />
+                            <MenuItem Header="Merge PDF Files" />
+                            <Separator Margin="8,0" Style="{StaticResource HorizontalSeparatorStyle}" />
+                            <MenuItem
+                                Command="{Binding SaveFile}"
+                                Header="Save"
+                                InputGestureText="Ctrl+S" />
+                            <MenuItem
+                                Command="{Binding SaveAsFile}"
+                                Header="Save As"
+                                InputGestureText="Ctrl+Shift+S" />
+                            <MenuItem Header="Save as Flattened PDF" />
+                            <MenuItem Header="Compress" />
+                            <MenuItem Header="Convert To" />
+                            <Separator Margin="8,0" Style="{StaticResource HorizontalSeparatorStyle}" />
+                            <MenuItem Header="Close Window" InputGestureText="Ctrl+Shift+W" />
+                            <MenuItem Header="Close Tab" InputGestureText="Ctrl+W" />
+                            <Separator Margin="8,0" Style="{StaticResource HorizontalSeparatorStyle}" />
+                            <MenuItem Header="Set Passwords" />
+                            <MenuItem Header="Remove Security" />
+                            <Separator Margin="8,0" Style="{StaticResource HorizontalSeparatorStyle}" />
+                            <MenuItem Header="Show in Folder" />
+                            <MenuItem Header="Properties" />
+                            <Separator Margin="8,0" Style="{StaticResource HorizontalSeparatorStyle}" />
+                            <MenuItem Header="Share" />
+                            <MenuItem Header="Print" />
+                            <Separator Margin="8,0" Style="{StaticResource HorizontalSeparatorStyle}" />
+                            <MenuItem
+                                Command="{Binding SettingsCommand}"
+                                Header="Settings"
+                                InputGestureText="Ctrl+P" />
+                            <MenuItem Header="Help" />
                         </ContextMenu>
                     </Button.ContextMenu>
                 </Button>
@@ -137,6 +160,7 @@
                 </Button>
                 <Button
                     Margin="2,0"
+                    Command="{Binding ShareCommand}"
                     Style="{StaticResource subToolBar}"
                     ToolTip="Share">
                     <Path

+ 12 - 0
PDF Office/Views/ViewContent.xaml.cs

@@ -121,5 +121,17 @@ namespace PDF_Office.Views
                 }
             }
         }
+
+        private void BtnFile_Initialized(object sender, EventArgs e)
+        {
+            BtnFile.ContextMenu = null;
+        }
+
+        private void BtnFile_Click(object sender, RoutedEventArgs e)
+        {
+            FileMenu.PlacementTarget = BtnFile;
+            FileMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
+            FileMenu.IsOpen = true;
+        }
     }
 }

BIN
PDF Office/x64/ComPDFKit.dll