Browse Source

Merge branch 'beta' into Master

ZhouJieSheng 1 year ago
parent
commit
9e225bf8b2
100 changed files with 4167 additions and 2172 deletions
  1. 71 46
      PDF Office/App.xaml.cs
  2. BIN
      PDF Office/ComDocumentAIKit.dll
  3. BIN
      PDF Office/ComPDFKit.Desk.dll
  4. BIN
      PDF Office/ComPDFKit.Viewer.dll
  5. BIN
      PDF Office/ComPDFKit_Conversion.dll
  6. 10 1
      PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml
  7. 43 13
      PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml.cs
  8. 28 17
      PDF Office/CustomControl/NumericUpDown.xaml
  9. 6 5
      PDF Office/EventAggregators/RefreshAnnotationEvent.cs
  10. 84 0
      PDF Office/Helper/CommonHelper.cs
  11. 47 2
      PDF Office/Helper/ConverterHelper.cs
  12. 166 0
      PDF Office/Helper/EditHelper.cs
  13. 21 7
      PDF Office/Helper/FileComparisonHelper.cs
  14. 83 0
      PDF Office/Helper/PDFEditHelper.cs
  15. 212 303
      PDF Office/Helper/ServiceHelper.cs
  16. 28 2
      PDF Office/Helper/SettingHelper.cs
  17. 39 520
      PDF Office/Model/AnnotPanel/FontBoard.cs
  18. 499 0
      PDF Office/Model/AnnotPanel/FontBoardVm.cs
  19. 14 8
      PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs
  20. 307 108
      PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs
  21. 24 0
      PDF Office/MultilingualResources/PDF Office.en.xlf
  22. 24 0
      PDF Office/MultilingualResources/PDF Office.zh-Hans.xlf
  23. 24 0
      PDF Office/MultilingualResources/PDF Office.zh-Hant.xlf
  24. 13 1
      PDF Office/PDF Master.csproj
  25. 1 1
      PDF Office/PDF Master.csproj.user
  26. 2 2
      PDF Office/Properties/AssemblyInfo.cs
  27. 37 4
      PDF Office/Properties/Settings.Designer.cs
  28. 9 0
      PDF Office/Properties/Settings.settings
  29. BIN
      PDF Office/Resources/GuidItems/GuidItem1.png
  30. BIN
      PDF Office/Resources/GuidItems/GuidItem2.png
  31. BIN
      PDF Office/Resources/GuidItems/GuidItem3.png
  32. BIN
      PDF Office/Resources/GuidItems/GuidItem4.png
  33. BIN
      PDF Office/Resources/GuidItems/GuidItem5.png
  34. BIN
      PDF Office/Resources/GuidItems/GuidItem6.png
  35. BIN
      PDF Office/Resources/GuidPDF/Quick Start Guide.pdf
  36. BIN
      PDF Office/Resources/PropertyPanel/addimage.png
  37. 55 1
      PDF Office/Strings/MainPage/MainPage.Designer.cs
  38. 18 0
      PDF Office/Strings/MainPage/MainPage.resx
  39. 1 0
      PDF Office/Styles/ListViewStyle.xaml
  40. 4 5
      PDF Office/Styles/OutLineItemStyle.xaml
  41. 46 31
      PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs
  42. 16 0
      PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs
  43. 2 1
      PDF Office/ViewModels/BOTA/SearchContentViewModel.cs
  44. 50 3
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterExcelDialogViewModel.cs
  45. 48 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterHTMLDialogViewModel.cs
  46. 48 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterPPTDialogViewModel.cs
  47. 48 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterRTFDialogViewModel.cs
  48. 53 3
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterTextDialogViewModel.cs
  49. 55 6
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterWordDialogViewModel.cs
  50. 35 65
      PDF Office/ViewModels/Dialog/ConverterDialogs/OCRDownloadProgressViewModel.cs
  51. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageRemoveDialogViewModel.cs
  52. 89 42
      PDF Office/ViewModels/Dialog/ToolsDialogs/MergeDialogViewModel.cs
  53. 9 1
      PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs
  54. 77 66
      PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageEditPropertyViewModel.cs
  55. 207 113
      PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs
  56. 70 0
      PDF Office/ViewModels/PropertyPanel/PropertyPanelContentEditViewModel.cs
  57. 289 217
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs
  58. 2 2
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Properties.cs
  59. 3 1
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs
  60. 225 122
      PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs
  61. 103 34
      PDF Office/ViewModels/ViewContentViewModel.cs
  62. 1 0
      PDF Office/Views/BOTA/AnnotationContent.xaml
  63. 103 73
      PDF Office/Views/BOTA/AnnotationContent.xaml.cs
  64. 6 1
      PDF Office/Views/BOTA/BookmarkContent.xaml
  65. 20 2
      PDF Office/Views/BOTA/BookmarkContent.xaml.cs
  66. 22 11
      PDF Office/Views/BOTA/OutLineControl.xaml.cs
  67. 14 8
      PDF Office/Views/BOTA/SearchContent.xaml.cs
  68. 1 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterExcelDialog.xaml
  69. 1 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterHTMLDialog.xaml
  70. 1 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterPPTDialog.xaml
  71. 1 1
      PDF Office/Views/Dialog/ConverterDialogs/ConverterRTFDialog.xaml
  72. 1 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterTextDialog.xaml
  73. 7 5
      PDF Office/Views/Dialog/ConverterDialogs/ConverterWordDialog.xaml
  74. 127 66
      PDF Office/Views/Dialog/ConverterDialogs/OCRDownloadProgress.xaml
  75. 5 0
      PDF Office/Views/Dialog/ConverterDialogs/OCRDownloadProgress.xaml.cs
  76. 42 36
      PDF Office/Views/Dialog/ServiceDialog/LoginoffDialog.xaml
  77. 11 11
      PDF Office/Views/Dialog/ServiceDialog/UserOutCodeRegion.xaml
  78. 5 5
      PDF Office/Views/HomePanel/HomeGuidContent.xaml
  79. 48 3
      PDF Office/Views/HomePanel/HomeGuidContent.xaml.cs
  80. 26 27
      PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml.cs
  81. 106 106
      PDF Office/Views/MainWindow.xaml
  82. 49 19
      PDF Office/Views/MainWindow.xaml.cs
  83. 17 3
      PDF Office/Views/PageEdit/PageEditContent.xaml.cs
  84. 1 1
      PDF Office/Views/PropertyPanel/PDFEdit/TextEditProperty.xaml
  85. 45 0
      PDF Office/Views/PropertyPanel/PropertyPanelContentEdit.xaml
  86. 28 0
      PDF Office/Views/PropertyPanel/PropertyPanelContentEdit.xaml.cs
  87. 7 3
      PDF Office/Views/Tools/TextEditToolContent.xaml
  88. BIN
      PDF Office/x64/CPDFConverterNative.dll
  89. BIN
      PDF Office/x64/ComDocumentAINative.dll
  90. BIN
      PDF Office/x64/ComPDFKit.dll
  91. BIN
      PDF Office/x64/DocumentAI.dll
  92. BIN
      PDF Office/x64/paddle2onnx.dll
  93. BIN
      PDF Office/x86/CPDFConverterNative.dll
  94. BIN
      PDF Office/x86/ComPDFKit.dll
  95. 68 0
      PDFSettings/DefaultEditProperty.cs
  96. 2 0
      PDFSettings/PDFSettings.csproj
  97. 16 0
      PDFSettings/PresetEditFontList.cs
  98. 18 17
      UpdateXML/pdfmaster_win_en_Us.xml
  99. 22 20
      UpdateXML/pdfmaster_win_zh_Hans.xml
  100. 0 0
      UpdateXML/pdfmaster_win_zh_Hant.xml

+ 71 - 46
PDF Office/App.xaml.cs

@@ -134,9 +134,14 @@ namespace PDF_Master
         /// </summary>
         public static bool IsFirstOpen = true;
 
-       /// <summary>
-       /// 激活窗体的原因
-       /// </summary>
+        /// <summary>
+        /// 是否获取了SDK支持的系统字体
+        /// </summary>
+        public static bool IsGetTextFamily = false;
+
+        /// <summary>
+        /// 激活窗体的原因
+        /// </summary>
         public static string  WebOpencase = "";
 
         public static bool IsBookMode = false;
@@ -174,6 +179,9 @@ namespace PDF_Master
         /// </summary>
         public static uint WebopenexpiredId;
 
+        //App当前系统语言
+        public static string CultureLanguage;
+
         /// <summary>
         /// 文案资源管理器  首页
         /// </summary>
@@ -205,63 +213,79 @@ namespace PDF_Master
             AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
             //Task线程内
             TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
+
+            CultureLanguage = System.Globalization.CultureInfo.CurrentUICulture.ToString();
         }
 
         private void InitSettings()
         {
-            //是否是更新后
-            if (Settings.Default.UpdateSettings)
+            try
             {
-                //内嵌文档更新时 显示文档到最前方
-                //每次版本更新留意检查IsGuidPDFUpdated 值,如果没有内嵌文档更新,要设为false
-                if (Settings.Default.IsGuidPDFUpdated)
+                //是否是更新后
+                if (Settings.Default.UpdateSettings)
                 {
-                    App.IsGuidPDFUpdated = true;
-                    Settings.Default.IsGuidPDFUpdated = false;
-                }
+                    //内嵌文档更新时 显示文档到最前方
+                    //每次版本更新留意检查IsGuidPDFUpdated 值,如果没有内嵌文档更新,要设为false
+                    if (Settings.Default.IsGuidPDFUpdated)
+                    {
+                        App.IsGuidPDFUpdated = true;
+                        Settings.Default.IsGuidPDFUpdated = false;
+                    }
 
-                Settings.Default.Upgrade();
-                Settings.Default.UpdateSettings = false;
-                //重置用于弹窗的记录参数
-            }
-            if (Settings.Default.ADDate == null)
-            {
-                Settings.Default.ADDate = new PDFSettings.ADDate();
-            }
+                    Settings.Default.Upgrade();
+                    Settings.Default.UpdateSettings = false;
+                    //清除OCR下载内容
+                    if (Settings.Default.AppProperties == null)
+                    {
+                        Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
+                    }
+                    Settings.Default.AppProperties.OCRFile_Url = "";
+                    Settings.Default.AppProperties.OCRmodelMD5 = "";
 
-            if (Settings.Default.PDFEditList == null)
-            {
-                Settings.Default.PDFEditList = new PDFSettings.PDFEditList();
-            }
-            if (Settings.Default.UserDate == null)
-            {
-                Settings.Default.UserDate = new PDFSettings.UserDate();
-            }
+                    //重置用于弹窗的记录参数
+                }
+                if (Settings.Default.ADDate == null)
+                {
+                    Settings.Default.ADDate = new PDFSettings.ADDate();
+                }
 
-            if (Settings.Default.AppProperties == null)
-            {
-                Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
-            }
+                if (Settings.Default.PDFEditList == null)
+                {
+                    Settings.Default.PDFEditList = new PDFSettings.PDFEditList();
+                }
+                if (Settings.Default.UserDate == null)
+                {
+                    Settings.Default.UserDate = new PDFSettings.UserDate();
+                }
 
-            if (Settings.Default.RecentOpenFiles == null)
-            {
-                Settings.Default.RecentOpenFiles = new RecentOpenFiles();
-            }
+                if (Settings.Default.AppProperties == null)
+                {
+                    Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
+                }
 
-            if (Settings.Default.RedactionsSettings == null)
-                Settings.Default.RedactionsSettings = new PDFSettings.RedactionSettings();
+                if (Settings.Default.RecentOpenFiles == null)
+                {
+                    Settings.Default.RecentOpenFiles = new RecentOpenFiles();
+                }
 
-            if (Settings.Default.AppProperties == null)
-                Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
+                if (Settings.Default.RedactionsSettings == null)
+                    Settings.Default.RedactionsSettings = new PDFSettings.RedactionSettings();
 
-            if (Settings.Default.AllPDFToolsList == null)
-                Settings.Default.AllPDFToolsList = new PDFSettings.AllPDFToolsList();
+                if (Settings.Default.AppProperties == null)
+                    Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
 
-            if (Settings.Default.QuickPDFToolsList == null)
-                Settings.Default.QuickPDFToolsList = new PDFSettings.QuickPDFToolsList();
+                if (Settings.Default.AllPDFToolsList == null)
+                    Settings.Default.AllPDFToolsList = new PDFSettings.AllPDFToolsList();
 
-            if (Settings.Default.PresetFontList == null)
-                Settings.Default.PresetFontList = new PDFSettings.PresetFontList();
+                if (Settings.Default.QuickPDFToolsList == null)
+                    Settings.Default.QuickPDFToolsList = new PDFSettings.QuickPDFToolsList();
+
+                if (Settings.Default.PresetFontList == null)
+                    Settings.Default.PresetFontList = new PDFSettings.PresetFontList();
+            }
+            catch { 
+            
+            }
         }
 
         protected override void OnStartup(StartupEventArgs e)
@@ -548,6 +572,7 @@ namespace PDF_Master
             containerRegistry.RegisterForNavigation<ChatGPTAIErrorCorrectionContent>();
             containerRegistry.RegisterForNavigation<BOTAContent>();
             containerRegistry.RegisterForNavigation<PropertyPanelContent>();
+            containerRegistry.RegisterForNavigation<PropertyPanelContentEdit>();
             containerRegistry.RegisterForNavigation<PageEditContent>();
             containerRegistry.RegisterForNavigation<BottomToolContent>();
             containerRegistry.RegisterForNavigation<ToolsBarContent>();
@@ -829,7 +854,7 @@ namespace PDF_Master
                 
                 LicenseError licenseerror = CPDFConverter.LicenseVerify(ConverterDevKey, ConverterDevSecret);
                 //初始化ocr库
-                CPDFConverter.InitOcrLibrary(Path.Combine(resPath, "x64"));
+                CPDFConverter.InitOCRLibrary(Path.Combine(resPath, "x64"));
                 //初始化资源
                 CPDFConverter.SetOCRModelPath(Path.Combine(resPath, "source"));
                 if (licenseerror != LicenseError.ERR_SUCCESS)

BIN
PDF Office/ComDocumentAIKit.dll


BIN
PDF Office/ComPDFKit.Desk.dll


BIN
PDF Office/ComPDFKit.Viewer.dll


BIN
PDF Office/ComPDFKit_Conversion.dll


+ 10 - 1
PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml

@@ -28,6 +28,7 @@
                     <TextBlock
                         HorizontalAlignment="Center"
                         VerticalAlignment="Center"
+                        FontFamily="{Binding FontFamily}"
                         Text="{Binding Content}" />
                 </StackPanel>
             </DataTemplate>
@@ -52,7 +53,15 @@
                         BorderBrush="#FFE2E3E6"
                         BorderThickness="1"
                         ItemTemplate="{StaticResource numberData}"
-                        MaxDropDownHeight="200" />
+                        MaxDropDownHeight="200"
+                        VirtualizingStackPanel.IsVirtualizing="True"
+                        VirtualizingStackPanel.VirtualizationMode="Standard">
+                        <ComboBox.ItemsPanel>
+                            <ItemsPanelTemplate>
+                                <VirtualizingStackPanel IsVirtualizing="True" VirtualizationMode="Recycling" />
+                            </ItemsPanelTemplate>
+                        </ComboBox.ItemsPanel>
+                    </ComboBox>
 
                     <TextBox
                         x:Name="title"

+ 43 - 13
PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml.cs

@@ -37,9 +37,22 @@ namespace PDF_Master.CustomControl.CompositeControl
         //}
 
         //字符串类型的值
-        public string ValueStr { get; private set; }
-
-        //数字类型的值
+        //public string ValueStr { get;  set; }
+        private string valueStr;
+
+        public string ValueStr
+        {
+            get
+            {
+                return valueStr;
+            }
+            set
+            {
+                SetProperty(ref valueStr, value);
+            }
+        }
+
+        //数字类型的值
         public double Value { get; private set; }
 
         //public string Content { get; private set; }
@@ -51,8 +64,16 @@ namespace PDF_Master.CustomControl.CompositeControl
             get { return _content; }
             private set { SetProperty(ref _content, value); }
         }
-
-        //下拉框显示的内容+单位:限数字值的单位
+
+        private FontFamily fontFamily = new FontFamily("Arial");
+
+        public FontFamily FontFamily
+        {
+            get { return fontFamily; }
+            set { SetProperty(ref fontFamily, value); }
+        }
+
+        //下拉框显示的内容+单位:限数字值的单位
         public string Unit { get; private set; }
 
         //数字类型
@@ -161,8 +182,10 @@ namespace PDF_Master.CustomControl.CompositeControl
             {
                 title.Text = item.Content;
                 Trace.WriteLine("comBox_SelectionChanged" + title.Text);
-                SelectedIndex = comBox.SelectedIndex;
-
+                if (SelectedIndex != comBox.SelectedIndex)
+                {
+                    SelectedIndex = comBox.SelectedIndex;
+                }
                 if (IsValueContent == false)
                 {
                     Value = item.Value;
@@ -336,8 +359,7 @@ namespace PDF_Master.CustomControl.CompositeControl
                             index = control.Items.IndexOf(temp);
 
                         if (index >= 0)
-                        {
-
+                        {
                             //为了改变值时选项跟着改变,但是值并没有时时刻刻改变,且影响其他事件展示注释掉 2023/4/4
                             //if (control.SelectedIndex != index)
                             //{
@@ -384,12 +406,20 @@ namespace PDF_Master.CustomControl.CompositeControl
             {
                 //删掉了selectedIndex != -1,设置不选中任何选项的情况
                 //删掉了control.SelectedItems = null;避免崩溃
-                if (control.comBox.Items != null && control.comBox.Items.Count > 0 )
+                if (control.comBox.Items != null && control.comBox.Items.Count > 0)
                 {
                     control.comBox.SelectedIndex = selectedIndex;
-                    if (control.comBox.SelectedItem != null)
-                        control.SelectedItems = (ComboDataItem)control.comBox.SelectedItem;
-                  
+                    if (control.comBox.SelectedItem != null)
+                    {
+                        if (control.comBox.SelectedItem is ComboDataItem comboDataItem)
+                        {
+                            bool isEqual = EqualityComparer<ComboDataItem>.Default.Equals(comboDataItem, control.SelectedItems);
+                            if (isEqual == false)
+                            {
+                                control.SelectedItems = (ComboDataItem)control.comBox.SelectedItem;
+                            }
+                        }
+                    }
                 }
                 control.UpdateSelectedIndex();
             }

+ 28 - 17
PDF Office/CustomControl/NumericUpDown.xaml

@@ -6,20 +6,21 @@
     xmlns:local="clr-namespace:PDF_Master.CustomControl"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     d:DesignWidth="120"
-    FontSize="20"
+    FontSize="14"
     Loaded="UserControl_Loaded"
     mc:Ignorable="d">
-    <Border Background="{StaticResource color.field.bg.def}"
-                BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,1,1,1"
-                CornerRadius="4,4,4,4">
+    <Border
+        Background="{StaticResource color.field.bg.def}"
+        BorderBrush="{StaticResource color.field.border.norm}"
+        BorderThickness="1,1,1,1"
+        CornerRadius="4,4,4,4">
         <Grid>
             <Grid.ColumnDefinitions>
                 <ColumnDefinition Width="*" />
                 <ColumnDefinition Width="1" />
                 <ColumnDefinition Width="20" />
             </Grid.ColumnDefinitions>
-            <Border
-                />
+            <Border />
             <TextBox
                 Name="TextBox_Num"
                 MinWidth="68"
@@ -28,29 +29,33 @@
                 VerticalContentAlignment="Center"
                 Background="Transparent"
                 BorderThickness="0"
-                LostFocus="TextBox_Num_LostFocus"
-                PreviewKeyDown="TextBox_Num_PreviewKeyDown"
                 FontFamily="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=FontFamily}"
                 FontSize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=FontSize}"
                 Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=Foreground}"
                 InputMethod.IsInputMethodEnabled="False"
+                LostFocus="TextBox_Num_LostFocus"
+                PreviewKeyDown="TextBox_Num_PreviewKeyDown"
                 PreviewTextInput="CountTextBox_PreviewTextInput"
                 Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=Text}"
                 TextAlignment="Left" />
-            <Rectangle Grid.Column="1" Fill="{StaticResource color.field.border.norm}" Margin="0,0.5,0,0.5"></Rectangle>
-            <Grid Grid.Column="2" Width="20"  >
+            <Rectangle
+                Grid.Column="1"
+                Margin="0,0.5,0,0.5"
+                Fill="{StaticResource color.field.border.norm}" />
+            <Grid Grid.Column="2" Width="20">
                 <Grid.RowDefinitions>
                     <RowDefinition Height="12*" />
-                    <RowDefinition Height="3*"/>
                     <RowDefinition Height="3*" />
-                    <RowDefinition Height="12*"/>
+                    <RowDefinition Height="3*" />
+                    <RowDefinition Height="12*" />
                 </Grid.RowDefinitions>
                 <Border
                     Grid.Row="0"
+                    Grid.RowSpan="2"
                     Background="{StaticResource color.field.bg.def}"
                     BorderBrush="{StaticResource color.field.border.norm}"
                     BorderThickness="0,0,0,0.5"
-                    CornerRadius="0,4,0,0" Grid.RowSpan="2">
+                    CornerRadius="0,4,0,0">
                     <Button
                         Name="Button_Add"
                         Background="Transparent"
@@ -58,27 +63,33 @@
                         BorderThickness="0"
                         Click="Button_Add_Click">
                         <Path
-                           
+                            Width="10.06"
+                            Height="5.78"
                             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}"
-                            Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" Height="5.78" Stretch="Fill" Width="10.06" />
+                            Stretch="Fill"
+                            Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
                     </Button>
                 </Border>
                 <Border
                     Grid.Row="2"
+                    Grid.RowSpan="2"
                     Background="{StaticResource color.field.bg.def}"
                     BorderBrush="{StaticResource color.field.border.norm}"
                     BorderThickness="0,0.5,0,0"
-                    CornerRadius="0,0,4,0" Grid.RowSpan="2" >
+                    CornerRadius="0,0,4,0">
                     <Button
                         Name="Button_Sub"
                         Background="Transparent"
                         BorderThickness="00"
                         Click="Button_Sub_Click">
                         <Path
+                            Width="10.06"
+                            Height="5.78"
                             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}"
-                            Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" Height="5.78" Stretch="Fill" Width="10.06"/>
+                            Stretch="Fill"
+                            Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
                     </Button>
                 </Border>
             </Grid>

+ 6 - 5
PDF Office/EventAggregators/RefreshAnnotationEvent.cs

@@ -8,18 +8,19 @@ using System.Threading.Tasks;
 
 namespace PDF_Master.EventAggregators
 {
-    internal class RefreshAnnotationEvent : PubSubEvent<RefreshAnnotationArgs>
+    public class RefreshAnnotationEvent : PubSubEvent<RefreshAnnotationArgs>
     {
     }
 
-    internal class RefreshAnnotationArgs
+    public class RefreshAnnotationArgs
     {
         public string Unicode { get; set; }
-        public int Pageindex { get; set; }
+        public int Pageindex { get; set; } = -1;
+        public int AnnotIndex { get; set; } = -1;
         public AnnotationHandlerEventArgs annotHandlerArgs { get; set; }
         public bool IsAll { get; set; }
         public bool IsSelect { get; set; }
-        public bool IsDel{ get; set; }
-
+        public bool IsDel { get; set; }
+        public bool IsExpand { get; set; }
     }
 }

+ 84 - 0
PDF Office/Helper/CommonHelper.cs

@@ -4,6 +4,8 @@ using PDF_Master.ViewModels.Dialog.BOTA;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Diagnostics.Eventing.Reader;
+using System.Globalization;
 using System.IO;
 using System.Linq;
 using System.Reflection;
@@ -598,5 +600,87 @@ namespace PDF_Master.Helper
             Numbers = Numbers.OrderBy(a => a).ToList();
             Numbers.Reverse();
         }
+
+        /// <summary>
+        /// 获取系统语言列表
+        /// </summary>
+        /// <returns></returns>
+        public static CultureInfo[] cultureInfos()
+        {
+            return CultureInfo.GetCultures(CultureTypes.AllCultures);
+        }
+
+        /// <summary>
+        /// 语言缩写获取语言全称
+        /// </summary>
+        /// <param name="languageCode"></param>
+        /// <returns></returns>
+        public static string LanguageFullName(string languageCode = "en")
+        {
+
+            CultureInfo[] cultures = cultureInfos();
+
+            CultureInfo matchingCulture = cultures.FirstOrDefault(c => c.TwoLetterISOLanguageName.Equals(languageCode, StringComparison.InvariantCultureIgnoreCase));
+
+            if (matchingCulture != null)
+            {
+                string languageFullName = matchingCulture.EnglishName;
+                return languageFullName;
+            }
+            else
+            {
+                return languageCode;
+            }
+        }
+
+        /// <summary>
+        /// 语言与地区缩写获取语言名字(语言+地区)
+        /// </summary>
+        /// <param name="languageAndcountryCode"></param>
+        /// <returns></returns>
+        public static string LanguageAndCountryFullName(string languageAndcountryCode = "en-US")
+        {
+
+            try
+            {
+                CultureInfo culture = CultureInfo.GetCultureInfo(languageAndcountryCode);
+                string languageFullName = culture.DisplayName;
+                return languageFullName;
+            }
+            catch (CultureNotFoundException)
+            {
+                return languageAndcountryCode;
+            }
+        }
+
+        /// <summary>
+        /// 语言与地区缩写获取语言名字(语言+地区)
+        /// </summary>
+        /// <param name="languageAndcountryCode"></param>
+        /// <returns></returns>
+        public static string LanguageName(string languageAndcountryCode = "en-US")
+        {
+            string languageAndcountry =  LanguageAndCountryFullName(languageAndcountryCode);
+            if (languageAndcountry.Contains("Chinese")) {
+                if (languageAndcountry.Contains("Simplified")) {
+                    return "Chinese";
+                } 
+                else {
+                    return "ChineseTraditional";
+                }
+            }
+            else if (languageAndcountry.Contains("("))
+            {
+                string pattern = @"\([^()]*\)"; // 匹配括号以及其中的内容
+
+                string result = Regex.Replace(languageAndcountry, pattern, string.Empty);
+                return result;
+            }
+            else {
+                return languageAndcountry;
+            }
+            
+        }
+
     }
 }

+ 47 - 2
PDF Office/Helper/ConverterHelper.cs

@@ -17,6 +17,7 @@ using System.Windows;
 using System.Net.Mime;
 using System.Windows.Controls;
 using PDF_Master.Properties;
+using ComDocumentAIKit;
 
 namespace PDF_Master.Helper
 {
@@ -620,8 +621,52 @@ namespace PDF_Master.Helper
         /// 转档解锁跳转
         /// </summary>
         public static void convertUnlock()
-        {      
-                Process.Start(new ProcessStartInfo(ServiceHelper.WebHost + "/windows/store/master?email=" + Settings.Default.UserDate.Email));
+        {
+            Process.Start(new ProcessStartInfo(ServiceHelper.WebHost + "/windows/store/master?email=" + Settings.Default.UserDate.Email));
+        }
+
+        /// <summary>
+        /// 获取OCR枚举
+        /// </summary>
+        /// <returns></returns>
+        public static COCRLanguage GetCOCRLanguage()
+        {
+            try
+            {
+                string languageName = CommonHelper.LanguageName(App.CultureLanguage);
+                string enumString = "COCRLanguage" + languageName; // 要转换的字符串
+                COCRLanguage enumValue; // 目标枚举类型变量
+                bool success = Enum.TryParse(enumString, out enumValue);
+                if (success)
+                {
+                    return enumValue;
+                }
+                else
+                {
+                    return COCRLanguage.COCRLanguageEnglish;
+                }
+            }
+            catch
+            {
+                return COCRLanguage.COCRLanguageEnglish;
+            }
+
+        }
+
+        /// <summary>
+        /// 将OCR语言枚举转为int
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCOCRLanguageInt() {
+
+            if ((int)ConverterHelper.GetCOCRLanguage() <= 4)
+            {
+               return (int)ConverterHelper.GetCOCRLanguage();
+            }
+            else
+            {
+               return 2;
+            }
         }
 
     }

+ 166 - 0
PDF Office/Helper/EditHelper.cs

@@ -0,0 +1,166 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Master.Helper
+{
+    public static class EditHelper
+    {
+        /// <summary>
+        /// 字体更改失效:
+        ///MT Extra
+        ///Symbol
+        ///HoloLens MDL2 Assets
+        ///Wingdings
+        ///Wingdings 2
+        ///Wingdings 3
+        ///Webdings
+        ///ZWAdobeF
+        ///Algerian
+        ///Bookshelf Symbol 7
+        ///Castellar
+        ///Marlett
+        ///MS Outlook(adobe、万兴没效果)
+        ///MS Reference Specialty
+        ///Segoe Fluent Icons(adobe、万兴没效果)
+        ///Segoe MDL2 Assets(adobe、万兴没效果)
+        ///Stencil
+        /// 未选择 文本时候,暂时注释SDK 目前没有效果的字体
+        /// </summary>
+        public static List<string> FontFamily { get; set; } = new List<string>
+{
+    "Adobe Devanagari",
+    "Arial",
+    "Arial Black",
+    "Arvo",
+    "Bahnschrift",
+    "Bahnschrift Condensed",
+    "Bahnschrift Light Condensed",
+    "Bahnschrift Light SemiCondensed",
+    "Bahnschrift SemiBold Condensed",
+    "Bahnschrift SemiCondensed",
+    "Bahnschrift SemiLight",
+    "Bahnschrift SemiLight Condensed",
+    "Calibri",
+    "Cambria",
+    "Cambria Math",
+    "Candara",
+    "Cascadia Code",
+    "Cascadia Code SemiLight",
+    "Cascadia Mono",
+    "Cascadia Mono SemiLight",
+    "Comic Sans MS",
+    "Consolas",
+    "Constantia",
+    "Corbel",
+    "Courier New",
+    "DejaVu Math TeX Gyre",
+    "Droid Serif",
+    "Ebrima",
+    "Franklin Gothic",
+    "Gabriola",
+    "Gadugi",
+    "Georgia",
+    //"HoloLens MDL2 Assets",
+    "Impact",
+    "Indie Flower",
+    "Ink Free",
+    "Javanese Text",
+    "Leelawadee UI",
+    "Leelawadee UI Semilight",
+    "Lobster",
+    "Lucida Console",
+    "Lucida Sans Unicode",
+    "MS Gothic",
+    "MS PGothic",
+    "MS UI Gothic",
+    //"MT Extra",
+    "MV Boli",
+    "Malgun Gothic",
+    "Malgun Gothic Semilight",
+    //"Marlett",
+    "Microsoft Himalaya",
+    "Microsoft JhengHei",
+    "Microsoft JhengHei UI",
+    "Microsoft New Tai Lue",
+    "Microsoft PhagsPa",
+    "Microsoft Sans Serif",
+    "Microsoft Tai Le",
+    "Microsoft YaHei UI",
+    "Microsoft Yi Baiti",
+    "MingLiU-ExtB",
+    "MingLiU_HKSCS-ExtB",
+    "Mongolian Baiti",
+    "Myanmar Text",
+    "Nirmala UI",
+    "Nirmala UI Semilight",
+    "Open Sans",
+    "PMingLiU-ExtB",
+    "Palatino Linotype",
+    "Poiret One",
+    "Raleway",
+    "Roboto",
+    "Roboto Condensed",
+    "Roboto Slab",
+    "Sans Serif Collection",
+    //"Segoe Fluent Icons",
+    //"Segoe MDL2 Assets",
+    "Segoe Print",
+    "Segoe Script",
+    "Segoe UI",
+    "Segoe UI Black",
+    "Segoe UI Emoji",
+    "Segoe UI Historic",
+    "Segoe UI Semilight",
+    "Segoe UI Symbol",
+    "Segoe UI Variable Display",
+    "Segoe UI Variable Small",
+    "Segoe UI Variable Text",
+    "SimSun-ExtB",
+    "Sitka Banner",
+    "Sitka Display",
+    "Sitka Heading",
+    "Sitka Small",
+    "Sitka Subheading",
+    "Sitka Text",
+    "Sylfaen",
+    //"Symbol",
+    "Tahoma",
+    "Times New",
+    "Trebuchet MS",
+    "Verdana",
+    //"Webdings",
+    //"Wingdings",
+    "Yu Gothic",
+    "Yu Gothic UI",
+    "Yu Gothic UI Semilight",
+    //"ZWAdobeF",
+    "等线",
+    "仿宋",
+    "黑体",
+    "楷体",
+    "宋体",
+    "微软雅黑"
+};
+
+        public static List<string> GetFontFamily()
+        {
+            return  FontFamily.OrderBy(item => IsChinese(item)).ThenBy(item => item).ToList();
+        }
+
+        private static bool IsChinese(string str)
+        {
+            foreach (char c in str)
+            {
+                if (c >= 0x4E00 && c <= 0x9FFF)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+}

+ 21 - 7
PDF Office/Helper/FileComparisonHelper.cs

@@ -14,9 +14,9 @@ namespace PDF_Master.Helper
     public static class FileComparisonHelper
     {
 #if DEBUG
-        public static string URI_AppXml = "http://test-pdf-pro.kdan.cn:3021/downloads/pdfreaderprocast_win_en_Us.xml";
+        public static string URI_AppXml = "http://test-pdf-pro.kdan.cn:3021/downloads/pdfmaster_win_en_Us.xml";
 #else
-        public static string URI_AppXml = "https://www.pdfreaderpro.com/downloads/pdfreaderprocast_win_en_Us.xml";
+        public static string URI_AppXml = "https://www.pdfreaderpro.com/downloads/pdfmaster_win_en_Us.xml";
 #endif
 
         private static string OCRmodelMD5 = "";
@@ -69,16 +69,24 @@ namespace PDF_Master.Helper
         public static bool OCRModelItExist()
         {
 
-            string folderPath = System.IO.Path.Combine(App.CurrentPath, "model");
+            string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
             if (Directory.Exists(folderPath))
             {
                 if (!Getpdfreaderprocast())
                 {
                     return false;
                 }
-                string folderMD5 = FileComparisonHelper.CalculateFolderMD5(folderPath);
+                string folderMD5 = "";
+                if (string.IsNullOrEmpty(OCRmodelMD5))
+                {
+                    folderMD5 = FileComparisonHelper.CalculateFolderMD5(folderPath);
+                }
+                else {
+                    folderMD5 = OCRmodelMD5;
+                }
                 if (folderMD5 == Settings.Default.AppProperties.OCRmodelMD5)
                 {
+                    OCRmodelMD5 = folderMD5;
                     return true;
                 }
             }
@@ -100,12 +108,12 @@ namespace PDF_Master.Helper
         {
             try
             {
-                string folderPath = System.IO.Path.Combine(App.CurrentPath, "model");
+                string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
                 if (Directory.Exists(folderPath))
                 {
                     Directory.Delete(folderPath, true);
                 }
-                string folderzipPath = System.IO.Path.Combine(App.CurrentPath, "modelzip");
+                string folderzipPath = System.IO.Path.Combine(App.CurrentPath, "OCREnginezip");
                 if (Directory.Exists(folderzipPath))
                 {
                     Directory.Delete(folderzipPath, true);
@@ -170,10 +178,16 @@ namespace PDF_Master.Helper
                             //获取OCRMD5
                             XmlAttribute ocrUrlAttributemd5 = itemNode.Attributes["ocrmd5"];
                             Settings.Default.AppProperties.OCRmodelMD5 = ocrUrlAttributemd5?.Value;
+                            //删除Xml文件
+                            string folderzipPath = System.IO.Path.Combine(App.CurrentPath, "AppXml");
+                            if (Directory.Exists(folderzipPath))
+                            {
+                                Directory.Delete(folderzipPath, true);
+                            }
                             return true;
                         }
                     }
-                    //return true;
+                    return false;
                 }
                 catch { return false; }
             }

+ 83 - 0
PDF Office/Helper/PDFEditHelper.cs

@@ -0,0 +1,83 @@
+using ComPDFKit.PDFPage;
+using ComPDFKit.PDFPage.Edit;
+using ComPDFKitViewer;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Master.Properties;
+using PDFSettings;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Master.Helper
+{
+    public static class PDFEditHelper
+    {
+        /// <summary>
+        /// 获取本地配置,并且更新对应属性
+        /// </summary>
+        /// <returns></returns>
+        public static PDFEditEvent GetPDFEditDefaultProperty(out DefaultEditProperty defaultEdit, CPDFViewer pdf)
+        {
+            PDFEditEvent editEvent = null;
+            defaultEdit = SettingHelper.GetPDFEditDefaultProperty(CPDFEditType.EditText);
+            if (defaultEdit == null)
+            {
+                defaultEdit = SetDefaultEdit();
+            }
+            editEvent = GetPDFEditEvent(defaultEdit, pdf);
+            return editEvent;
+        }
+
+        /// <summary>
+        /// 更新CPDFViewer的属性
+        /// </summary>
+        /// <param name="defaultEdit"></param>
+        /// <param name="pdf"></param>
+        /// <returns></returns>
+        public static PDFEditEvent GetPDFEditEvent(DefaultEditProperty defaultEdit, CPDFViewer pdf)
+        {
+            PDFEditEvent dFEditEvent = new PDFEditEvent();
+            dFEditEvent.FontName = defaultEdit.FontName;
+            dFEditEvent.FontSize = defaultEdit.FontSize;
+            dFEditEvent.TextAlign = defaultEdit.TextAlign;
+            dFEditEvent.AutoBlock = defaultEdit.AutoBlock;
+            dFEditEvent.ClipImage = defaultEdit.ClipImage;
+            dFEditEvent.EditType = defaultEdit.EditType;
+            dFEditEvent.FontColor = defaultEdit.FontColor;
+            dFEditEvent.HorizontalMirror = defaultEdit.HorizontalMirror;
+            dFEditEvent.IsBold = defaultEdit.IsBold;
+            dFEditEvent.IsItalic = defaultEdit.IsItalic;
+            dFEditEvent.ReplaceImagePath = defaultEdit.ReplaceImagePath;
+            dFEditEvent.Rotate = defaultEdit.Rotate;
+            dFEditEvent.Transparency = defaultEdit.Transparency;
+            dFEditEvent.VerticalMirror = defaultEdit.VerticalMirror;
+            pdf.SetPDFEditParam(dFEditEvent);
+            return dFEditEvent;
+        }
+
+        public static DefaultEditProperty SetDefaultEdit()
+        {
+            DefaultEditProperty defaultEdit = new PDFSettings.DefaultEditProperty();
+            defaultEdit.FontName = "Arial";
+            defaultEdit.FontSize = 14;
+            defaultEdit.TextAlign = TextAlignType.AlignLeft;
+            defaultEdit.AutoBlock = true;
+            defaultEdit.ClipImage = false;
+            defaultEdit.EditType = ComPDFKit.PDFPage.CPDFEditType.EditText;
+            defaultEdit.FontColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0);
+            defaultEdit.HorizontalMirror = false;
+            defaultEdit.VerticalMirror = false;
+            defaultEdit.IsBold = false;
+            defaultEdit.IsItalic = false;
+            defaultEdit.ReplaceImagePath = null;
+            defaultEdit.Rotate = 0;
+            defaultEdit.Transparency = 255;
+            defaultEdit.SystemFontNameList = new List<string>();
+            SettingHelper.SetPDFEditProperty(defaultEdit);
+            Settings.Default.Save();
+            return defaultEdit;
+        }
+    }
+}

+ 212 - 303
PDF Office/Helper/ServiceHelper.cs

@@ -377,7 +377,6 @@ namespace PDF_Master.Helper
             }
 
 
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
 
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + GetUserUrl + "");
@@ -390,88 +389,81 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        response.Close();
-                    }
-                    if (request != null)
-                    {
-                        request.Abort();
-                    };
-                    JToken jToken;
-                    if (jobject.TryGetValue("msg", out jToken) == false)
-                    {
-                        //ListenerSubscription();
-                        App.IsLogin = true;
-                        Settings.Default.UserDate.Email= jobject["email"].ToObject<string>().ToLower();
-                        Settings.Default.UserDate.id= jobject["id"].ToObject<string>().ToLower();
-                        JArray subscriptionInfoList = (JArray)jobject["subscriptionInfoList"];
-                        foreach (JToken info in subscriptionInfoList)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        JToken jToken;
+                        if (jobject.TryGetValue("msg", out jToken) == false)
                         {
-                            if ((int)info["platform"] == 2)
+                            //ListenerSubscription();
+                            App.IsLogin = true;
+                            Settings.Default.UserDate.Email = jobject["email"].ToObject<string>().ToLower();
+                            Settings.Default.UserDate.id = jobject["id"].ToObject<string>().ToLower();
+                            JArray subscriptionInfoList = (JArray)jobject["subscriptionInfoList"];
+                            foreach (JToken info in subscriptionInfoList)
                             {
-                                Settings.Default.UserDate.subscribeid = (string)info["id"];
-                                Settings.Default.UserDate.subscribeuserid = (string)info["userId"];
-                                Settings.Default.UserDate.subscribeplatform = (int)info["platform"];
-                                Settings.Default.UserDate.subscribestatus = (int)info["status"];
-                                if (Settings.Default.UserDate.subscribestatus > 0)
+                                if ((int)info["platform"] == 2)
                                 {
-                                    Settings.Default.UserDate.subscribeendDate = (string)info["endDate"];
-                                    Settings.Default.UserDate.subscribepayType = (int)info["payType"];
-                                }
-                              
+                                    Settings.Default.UserDate.subscribeid = (string)info["id"];
+                                    Settings.Default.UserDate.subscribeuserid = (string)info["userId"];
+                                    Settings.Default.UserDate.subscribeplatform = (int)info["platform"];
+                                    Settings.Default.UserDate.subscribestatus = (int)info["status"];
+                                    if (Settings.Default.UserDate.subscribestatus > 0)
+                                    {
+                                        Settings.Default.UserDate.subscribeendDate = (string)info["endDate"];
+                                        Settings.Default.UserDate.subscribepayType = (int)info["payType"];
+                                    }
+
 
+                                }
                             }
-                        }
-                       
-                        //此处为主页UPgread按钮的Visible
-                        if (Settings.Default.UserDate.subscribestatus == 1)
-                        {
-                            for (int i = 0; i < App.Current.Windows.Count; i++)
+
+                            //此处为主页UPgread按钮的Visible
+                            if (Settings.Default.UserDate.subscribestatus == 1)
                             {
-                                MainWindow win = App.Current.Windows[i] as MainWindow;
-                                if (win != null&& win.DataContext!=null)
+                                for (int i = 0; i < App.Current.Windows.Count; i++)
                                 {
-                                    (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Collapsed;
-                                    (win.DataContext as MainWindowViewModel).Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
+                                    MainWindow win = App.Current.Windows[i] as MainWindow;
+                                    if (win != null && win.DataContext != null)
+                                    {
+                                        (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Collapsed;
+                                        (win.DataContext as MainWindowViewModel).Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
+                                    }
                                 }
                             }
-                        }
-                        else
-                        {
-                            for (int i = 0; i < App.Current.Windows.Count; i++)
+                            else
                             {
-                                MainWindow win = App.Current.Windows[i] as MainWindow;
-                                if (win != null&& win.DataContext!=null)
+                                for (int i = 0; i < App.Current.Windows.Count; i++)
                                 {
-                                    (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
-                                    (win.DataContext as MainWindowViewModel).Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
+                                    MainWindow win = App.Current.Windows[i] as MainWindow;
+                                    if (win != null && win.DataContext != null)
+                                    {
+                                        (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                                        (win.DataContext as MainWindowViewModel).Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
+                                    }
                                 }
                             }
+                            #region 试用策略
+                            //Settings.Default.UserDate.isInFreeUseTime= jobject["isInFreeUseTime"].ToObject<bool>();
+                            //Settings.Default.UserDate.freeDate= jobject["freeDate"].ToObject<string>().ToLower();
+                            //if(DateTime.Parse(Settings.Default.UserDate.freeDate)<=DateTime.Now)
+                            //{
+                            //    Settings.Default.UserDate.isInFreeUseTime = false;
+                            //}
+                            #endregion
+                            App.mainWindowViewModel.Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
+                            Settings.Default.Save();
+                            return "ture";
                         }
-                        #region 试用策略
-                        //Settings.Default.UserDate.isInFreeUseTime= jobject["isInFreeUseTime"].ToObject<bool>();
-                        //Settings.Default.UserDate.freeDate= jobject["freeDate"].ToObject<string>().ToLower();
-                        //if(DateTime.Parse(Settings.Default.UserDate.freeDate)<=DateTime.Now)
-                        //{
-                        //    Settings.Default.UserDate.isInFreeUseTime = false;
-                        //}
-                        #endregion
-                        App.mainWindowViewModel.Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
-                        Settings.Default.Save();
-                        return "ture";
-                    }
-                    else
-                    {
+                        else
+                        {
 
-                        return "false";
+                            return "false";
+                        }
                     }
                 }
             }
@@ -533,7 +525,6 @@ namespace PDF_Master.Helper
         public static String Ok_email(string intemail, string validType)
         {
 
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + OKemailUrl);
             request.Method = "Post";
@@ -565,25 +556,18 @@ namespace PDF_Master.Helper
                     writer.Close();
                 }
 
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    //outemail = jobject["msg"].ToObject<string>().ToLower();
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        request.Abort();
-                    }
-                    return jobject["code"].ToObject<string>().ToLower();
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        //outemail = jobject["msg"].ToObject<string>().ToLower();
+                        return jobject["code"].ToObject<string>().ToLower();
 
 
+                    }
                 }
             }
             catch (Exception ex)
@@ -604,7 +588,6 @@ namespace PDF_Master.Helper
         public static string Get_code(string action, string email)
         {
             string post = $"?action={action}&appId=16&receiver={email}&type=0";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
 
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + GetcodeUrl + post);
@@ -616,23 +599,16 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        request.Abort();
-                    }
-                    return jobject["code"].ToObject<string>().ToLower();
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        return jobject["code"].ToObject<string>().ToLower();
 
+                    }
                 }
             }
             catch
@@ -656,7 +632,6 @@ namespace PDF_Master.Helper
         {
 
             string post = $"?account={email}&code={code}&type={type}&appId=16";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
 
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + OKcodeUrl + post);
@@ -668,23 +643,16 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        request.Abort();
-                    }
-                    return jobject["code"].ToObject<string>().ToLower();
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        return jobject["code"].ToObject<string>().ToLower();
 
+                    }
                 }
             }
             catch
@@ -706,7 +674,6 @@ namespace PDF_Master.Helper
         public static String Register_email(string intemail, string intpassword, string intcode, string uuid)
         {
 
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + registerUrl);
             request.Method = "Post";
@@ -745,47 +712,40 @@ namespace PDF_Master.Helper
                     writer.Close();
                 }
 
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        request.Abort();
-                    }
-
-                    if (jobject["code"].ToObject<string>().ToLower() == "200")
-                    {
-                        App.IsLogin =true;
-                        for (int i = 0; i < App.Current.Windows.Count; i++)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        if (jobject["code"].ToObject<string>().ToLower() == "200")
                         {
-                            MainWindow win = App.Current.Windows[i] as MainWindow;
-                            if (win != null && win.DataContext != null)
+                            App.IsLogin = true;
+                            for (int i = 0; i < App.Current.Windows.Count; i++)
                             {
-                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Visible;
-                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Collapsed;
-                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                MainWindow win = App.Current.Windows[i] as MainWindow;
+                                if (win != null && win.DataContext != null)
+                                {
+                                    (win.DataContext as MainWindowViewModel).UserVis = Visibility.Visible;
+                                    (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Collapsed;
+                                    (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                }
                             }
+                            Settings.Default.UserDate.Email = intemail;
+                            Settings.Default.UserDate.IsLoginoff = false;
+                            access_token = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                            Settings.Default.AppProperties.LoginToken = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                            Settings.Default.Save();
+
+                            GetUser();
                         }
-                        Settings.Default.UserDate.Email = intemail;
-                        Settings.Default.UserDate.IsLoginoff = false;
-                        access_token = jobject["result"]["access_token"].ToObject<string>().ToLower();
-                        Settings.Default.AppProperties.LoginToken = jobject["result"]["access_token"].ToObject<string>().ToLower();
-                        Settings.Default.Save();
+                        //return jobject["code"].ToObject<string>().ToLower();
 
-                        GetUser();
+                        return "200";
                     }
-                    //return jobject["code"].ToObject<string>().ToLower();
-
-                    return "200";
                 }
+
             }
             catch
             {
@@ -806,7 +766,6 @@ namespace PDF_Master.Helper
         {
 
             string postBody = $"?appId=16&deviceSign={uuid}&email={intemail}&password={intpassword}&platformType=0&model=windows";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + LoginUrl + postBody);
             request.Method = "Post";
@@ -817,45 +776,38 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        response.Close();
-                    }
-                    if (request != null)
-                    {
-                        request.Abort();
-                    }
-                    if (jobject["code"].ToObject<string>().ToLower() == "200")
-                    {
-                        //ListenerSubscription();
-                        for (int i = 0; i < App.Current.Windows.Count; i++)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        if (jobject["code"].ToObject<string>().ToLower() == "200")
                         {
-                            MainWindow win = App.Current.Windows[i] as MainWindow;
-                            if (win != null && win.DataContext != null)
+                            //ListenerSubscription();
+                            for (int i = 0; i < App.Current.Windows.Count; i++)
                             {
-                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Visible;
-                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Collapsed;
-                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                MainWindow win = App.Current.Windows[i] as MainWindow;
+                                if (win != null && win.DataContext != null)
+                                {
+                                    (win.DataContext as MainWindowViewModel).UserVis = Visibility.Visible;
+                                    (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Collapsed;
+                                    (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                }
                             }
+                            App.IsLogin = true;
+                            Settings.Default.UserDate.Email = intemail;
+                            Settings.Default.UserDate.IsLoginoff = false;
+                            access_token = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                            Settings.Default.AppProperties.LoginToken = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                            Settings.Default.Save();
+                            GetUser();
+
                         }
-                        App.IsLogin = true;
-                        Settings.Default.UserDate.Email = intemail;
-                        Settings.Default.UserDate.IsLoginoff = false;
-                        access_token = jobject["result"]["access_token"].ToObject<string>().ToLower();
-                        Settings.Default.AppProperties.LoginToken = jobject["result"]["access_token"].ToObject<string>().ToLower();
-                        Settings.Default.Save();
-                        GetUser();
+                        return jobject["code"].ToObject<string>().ToLower();
 
                     }
-                    return jobject["code"].ToObject<string>().ToLower();
-
                 }
             }
             catch
@@ -874,7 +826,6 @@ namespace PDF_Master.Helper
         {
 
             string postBody = $"?deviceSign={uuid}&appId=16";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + LogoutUrl + postBody);
             request.Method = "Post";
@@ -886,37 +837,30 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    App.IsLogin = false;
-                    Settings.Default.UserDate.subscribestatus = -1;
-                    Settings.Default.UserDate.subscribepayType = 0;
-                    App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
-                    for (int i = 0; i < App.Current.Windows.Count; i++)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        MainWindow win = App.Current.Windows[i] as MainWindow;
-                        if (win != null && win.DataContext != null)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        App.IsLogin = false;
+                        Settings.Default.UserDate.subscribestatus = -1;
+                        Settings.Default.UserDate.subscribepayType = 0;
+                        App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
+                        for (int i = 0; i < App.Current.Windows.Count; i++)
                         {
-                            (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
-                            (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
-                            (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
-                            (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                            MainWindow win = App.Current.Windows[i] as MainWindow;
+                            if (win != null && win.DataContext != null)
+                            {
+                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
+                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
+                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                            }
                         }
-                    }
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
-                    {
-                        request.Abort();
-                    }
 
+                    }
                 }
             }
             catch
@@ -936,7 +880,6 @@ namespace PDF_Master.Helper
         {
 
             string postBody = $"?code={code}&appId=16";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + UseroutUrl + postBody);
             request.Method = "Post";
@@ -948,41 +891,33 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    App.IsLogin = false;
-                    Settings.Default.UserDate.subscribestatus = -1;
-                    Settings.Default.UserDate.subscribepayType = 0;
-                    for (int i = 0; i < App.Current.Windows.Count; i++)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        MainWindow win = App.Current.Windows[i] as MainWindow;
-                        if (win != null && win.DataContext != null)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        App.IsLogin = false;
+                        Settings.Default.UserDate.subscribestatus = -1;
+                        Settings.Default.UserDate.subscribepayType = 0;
+                        for (int i = 0; i < App.Current.Windows.Count; i++)
                         {
-                            (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
-                            (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
-                            (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
-                            (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                            MainWindow win = App.Current.Windows[i] as MainWindow;
+                            if (win != null && win.DataContext != null)
+                            {
+                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
+                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
+                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                            }
                         }
-                    }
-                    App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
-                    {
-                        request.Abort();
-                    }
-
-                    return jobject["code"].ToObject<string>().ToLower();
+                        App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
 
+                        return jobject["code"].ToObject<string>().ToLower();
 
 
+                    }
                 }
             }
             catch
@@ -1004,7 +939,6 @@ namespace PDF_Master.Helper
         {
 
 
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + RebirthUrl);
             request.Method = "Post";
@@ -1041,33 +975,25 @@ namespace PDF_Master.Helper
                     writer.Close();
                 }
 
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        request.Abort();
-                    }
-                    for (int i = 0; i < App.Current.Windows.Count; i++)
-                    {
-                        MainWindow win = App.Current.Windows[i] as MainWindow;
-                        if (win != null)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        for (int i = 0; i < App.Current.Windows.Count; i++)
                         {
-                            (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
-                            (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
-                            (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                            MainWindow win = App.Current.Windows[i] as MainWindow;
+                            if (win != null)
+                            {
+                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
+                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
+                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                            }
                         }
+                        return jobject["code"].ToObject<string>().ToLower();
                     }
-                    return jobject["code"].ToObject<string>().ToLower();
-
 
                 }
 
@@ -1086,7 +1012,6 @@ namespace PDF_Master.Helper
         {
 
             string postBody = $"?appId=16&deviceSign={GetDeviceSerialNumber()}";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + CheckDeviceStatusUrl + postBody);
             request.Method = "Post";
@@ -1097,41 +1022,35 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    App.IsLogin = false;
-                    Settings.Default.UserDate.subscribestatus = -1;
-                    Settings.Default.UserDate.subscribepayType = 0;
-                    App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
-                    if(App.Current.Windows!=null&&App.Current.Windows.Count!=0)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        for (int i = 0; i < App.Current.Windows.Count; i++)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        reader.Close();
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        App.IsLogin = false;
+                        Settings.Default.UserDate.subscribestatus = -1;
+                        Settings.Default.UserDate.subscribepayType = 0;
+                        App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
+                        if (App.Current.Windows != null && App.Current.Windows.Count != 0)
                         {
-                            MainWindow win = App.Current.Windows[i] as MainWindow;
-                            if (win != null&& win.DataContext!=null)
+                            for (int i = 0; i < App.Current.Windows.Count; i++)
                             {
-                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
-                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
-                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
-                                (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                                MainWindow win = App.Current.Windows[i] as MainWindow;
+                                if (win != null && win.DataContext != null)
+                                {
+                                    (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
+                                    (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
+                                    (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                    (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                                }
                             }
                         }
-                    }
 
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
-                    {
-                        request.Abort();
+                        return jobject["code"].ToObject<string>().ToLower();
                     }
-                    return jobject["code"].ToObject<string>().ToLower();
                 }
             }
             catch 
@@ -1149,7 +1068,6 @@ namespace PDF_Master.Helper
             string url = RequestHost + DeviceLogUrl;
             try
             {
-                HttpWebResponse response = null;
                 ServicePointManager.DefaultConnectionLimit = 200;
                 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + DeviceLogUrl);
                 request.Method = "Post";
@@ -1194,26 +1112,17 @@ namespace PDF_Master.Helper
                     writer.Write(postBody);
                     writer.Close();
                 }
-
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
-                    {
-                        request.Abort();
-                    }
-
-                    if (jobject["code"].ToObject<string>().ToLower() == "200")
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        Console.WriteLine("软件启动信息上传成功");
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        if (jobject["code"].ToObject<string>().ToLower() == "200")
+                        {
+                            Console.WriteLine("软件启动信息上传成功");
+                        }
                     }
                 }
             }

+ 28 - 2
PDF Office/Helper/SettingHelper.cs

@@ -69,7 +69,7 @@ namespace PDF_Master.Helper
         {
             if (Settings.Default.RecentOpenFiles == null || Settings.Default.RecentOpenFiles.Count == 0)
                 return;
-               
+
             OpenFileInfo deleteItem = null;
             foreach(var item in Settings.Default.RecentOpenFiles)
             {
@@ -177,6 +177,32 @@ namespace PDF_Master.Helper
 
         #endregion 缓存注释属性
 
+        #region 缓存编辑属性
+
+        public static DefaultEditProperty GetPDFEditDefaultProperty(ComPDFKit.PDFPage.CPDFEditType editType, string saveKey = "")
+        {
+            if (Settings.Default.DefaultEditProperties != null)
+            {
+                if (saveKey == "")
+                {
+                    return Settings.Default.DefaultEditProperties.GetEditProperty(editType);
+                }
+                return Settings.Default.DefaultEditProperties.GetEditProperty(editType, saveKey);
+            }
+            return null;
+        }
+
+        public static void SetPDFEditProperty(DefaultEditProperty editType)
+        {
+            if (Settings.Default.DefaultEditProperties == null)
+            {
+                Settings.Default.DefaultEditProperties = new DefaultEditProperties();
+            }
+            Settings.Default.DefaultEditProperties.SetEditProperty(editType);
+            Settings.Default.Save();
+        }
+
+        #endregion 缓存编辑属性
 
         #region 缓存颜色列表
 
@@ -315,4 +341,4 @@ namespace PDF_Master.Helper
             //Settings.Default.Save();
         }
     }
-}
+}

+ 39 - 520
PDF Office/Model/AnnotPanel/FontBoard.cs

@@ -6,6 +6,8 @@ using PDFSettings;
 using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -25,7 +27,9 @@ namespace PDF_Master.Model.AnnotPanel
         TextAlignment
     }
 
-    //设置字体大小、字体内容排版、字体颜色、字体样式、字重
+    /// <summary>
+    ///  编辑-文本 设置字体大小、字体内容排版、字体颜色、字体样式、字重
+    /// </summary>
     public class FontBoard : BindableBase
     {
         #region 变量
@@ -33,7 +37,18 @@ namespace PDF_Master.Model.AnnotPanel
         protected event EventHandler<FontSetModeType> ChangedValue;
 
         protected bool IsCanSave = false;
-        public List<ComboDataItem> FontFamilyItems { get; protected set; }
+
+        private List<ComboDataItem> _fontFamilyItems;
+
+        public List<ComboDataItem> FontFamilyItems
+        {
+            get { return _fontFamilyItems; }
+            set
+            {
+                SetProperty(ref _fontFamilyItems, value);
+            }
+        }
+
         public List<ComboDataItem> FontStyleItems { get; protected set; }
         public List<ComboDataItem> FontSizeItems { get; protected set; }
         public List<ComboDataItem> PresetFontItems { get; protected set; }
@@ -51,6 +66,7 @@ namespace PDF_Master.Model.AnnotPanel
             InitBase_FontStyles();
             InitBase_FontSize();
         }
+
         //预设字体大小
         private void InitBase_FontSize()
         {
@@ -61,7 +77,7 @@ namespace PDF_Master.Model.AnnotPanel
         private void InitBase_PresetFontStyles()
         {
             PresetFontItems = new List<ComboDataItem>();
-            PresetFontList = TextFont.GetCachePresetFontList();
+            PresetFontList = TextFont.GetCachePresetEditFontList();
 
             foreach (var item in PresetFontList)
             {
@@ -71,9 +87,9 @@ namespace PDF_Master.Model.AnnotPanel
         }
 
         //字体
-        private void InitBase_FontFamilys()
+        public void InitBase_FontFamilys()
         {
-            FontFamilyItems = TextFont.GetFamily();
+            FontFamilyItems = TextFont.GetFamilyEdit();
         }
 
         //字重
@@ -99,7 +115,6 @@ namespace PDF_Master.Model.AnnotPanel
         /// 预设样式
         /// </summary>
 
-
         private int presetFontSelectedIndex;
 
         public int PresetFontSelectedIndex
@@ -110,7 +125,8 @@ namespace PDF_Master.Model.AnnotPanel
                 SetProperty(ref presetFontSelectedIndex, value);
             }
         }
-        private ComboDataItem _currentPresetFont=new ComboDataItem("Custom", "Custom");
+
+        private ComboDataItem _currentPresetFont = new ComboDataItem("Custom", "Custom");
 
         public ComboDataItem CurrentPresetFont
         {
@@ -164,7 +180,7 @@ namespace PDF_Master.Model.AnnotPanel
         #region 字体样式
 
         //下拉框列表
-        private ComboDataItem _currentFontFamily = new ComboDataItem("Helvetica", "Helvetica");
+        private ComboDataItem _currentFontFamily = new ComboDataItem("Arial", "Arial");
 
         public ComboDataItem CurrentFontFamily
         {
@@ -175,50 +191,27 @@ namespace PDF_Master.Model.AnnotPanel
                 SetProperty(ref _currentFontFamily, value);
                 if (isChange)
                 {
-                    string str= _currentFontFamily.ValueStr;
-                    if (_currentFontFamily.ValueStr== "Times")
+                    string str = _currentFontFamily.Content;
+                    if (_currentFontFamily.Content == "Times New Roman")
                     {
                         str = "Times-Roman";
                     }
-                    else if(_currentFontFamily.ValueStr== "Courier")
-                    {
-                        str = "Courier New";
-                    }
-                    
                     ChangedValue?.Invoke(str, FontSetModeType.FontFamilys);
-
                 }
                 SetProperty(ref _currentFontFamily, value);
                 if (value.Content != null)
                 {
-                    switch (value.Content.ToString())
-                    {
-                        case "Courier New":
-                            FontFamilySelectedIndex = 0;
-                            break;
-
-                        case "Helvetica":
-                        case "Arial":
-                            FontFamilySelectedIndex = 1;
-                            break;
-
-                        case "Times New Roman":
-                            FontFamilySelectedIndex = 2;
-                            break;
-                        default:
-                                FontFamilySelectedIndex = -1;                            
-                            break;
-                    }
+                    int index = FontFamilyItems.FindIndex(item => item.Content == value.Content);
+                    FontFamilySelectedIndex = index;
+                    Trace.WriteLine(index);
                 }
                 else
                 {
                     FontFamilySelectedIndex = 0;
                 }
-                
             }
         }
 
-
         private int fontFamilySelectedIndex = -1;
 
         public int FontFamilySelectedIndex
@@ -227,9 +220,9 @@ namespace PDF_Master.Model.AnnotPanel
             set
             {
                 SetProperty(ref fontFamilySelectedIndex, value);
-
             }
         }
+
         #endregion 字体样式
 
         #region 字体大小
@@ -244,6 +237,7 @@ namespace PDF_Master.Model.AnnotPanel
                 SetProperty(ref fontSizeSelectedIndex, value);
             }
         }
+
         //下拉框列表:字体大小
         private ComboDataItem _currentFontSize = new ComboDataItem(6);
 
@@ -329,11 +323,8 @@ namespace PDF_Master.Model.AnnotPanel
                         //FontSizeSelectedIndex = 0;
                         //FontSizeSelectedIndex = -1;
                         break;
-
                 }
-               
             }
-
         }
 
         #endregion 字体大小
@@ -366,12 +357,13 @@ namespace PDF_Master.Model.AnnotPanel
                 SetProperty(ref fontStyleSelectedIndex, value);
             }
         }
+
         private ComboDataItem _currrentFontWeightStyle = new ComboDataItem("Regular", "Regular");
+
         public ComboDataItem CurrrentFontWeightStyle
         {
             get { return _currrentFontWeightStyle; }
 
-
             set
             {
                 bool isChange = IsEqualStrComboData(_currrentFontWeightStyle, value);
@@ -399,11 +391,7 @@ namespace PDF_Master.Model.AnnotPanel
                         FontStyleSelectedIndex = 3;
                         break;
                 }
-
-
             }
-
-
         }
 
         protected void UpdateFontWeight_Style()
@@ -543,490 +531,21 @@ namespace PDF_Master.Model.AnnotPanel
 
         protected void GetCurrentFontFamily(string fontFamily, string uiStr)
         {
-            if (fontFamily == "Arial")
-            {
-                fontFamily = "Helvetica";
-                uiStr = "Helvetica";
-            }
-            if(fontFamily == "Times-Roman"|| fontFamily == "Times")
+            //SDK捕获到的字体会是Times-Roman
+            if (fontFamily == "Times-Roman")
             {
                 uiStr = "Times New Roman";
             }
-            if(fontFamily == "Courier")
-            {
-                uiStr = "Courier New";
-            }
-            CurrentFontFamily = new ComboDataItem(fontFamily, uiStr);
-        }
-
-        #endregion 列表选中赋值
-    }
-
-
-
-    //设置字体大小、字体内容排版、字体颜色、字体样式、字重
-    public class FontBoardVm : BindableBase
-    {
-        #region 变量
-
-        public List<ComboDataItem> FontFamilyItems { get; protected set; }
-        public List<ComboDataItem> FontStyleItems { get; protected set; }
-        public List<ComboDataItem> FontSizeItems { get; protected set; }
-        public List<ComboDataItem> PresetFontItems { get; protected set; }
-
-        public List<PresetFontItem> PresetFontList = new List<PresetFontItem>();
-
-        public FontBoardVm(bool isInitdata)
-        {
-            if (isInitdata)
-                InitBaseVariable();
-        }
-
-        #endregion 变量
-
-        #region 初始化下拉框或列表默认的数据
+            //WPF的UI字体不包含Helvetica
 
-        protected void InitBaseVariable()
-        {
-            InitBase_PresetFontStyles();
-            InitBase_FontFamilys();
-            InitBase_FontStyles();
-            InitBase_FontSize();
-        }
-
-        private void InitBase_FontSize()
-        {
-            FontSizeItems = TextFont.GetFontSize();
-        }
-
-        //预设字体样式
-        private void InitBase_PresetFontStyles()
-        {
-            PresetFontItems = new List<ComboDataItem>();
-            PresetFontList = TextFont.GetCachePresetFontList();
-
-            foreach (var item in PresetFontList)
+            if (fontFamily == "Helvetica")
             {
-                ComboDataItem itemData = new ComboDataItem(item.mTag, item.mTagContent);
-                PresetFontItems.Add(itemData);
-            }
-        }
-
-        //字体
-        private void InitBase_FontFamilys()
-        {
-            FontFamilyItems = TextFont.GetFamily();
-        }
-
-        //字重
-        private void InitBase_FontStyles()
-        {
-            FontStyleItems = TextFont.GetFontStyle();
-        }
-
-        #endregion 初始化下拉框或列表默认的数据
-
-        #region 属性
-
-        /// <summary>
-        /// 预设样式
-        /// </summary>
-        private ComboDataItem _currentPresetFont = new ComboDataItem("Custom", "Custom");
-
-        public ComboDataItem CurrentPresetFont
-        {
-            get { return _currentPresetFont; }
-            set
-            {
-                SetProperty(ref _currentPresetFont, value);
-                switch (value.ValueStr.ToString())
-                {
-                    case "Custom":
-                        PresetFontSelectedIndex = 0;
-                        break;
-
-                    case "H1":
-                        PresetFontSelectedIndex = 1;
-                        break;
-
-                    case "H2":
-                        PresetFontSelectedIndex = 2;
-                        break;
-
-                    case "H3":
-                        PresetFontSelectedIndex = 3;
-                        break;
-
-                    case "B1":
-                        PresetFontSelectedIndex = 4;
-                        break;
-
-                    case "B2":
-                        PresetFontSelectedIndex = 5;
-                        break;
-
-                    case "B3":
-                        PresetFontSelectedIndex = 6;
-                        break;
-
-                    default:
-                        PresetFontSelectedIndex = 0;
-                        break;
-                }
-            }
-        }
-
-        private int presetFontSelectedIndex;
-
-        public int PresetFontSelectedIndex
-        {
-            get { return presetFontSelectedIndex; }
-            set
-            {
-                SetProperty(ref presetFontSelectedIndex, value);
-            }
-        }
-
-        #region 字体样式
-
-        //下拉框列表
-        private ComboDataItem _currentFontFamily = new ComboDataItem("Helvetica", "Helvetica");
-
-        public ComboDataItem CurrentFontFamily
-        {
-            get { return _currentFontFamily; }
-            set
-            {
-                SetProperty(ref _currentFontFamily, value);
-                switch (value.Content.ToString())
-                {
-                    case "Courier New":
-                        FontFamilySelectedIndex = 0;
-                        break;
-
-                    case "Helvetica":
-                    case "Arial":
-                        FontFamilySelectedIndex = 1;
-                        break;
-
-                    case "Times New Roman":
-                        FontFamilySelectedIndex = 2;
-                        break;
-                }
-            }
-        }
-
-        private int fontFamilySelectedIndex;
-
-        public int FontFamilySelectedIndex
-        {
-            get { return fontFamilySelectedIndex; }
-            set
-            {
-                SetProperty(ref fontFamilySelectedIndex, value);
-            }
-        }
-
-        #endregion 字体样式
-
-        #region 字体大小
-
-        private int fontSizeSelectedIndex;
-
-        public int FontSizeSelectedIndex
-        {
-            get { return fontSizeSelectedIndex; }
-            set
-            {
-                SetProperty(ref fontSizeSelectedIndex, value);
-            }
-        }
-
-        //下拉框列表:字体大小
-        private ComboDataItem _currentFontSize = new ComboDataItem(6);
-
-        public ComboDataItem CurrentFontSize
-        {
-            get { return _currentFontSize; }
-            set
-            {
-                SetProperty(ref _currentFontSize, value);
-                switch (value.Value)
-                {
-                    case 8:
-                        FontSizeSelectedIndex = 0;
-                        break;
-
-                    case 9:
-                        FontSizeSelectedIndex = 1;
-                        break;
-
-                    case 10:
-                        FontSizeSelectedIndex = 2;
-                        break;
-
-                    case 11:
-                        FontSizeSelectedIndex = 3;
-                        break;
-
-                    case 12:
-                        FontSizeSelectedIndex = 4;
-                        break;
-
-                    case 14:
-                        FontSizeSelectedIndex = 5;
-                        break;
-
-                    case 16:
-                        FontSizeSelectedIndex = 6;
-                        break;
-
-                    case 18:
-                        FontSizeSelectedIndex = 7;
-                        break;
-
-                    case 20:
-                        FontSizeSelectedIndex = 8;
-                        break;
-
-                    case 22:
-                        FontSizeSelectedIndex = 9;
-                        break;
-
-                    case 24:
-                        FontSizeSelectedIndex = 10;
-                        break;
-
-                    case 26:
-                        FontSizeSelectedIndex = 11;
-                        break;
-
-                    case 28:
-                        FontSizeSelectedIndex = 12;
-                        break;
-
-                    case 36:
-                        FontSizeSelectedIndex = 13;
-                        break;
-
-                    case 48:
-                        FontSizeSelectedIndex = 14;
-                        break;
-
-                    case 72:
-                        FontSizeSelectedIndex = 15;
-                        break;
-
-                    default:
-                        //FontSizeSelectedIndex = 0;
-                        //FontSizeSelectedIndex = -1;
-                        break;
-                }
-            }
-        }
-
-        #endregion 字体大小
-
-        //FontStyle & FontWeight
-
-        private FontStyle _fontStyleItem;
-
-        public FontStyle FontStyleItem
-        {
-            get { return _fontStyleItem; }
-            set { SetProperty(ref _fontStyleItem, value); }
-        }
-
-        private FontWeight _fontWeight;
-
-        public FontWeight FontWeightItem
-        {
-            get { return _fontWeight; }
-            set { SetProperty(ref _fontWeight, value); }
-        }
-
-        private int fontStyleSelectedIndex;
-
-        public int FontStyleSelectedIndex
-        {
-            get { return fontStyleSelectedIndex; }
-            set
-            {
-                SetProperty(ref fontStyleSelectedIndex, value);
-            }
-        }
-
-        private ComboDataItem _currrentFontWeightStyle = new ComboDataItem("Regular", "Regular");
-
-        public ComboDataItem CurrrentFontWeightStyle
-        {
-            get { return _currrentFontWeightStyle; }
-            set
-            {
-                SetProperty(ref _currrentFontWeightStyle, value);
-                switch (value.Content.ToString())
-                {
-                    case "Regular":
-                        FontStyleSelectedIndex = 0;
-                        break;
-
-                    case "Bold":
-                        FontStyleSelectedIndex = 1;
-                        break;
-
-                    case "Italic":
-                        FontStyleSelectedIndex = 2;
-                        break;
-
-                    case "Bold Italic":
-                        FontStyleSelectedIndex = 3;
-                        break;
-                }
-            }
-        }
-
-        public void UpdateFontWeight_Style()
-        {
-            switch (CurrrentFontWeightStyle.ValueStr)
-            {
-                case "Regular":
-                    FontStyleItem = FontStyles.Normal;
-                    FontWeightItem = FontWeights.Normal;
-                    break;
-
-                case "Bold":
-                    FontStyleItem = FontStyles.Normal;
-                    FontWeightItem = FontWeights.Bold;
-                    break;
-
-                case "Italic":
-                    FontStyleItem = FontStyles.Italic;
-                    FontWeightItem = FontWeights.Normal;
-                    break;
-
-                case "Bold Italic":
-                    FontStyleItem = FontStyles.Italic;
-                    FontWeightItem = FontWeights.Bold;
-                    break;
-            }
-        }
-
-        //文字内容对齐
-        private string _strtextAlign;
-
-        public string StrTextAlign
-        {
-            get { return _strtextAlign; }
-            set { SetProperty(ref _strtextAlign, value); }
-        }
-
-        //颜色
-        private Brush _fontColor = new SolidColorBrush(Colors.Black);
-
-        public Brush FontColor
-        {
-            get { return _fontColor; }
-            set { SetProperty(ref _fontColor, value); CurrentFontColor = _fontColor; }
-        }
-
-        private Brush _currentFontColor = new SolidColorBrush(Colors.Transparent);
-
-        public Brush CurrentFontColor
-        {
-            get { return _currentFontColor; }
-            set => SetProperty(ref _currentFontColor, value);
-        }
-
-        //外部UI引用,判断是否选中左对齐、居中对齐、右对齐,或都不选中
-        public string strAglinState { get; private set; }
-
-        //VM赋值
-        public void SetStrAglinState(string str)
-        {
-            strAglinState = str;
-        }
-
-        #endregion 属性
-
-        #region 列表选中赋值
-
-        public void GetFontWeights_Style(FontStyle fontStyle, FontWeight fontWeights)
-        {
-            string strValue = "";
-            string strContent = "";
-            if (fontStyle == FontStyles.Normal)
-            {
-                if (fontWeights == FontWeights.Normal)
-                {
-                    strValue = "Regular";
-                    strContent = "Regular";
-                }
-                else
-                {
-                    strValue = "Bold";
-                    strContent = "Bold";
-                }
-            }
-            else
-            {
-                if (fontWeights == FontWeights.Normal)
-                {
-                    strValue = "Italic";
-                    strContent = "Italic";
-                }
-                else
-                {
-                    strValue = "Bold Italic";
-                    strContent = "Bold Italic";
-                }
-            }
-
-            CurrrentFontWeightStyle = new ComboDataItem(strValue, strContent);
-            UpdateFontWeight_Style();
-        }
-
-        public void GetCurrentFontSize(int size)
-        {
-            CurrentFontSize = new ComboDataItem(size);
-        }
-
-        public void GetCurrentFontFamily(string fontFamily, string uiStr)
-        {
-            if (fontFamily == "Arial")
-            {
-                fontFamily = "Helvetica";
-                uiStr = "Helvetica";
+                fontFamily = "Arial";
+                uiStr = "Arial";
             }
             CurrentFontFamily = new ComboDataItem(fontFamily, uiStr);
         }
 
-        public void GetCurrentPresetFont(string presetFont, string uiStr)
-        {
-            CurrentPresetFont = new ComboDataItem(presetFont, uiStr);
-        }
-
-        internal bool GetCurrentPresetFont(FreeTextAnnotArgs annot)
-        {
-            bool isExist = false;
-            //List<PresetFontItem> presetFontItems = TextFont.GetCachePresetFontList();
-            foreach (var item in PresetFontList)
-            {
-                if (annot.FontSize == item.mFontSize && annot.IsBold == (item.mFontWeight==FontWeights.Bold) && annot.IsItalic == (item.mFontStyle==FontStyles.Italic)
-                    && (annot.FontName == item.mFontFamily.Source || annot.FontName == "Arial" && item.mFontFamily.Source == "Helvetica")
-                    )
-                {
-                    if (item.mTag != "Custom")
-                    {
-                        CurrentPresetFont = new ComboDataItem(item.mTag, item.mTagContent);
-                        isExist = true;
-                    }
-
-                    break;
-                }
-            }
-            return isExist;
-        }
-
         #endregion 列表选中赋值
     }
 }

+ 499 - 0
PDF Office/Model/AnnotPanel/FontBoardVm.cs

@@ -0,0 +1,499 @@
+using ComPDFKitViewer.AnnotEvent;
+using PDF_Master.CustomControl.CompositeControl;
+using PDF_Master.Model.PropertyPanel.AnnotPanel;
+using PDFSettings;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+
+namespace PDF_Master.Model.AnnotPanel
+{
+    /// <summary>
+    /// 注释-文本
+    /// 设置字体大小、字体内容排版、字体颜色、字体样式、字重
+    /// </summary>
+    public class FontBoardVm : BindableBase
+    {
+        #region 变量
+
+        public List<ComboDataItem> FontFamilyItems { get; protected set; }
+        public List<ComboDataItem> FontStyleItems { get; protected set; }
+        public List<ComboDataItem> FontSizeItems { get; protected set; }
+        public List<ComboDataItem> PresetFontItems { get; protected set; }
+
+        public List<PresetFontItem> PresetFontList = new List<PresetFontItem>();
+
+        public FontBoardVm(bool isInitdata)
+        {
+            if (isInitdata)
+                InitBaseVariable();
+        }
+
+        #endregion 变量
+
+        #region 初始化下拉框或列表默认的数据
+
+        protected void InitBaseVariable()
+        {
+            InitBase_PresetFontStyles();
+            InitBase_FontFamilys();
+            InitBase_FontStyles();
+            InitBase_FontSize();
+        }
+
+        private void InitBase_FontSize()
+        {
+            FontSizeItems = TextFont.GetFontSize();
+        }
+
+        //预设字体样式
+        private void InitBase_PresetFontStyles()
+        {
+            PresetFontItems = new List<ComboDataItem>();
+            PresetFontList = TextFont.GetCachePresetFontList();
+
+            foreach (var item in PresetFontList)
+            {
+                ComboDataItem itemData = new ComboDataItem(item.mTag, item.mTagContent);
+                PresetFontItems.Add(itemData);
+            }
+        }
+
+        //字体
+        private void InitBase_FontFamilys()
+        {
+            FontFamilyItems = TextFont.GetFamily();
+        }
+
+        //字重
+        private void InitBase_FontStyles()
+        {
+            FontStyleItems = TextFont.GetFontStyle();
+        }
+
+        #endregion 初始化下拉框或列表默认的数据
+
+        #region 属性
+
+        /// <summary>
+        /// 预设样式
+        /// </summary>
+        private ComboDataItem _currentPresetFont = new ComboDataItem("Custom", "Custom");
+
+        public ComboDataItem CurrentPresetFont
+        {
+            get { return _currentPresetFont; }
+            set
+            {
+                SetProperty(ref _currentPresetFont, value);
+                switch (value.ValueStr.ToString())
+                {
+                    case "Custom":
+                        PresetFontSelectedIndex = 0;
+                        break;
+
+                    case "H1":
+                        PresetFontSelectedIndex = 1;
+                        break;
+
+                    case "H2":
+                        PresetFontSelectedIndex = 2;
+                        break;
+
+                    case "H3":
+                        PresetFontSelectedIndex = 3;
+                        break;
+
+                    case "B1":
+                        PresetFontSelectedIndex = 4;
+                        break;
+
+                    case "B2":
+                        PresetFontSelectedIndex = 5;
+                        break;
+
+                    case "B3":
+                        PresetFontSelectedIndex = 6;
+                        break;
+
+                    default:
+                        PresetFontSelectedIndex = 0;
+                        break;
+                }
+            }
+        }
+
+        private int presetFontSelectedIndex;
+
+        public int PresetFontSelectedIndex
+        {
+            get { return presetFontSelectedIndex; }
+            set
+            {
+                SetProperty(ref presetFontSelectedIndex, value);
+            }
+        }
+
+        #region 字体样式
+
+        //下拉框列表
+        private ComboDataItem _currentFontFamily = new ComboDataItem("Arial", "Arial");
+
+        public ComboDataItem CurrentFontFamily
+        {
+            get { return _currentFontFamily; }
+            set
+            {
+                SetProperty(ref _currentFontFamily, value);
+                switch (value.Content.ToString())
+                {
+                    case "Courier New":
+                        FontFamilySelectedIndex = 0;
+                        break;
+
+                    case "Arial":
+                        FontFamilySelectedIndex = 1;
+                        break;
+
+                    case "Times New Roman":
+                        FontFamilySelectedIndex = 2;
+                        break;
+
+                    case "Adobe Devanagari":
+                        FontFamilySelectedIndex = 3;
+                        break;
+                }
+            }
+        }
+
+        private int fontFamilySelectedIndex;
+
+        public int FontFamilySelectedIndex
+        {
+            get { return fontFamilySelectedIndex; }
+            set
+            {
+                SetProperty(ref fontFamilySelectedIndex, value);
+            }
+        }
+
+        #endregion 字体样式
+
+        #region 字体大小
+
+        private int fontSizeSelectedIndex;
+
+        public int FontSizeSelectedIndex
+        {
+            get { return fontSizeSelectedIndex; }
+            set
+            {
+                SetProperty(ref fontSizeSelectedIndex, value);
+            }
+        }
+
+        //下拉框列表:字体大小
+        private ComboDataItem _currentFontSize = new ComboDataItem(6);
+
+        public ComboDataItem CurrentFontSize
+        {
+            get { return _currentFontSize; }
+            set
+            {
+                SetProperty(ref _currentFontSize, value);
+                switch (value.Value)
+                {
+                    case 8:
+                        FontSizeSelectedIndex = 0;
+                        break;
+
+                    case 9:
+                        FontSizeSelectedIndex = 1;
+                        break;
+
+                    case 10:
+                        FontSizeSelectedIndex = 2;
+                        break;
+
+                    case 11:
+                        FontSizeSelectedIndex = 3;
+                        break;
+
+                    case 12:
+                        FontSizeSelectedIndex = 4;
+                        break;
+
+                    case 14:
+                        FontSizeSelectedIndex = 5;
+                        break;
+
+                    case 16:
+                        FontSizeSelectedIndex = 6;
+                        break;
+
+                    case 18:
+                        FontSizeSelectedIndex = 7;
+                        break;
+
+                    case 20:
+                        FontSizeSelectedIndex = 8;
+                        break;
+
+                    case 22:
+                        FontSizeSelectedIndex = 9;
+                        break;
+
+                    case 24:
+                        FontSizeSelectedIndex = 10;
+                        break;
+
+                    case 26:
+                        FontSizeSelectedIndex = 11;
+                        break;
+
+                    case 28:
+                        FontSizeSelectedIndex = 12;
+                        break;
+
+                    case 36:
+                        FontSizeSelectedIndex = 13;
+                        break;
+
+                    case 48:
+                        FontSizeSelectedIndex = 14;
+                        break;
+
+                    case 72:
+                        FontSizeSelectedIndex = 15;
+                        break;
+
+                    default:
+                        //FontSizeSelectedIndex = 0;
+                        //FontSizeSelectedIndex = -1;
+                        break;
+                }
+            }
+        }
+
+        #endregion 字体大小
+
+        //FontStyle & FontWeight
+
+        private FontStyle _fontStyleItem;
+
+        public FontStyle FontStyleItem
+        {
+            get { return _fontStyleItem; }
+            set { SetProperty(ref _fontStyleItem, value); }
+        }
+
+        private FontWeight _fontWeight;
+
+        public FontWeight FontWeightItem
+        {
+            get { return _fontWeight; }
+            set { SetProperty(ref _fontWeight, value); }
+        }
+
+        private int fontStyleSelectedIndex;
+
+        public int FontStyleSelectedIndex
+        {
+            get { return fontStyleSelectedIndex; }
+            set
+            {
+                SetProperty(ref fontStyleSelectedIndex, value);
+            }
+        }
+
+        private ComboDataItem _currrentFontWeightStyle = new ComboDataItem("Regular", "Regular");
+
+        public ComboDataItem CurrrentFontWeightStyle
+        {
+            get { return _currrentFontWeightStyle; }
+            set
+            {
+                SetProperty(ref _currrentFontWeightStyle, value);
+                switch (value.Content.ToString())
+                {
+                    case "Regular":
+                        FontStyleSelectedIndex = 0;
+                        break;
+
+                    case "Bold":
+                        FontStyleSelectedIndex = 1;
+                        break;
+
+                    case "Italic":
+                        FontStyleSelectedIndex = 2;
+                        break;
+
+                    case "Bold Italic":
+                        FontStyleSelectedIndex = 3;
+                        break;
+                }
+            }
+        }
+
+        public void UpdateFontWeight_Style()
+        {
+            switch (CurrrentFontWeightStyle.ValueStr)
+            {
+                case "Regular":
+                    FontStyleItem = FontStyles.Normal;
+                    FontWeightItem = FontWeights.Normal;
+                    break;
+
+                case "Bold":
+                    FontStyleItem = FontStyles.Normal;
+                    FontWeightItem = FontWeights.Bold;
+                    break;
+
+                case "Italic":
+                    FontStyleItem = FontStyles.Italic;
+                    FontWeightItem = FontWeights.Normal;
+                    break;
+
+                case "Bold Italic":
+                    FontStyleItem = FontStyles.Italic;
+                    FontWeightItem = FontWeights.Bold;
+                    break;
+            }
+        }
+
+        //文字内容对齐
+        private string _strtextAlign;
+
+        public string StrTextAlign
+        {
+            get { return _strtextAlign; }
+            set { SetProperty(ref _strtextAlign, value); }
+        }
+
+        //颜色
+        private Brush _fontColor = new SolidColorBrush(Colors.Black);
+
+        public Brush FontColor
+        {
+            get { return _fontColor; }
+            set { SetProperty(ref _fontColor, value); CurrentFontColor = _fontColor; }
+        }
+
+        private Brush _currentFontColor = new SolidColorBrush(Colors.Transparent);
+
+        public Brush CurrentFontColor
+        {
+            get { return _currentFontColor; }
+            set => SetProperty(ref _currentFontColor, value);
+        }
+
+        //外部UI引用,判断是否选中左对齐、居中对齐、右对齐,或都不选中
+        public string strAglinState { get; private set; }
+
+        //VM赋值
+        public void SetStrAglinState(string str)
+        {
+            strAglinState = str;
+        }
+
+        #endregion 属性
+
+        #region 列表选中赋值
+
+        public void GetFontWeights_Style(FontStyle fontStyle, FontWeight fontWeights)
+        {
+            string strValue = "";
+            string strContent = "";
+            if (fontStyle == FontStyles.Normal)
+            {
+                if (fontWeights == FontWeights.Normal)
+                {
+                    strValue = "Regular";
+                    strContent = "Regular";
+                }
+                else
+                {
+                    strValue = "Bold";
+                    strContent = "Bold";
+                }
+            }
+            else
+            {
+                if (fontWeights == FontWeights.Normal)
+                {
+                    strValue = "Italic";
+                    strContent = "Italic";
+                }
+                else
+                {
+                    strValue = "Bold Italic";
+                    strContent = "Bold Italic";
+                }
+            }
+
+            CurrrentFontWeightStyle = new ComboDataItem(strValue, strContent);
+            UpdateFontWeight_Style();
+        }
+
+        public void GetCurrentFontSize(int size)
+        {
+            CurrentFontSize = new ComboDataItem(size);
+        }
+
+        public void GetCurrentFontFamily(string fontFamily, string uiStr)
+        {
+            if (fontFamily == "Helvetica")
+            {
+                fontFamily = "Arial";
+                uiStr = "Arial";
+            }
+            if (fontFamily == "Times-Roman")
+            {
+                uiStr = "Times New Roman";
+            }
+            if (fontFamily == "CourierNew")
+            {
+                uiStr = "Courier New";
+            }
+            if (fontFamily == "AdobeDevanagari")
+            {
+                uiStr = "Adobe Devanagari";
+            }
+            CurrentFontFamily = new ComboDataItem(fontFamily, uiStr);
+        }
+
+        public void GetCurrentPresetFont(string presetFont, string uiStr)
+        {
+            CurrentPresetFont = new ComboDataItem(presetFont, uiStr);
+        }
+
+        internal bool GetCurrentPresetFont(FreeTextAnnotArgs annot)
+        {
+            bool isExist = false;
+            //List<PresetFontItem> presetFontItems = TextFont.GetCachePresetFontList();
+            foreach (var item in PresetFontList)
+            {
+                if (annot.FontSize == item.mFontSize && annot.IsBold == (item.mFontWeight == FontWeights.Bold) && annot.IsItalic == (item.mFontStyle == FontStyles.Italic)
+                && (annot.FontName == item.mFontFamily.Source || annot.FontName == "Arial" && item.mFontFamily.Source == "Helvetica")
+                )
+                {
+                    if (item.mTag != "Custom")
+                    {
+                        CurrentPresetFont = new ComboDataItem(item.mTag, item.mTagContent);
+                        isExist = true;
+                    }
+
+                    break;
+                }
+            }
+            return isExist;
+        }
+
+        #endregion 列表选中赋值
+    }
+}

+ 14 - 8
PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs

@@ -21,6 +21,11 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
     {
         public COCRLanguage OCRLanguage = COCRLanguage.COCRLanguageEnglish;
         public bool IsAllowOCR = false;
+
+        /// <summary>
+        /// 开启ocr时是否选择包含ocr底图
+        /// 如果包含 ,PDF转HTML的时候,ocr,会重叠=>特殊文档
+        /// </summary>
         public bool IsContainOCRBgImage = true;
         public bool IsContainAnnotations = true;
         public bool IsContainImages = true;
@@ -179,8 +184,9 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
 
                     if (ConverterCSVModel != null)
                     {
-                        App.mainWindowViewModel.MaxValue = ConverterCSVModel.PageIndexLists.Count();
+                        //先对链表做处理,在获取链表个数
                         limitationConvert(ConverterCSVModel);
+                        App.mainWindowViewModel.MaxValue = ConverterCSVModel.PageIndexLists.Count();
                         for (int i = 0; ConverterCSVModel.PageIndexLists.Count > i; i++)
                         {
                             ConverterCSVModel.PageIndexLists[i] = ConverterCSVModel.PageIndexLists[i] + 1;
@@ -195,8 +201,8 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
                     ConverterExcelDialogModel ConverterExcelModel = e.Parameters.GetValue<ConverterExcelDialogModel>(ParameterNames.ConverterTypeModel);
                     if (ConverterExcelModel != null)
                     {
-                        App.mainWindowViewModel.MaxValue = ConverterExcelModel.PageIndexLists.Count();
                         limitationConvert(ConverterExcelModel);
+                        App.mainWindowViewModel.MaxValue = ConverterExcelModel.PageIndexLists.Count();
                         for (int i = 0; ConverterExcelModel.PageIndexLists.Count > i; i++)
                         {
                             ConverterExcelModel.PageIndexLists[i] = ConverterExcelModel.PageIndexLists[i] + 1;
@@ -209,8 +215,8 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
                     ConverterHTMLDialogModel ConverterHTMLModel = e.Parameters.GetValue<ConverterHTMLDialogModel>(ParameterNames.ConverterTypeModel);
                     if (ConverterHTMLModel != null)
                     {
-                        App.mainWindowViewModel.MaxValue = ConverterHTMLModel.PageIndexLists.Count();
                         limitationConvert(ConverterHTMLModel);
+                        App.mainWindowViewModel.MaxValue = ConverterHTMLModel.PageIndexLists.Count();
                         for (int i = 0; ConverterHTMLModel.PageIndexLists.Count > i; i++)
                         {
                             ConverterHTMLModel.PageIndexLists[i] = ConverterHTMLModel.PageIndexLists[i] + 1;
@@ -223,8 +229,8 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
                     ConverterImgDialogModel ConverterImgModel = e.Parameters.GetValue<ConverterImgDialogModel>(ParameterNames.ConverterTypeModel);
                     if (ConverterImgModel != null)
                     {
-                        App.mainWindowViewModel.MaxValue = ConverterImgModel.PageIndexLists.Count();
                         limitationConvert(ConverterImgModel);
+                        App.mainWindowViewModel.MaxValue = ConverterImgModel.PageIndexLists.Count();
                         for (int i = 0; ConverterImgModel.PageIndexLists.Count > i; i++)
                         {
                             ConverterImgModel.PageIndexLists[i] = ConverterImgModel.PageIndexLists[i] + 1;
@@ -237,8 +243,8 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
                     ConverterPPTDialogModel ConverterPPTModel = e.Parameters.GetValue<ConverterPPTDialogModel>(ParameterNames.ConverterTypeModel);
                     if (ConverterPPTModel != null)
                     {
-                        App.mainWindowViewModel.MaxValue = ConverterPPTModel.PageIndexLists.Count();
                         limitationConvert(ConverterPPTModel);
+                        App.mainWindowViewModel.MaxValue = ConverterPPTModel.PageIndexLists.Count();
                         for (int i = 0; ConverterPPTModel.PageIndexLists.Count > i; i++)
                         {
                             ConverterPPTModel.PageIndexLists[i] = ConverterPPTModel.PageIndexLists[i] + 1;
@@ -252,8 +258,8 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
                     ConverterRTFDialogModel ConverterRTFModel = e.Parameters.GetValue<ConverterRTFDialogModel>(ParameterNames.ConverterTypeModel);
                     if (ConverterRTFModel != null)
                     {
-                        App.mainWindowViewModel.MaxValue = ConverterRTFModel.PageIndexLists.Count();
                         limitationConvert(ConverterRTFModel);
+                        App.mainWindowViewModel.MaxValue = ConverterRTFModel.PageIndexLists.Count();
                         for (int i = 0; ConverterRTFModel.PageIndexLists.Count > i; i++)
                         {
                             ConverterRTFModel.PageIndexLists[i] = ConverterRTFModel.PageIndexLists[i] + 1;
@@ -266,8 +272,8 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
                     ConverterTextDialogModel ConverterTextModel = e.Parameters.GetValue<ConverterTextDialogModel>(ParameterNames.ConverterTypeModel);
                     if (ConverterTextModel != null)
                     {
-                        App.mainWindowViewModel.MaxValue = ConverterTextModel.PageIndexLists.Count();
                         limitationConvert(ConverterTextModel);
+                        App.mainWindowViewModel.MaxValue = ConverterTextModel.PageIndexLists.Count();
                         for (int i = 0; ConverterTextModel.PageIndexLists.Count > i; i++)
                         {
                             ConverterTextModel.PageIndexLists[i] = ConverterTextModel.PageIndexLists[i] + 1;
@@ -280,8 +286,8 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
                     ConverterWordDialogModel ConverterWordModel = e.Parameters.GetValue<ConverterWordDialogModel>(ParameterNames.ConverterTypeModel);
                     if (ConverterWordModel != null)
                     {
-                        App.mainWindowViewModel.MaxValue = ConverterWordModel.PageIndexLists.Count();
                         limitationConvert(ConverterWordModel);
+                        App.mainWindowViewModel.MaxValue = ConverterWordModel.PageIndexLists.Count();
                         for (int i = 0; ConverterWordModel.PageIndexLists.Count > i; i++)
                         {
                             ConverterWordModel.PageIndexLists[i] = ConverterWordModel.PageIndexLists[i] + 1;

+ 307 - 108
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -1,12 +1,17 @@
-using PDF_Master.CustomControl.CompositeControl;
+using ImTools;
+using PDF_Master.CustomControl.CompositeControl;
+using PDF_Master.Helper;
+using PDF_Master.Model.AnnotPanel;
 using PDF_Master.Properties;
 using PDFSettings;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
+using System.Windows.Controls;
 using System.Windows.Media;
 
 namespace PDF_Master.Model.PropertyPanel.AnnotPanel
@@ -19,9 +24,9 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             List<PresetFontItem> cacheTempList = new List<PresetFontItem>();
 
             if (Settings.Default.PresetFontList == null)
-                Settings.Default.PresetFontList = new PresetFontList();
-
-            if (Settings.Default.PreinstallFontList == null)
+                Settings.Default.PresetFontList = new PresetFontList();
+
+            if (Settings.Default.PreinstallFontList == null)
                 Settings.Default.PreinstallFontList = new PreinstallFontList();
 
             if (Settings.Default.PreinstallFontList.Count == 0/*Settings.Default.PresetFontList.Count == 0*/ )
@@ -39,7 +44,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
                     Settings.Default.PresetFontList.Add(newItem);
 
                     //复杂数据类型 , 不可本地缓存到配置文件,需要转换一下(先 string保存,再根据类型缓存)
-                    var newItem1 = new PreinstallItem();
+                    var newItem1 = new PreinstallItem();
                     newItem1.mTag = cacheItem.mTag;
                     newItem1.mTagContent = cacheItem.mTagContent;
                     newItem1.mFontStyle = cacheItem.mFontStyle.ToString();
@@ -54,39 +59,129 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             else
             {
                 //根据 对应的字段 内容 ,对照相对应的类型
-                foreach (var item in Settings.Default.PreinstallFontList)
-                {
+                foreach (var item in Settings.Default.PreinstallFontList)
+                {
+                    var newItem = new PresetFontItem();
+                    newItem.mTag = item.mTag;
+                    newItem.mTagContent = item.mTagContent;
+                    switch (item.mFontStyle)
+                    {
+                        case "Normal":
+                            newItem.mFontStyle = FontStyles.Normal;
+                            break;
+
+                        case "Italic":
+                            newItem.mFontStyle = FontStyles.Italic;
+                            break;
+
+                        case "Oblique":
+                            newItem.mFontStyle = FontStyles.Oblique;
+                            break;
+                    }
+                    switch (item.mFontWeight)
+                    {
+                        case "Bold":
+                            newItem.mFontWeight = FontWeights.Bold;
+                            break;
+
+                        case "Normal":
+                            newItem.mFontWeight = FontWeights.Normal;
+                            break;
+                    }
+                    newItem.mFontSize = item.mFontSize;
+                    newItem.mFontFamily = new FontFamily(item.mFontFamily);
+
+                    cacheTempList.Add(newItem);
+                }
+                //foreach (var item in Settings.Default.PresetFontList)
+                //{
+                //    var newItem = new PresetFontItem();
+                //    newItem.mTag = item.mTag;
+                //    newItem.mTagContent = item.mTagContent;
+                //    newItem.mFontStyle = item.mFontStyle;
+                //    newItem.mFontWeight = item.mFontWeight;
+                //    newItem.mFontSize = item.mFontSize;
+                //    newItem.mFontFamily = item.mFontFamily;
+                //    cacheTempList.Add(newItem);
+                //}
+            }
+
+            return cacheTempList;
+        }
+
+        public static List<PresetFontItem> GetCachePresetEditFontList()
+        {
+            List<PresetFontItem> cacheTempList = new List<PresetFontItem>();
+
+            if (Settings.Default.PresetEditFontList == null)
+                Settings.Default.PresetEditFontList = new PresetEditFontList();
+
+            if (Settings.Default.PreinstallEditFontList == null)
+                Settings.Default.PreinstallEditFontList = new PreinstallEditFontList();
+
+            if (Settings.Default.PreinstallEditFontList.Count == 0/*Settings.Default.PresetFontList.Count == 0*/ )
+            {
+                cacheTempList = GetPresetFontStyle();
+                foreach (var cacheItem in cacheTempList)
+                {
+                    var newItem = new PresetFontItem();
+                    newItem.mTag = cacheItem.mTag;
+                    newItem.mTagContent = cacheItem.mTagContent;
+                    newItem.mFontStyle = cacheItem.mFontStyle;
+                    newItem.mFontWeight = cacheItem.mFontWeight;
+                    newItem.mFontSize = cacheItem.mFontSize;
+                    newItem.mFontFamily = cacheItem.mFontFamily;
+                    Settings.Default.PresetEditFontList.Add(newItem);
+
+                    //复杂数据类型 , 不可本地缓存到配置文件,需要转换一下(先 string保存,再根据类型缓存)
+                    var newItem1 = new PreinstallItem();
+                    newItem1.mTag = cacheItem.mTag;
+                    newItem1.mTagContent = cacheItem.mTagContent;
+                    newItem1.mFontStyle = cacheItem.mFontStyle.ToString();
+                    newItem1.mFontWeight = cacheItem.mFontWeight.ToString();
+                    newItem1.mFontSize = cacheItem.mFontSize;
+                    newItem1.mFontFamily = cacheItem.mFontFamily.Source;
+                    Settings.Default.PreinstallEditFontList.Add(newItem1);
+                }
+
+                Settings.Default.Save();
+            }
+            else
+            {
+                //根据 对应的字段 内容 ,对照相对应的类型
+                foreach (var item in Settings.Default.PreinstallEditFontList)
+                {
                     var newItem = new PresetFontItem();
                     newItem.mTag = item.mTag;
                     newItem.mTagContent = item.mTagContent;
-                    switch (item.mFontStyle)
-                    {
-                        case "Normal":
-                            newItem.mFontStyle = FontStyles.Normal;
-                            break;
-
-                        case "Italic":
-                            newItem.mFontStyle = FontStyles.Italic;
-                            break;
-
-                        case "Oblique":
-                            newItem.mFontStyle = FontStyles.Oblique;
-                            break;
+                    switch (item.mFontStyle)
+                    {
+                        case "Normal":
+                            newItem.mFontStyle = FontStyles.Normal;
+                            break;
+
+                        case "Italic":
+                            newItem.mFontStyle = FontStyles.Italic;
+                            break;
+
+                        case "Oblique":
+                            newItem.mFontStyle = FontStyles.Oblique;
+                            break;
                     }
-                    switch (item.mFontWeight)
-                    {
-                        case "Bold":
-                            newItem.mFontWeight = FontWeights.Bold;
-                            break;
-
-                        case "Normal":
-                            newItem.mFontWeight = FontWeights.Normal;
-                            break;
+                    switch (item.mFontWeight)
+                    {
+                        case "Bold":
+                            newItem.mFontWeight = FontWeights.Bold;
+                            break;
+
+                        case "Normal":
+                            newItem.mFontWeight = FontWeights.Normal;
+                            break;
                     }
                     newItem.mFontSize = item.mFontSize;
-                    newItem.mFontFamily = new FontFamily(item.mFontFamily);
-
-                    cacheTempList.Add(newItem);
+                    newItem.mFontFamily = new FontFamily(item.mFontFamily);
+
+                    cacheTempList.Add(newItem);
                 }
                 //foreach (var item in Settings.Default.PresetFontList)
                 //{
@@ -110,11 +205,11 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             if (list == null) return;
 
             if (Settings.Default.PresetFontList == null)
-                Settings.Default.PresetFontList = new PresetFontList();
-
-            if (Settings.Default.PreinstallFontList == null)
-                Settings.Default.PreinstallFontList = new PreinstallFontList();
-
+                Settings.Default.PresetFontList = new PresetFontList();
+
+            if (Settings.Default.PreinstallFontList == null)
+                Settings.Default.PreinstallFontList = new PreinstallFontList();
+
             bool isCanSave = false;
             List<PresetFontItem> TempLists = new List<PresetFontItem>();
 
@@ -133,26 +228,26 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
                     {
                         isCanSave = true;
                         var index = Settings.Default.PreinstallFontList.FindIndex(temp => temp.mTag == cacheItem.mTag);
-                        if (index != -1)
-                        {
-                            Settings.Default.PreinstallFontList.Remove(cacheItem);
-
-                            var newItem1 = new PreinstallItem();
-                            newItem1.mTag = item.mTag;
-                            newItem1.mTagContent = item.mTagContent;
-                            newItem1.mFontStyle = item.mFontStyle.ToString();
-                            newItem1.mFontWeight = item.mFontWeight.ToString();
-                            newItem1.mFontSize = item.mFontSize;
-                            newItem1.mFontFamily = item.mFontFamily.Source;
-                            Settings.Default.PreinstallFontList.Insert(index, newItem1);
+                        if (index != -1)
+                        {
+                            Settings.Default.PreinstallFontList.Remove(cacheItem);
+
+                            var newItem1 = new PreinstallItem();
+                            newItem1.mTag = item.mTag;
+                            newItem1.mTagContent = item.mTagContent;
+                            newItem1.mFontStyle = item.mFontStyle.ToString();
+                            newItem1.mFontWeight = item.mFontWeight.ToString();
+                            newItem1.mFontSize = item.mFontSize;
+                            newItem1.mFontFamily = item.mFontFamily.Source;
+                            Settings.Default.PreinstallFontList.Insert(index, newItem1);
                         }
-                        //cacheItem.mFontFamily = new FontFamily(item.mFontFamily.Source);
-                        //cacheItem.mFontSize = item.mFontSize;
-                        //cacheItem.mFontStyle = item.mFontStyle;
-                        //cacheItem.mFontWeight = item.mFontWeight;
-
+                        //cacheItem.mFontFamily = new FontFamily(item.mFontFamily.Source);
+                        //cacheItem.mFontSize = item.mFontSize;
+                        //cacheItem.mFontStyle = item.mFontStyle;
+                        //cacheItem.mFontWeight = item.mFontWeight;
+
                         break;
-                    }
+                    }
                 }
                 //else
                 //{
@@ -166,7 +261,71 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             //}
 
             if (isCanSave)
-                Settings.Default.Save();
+                Settings.Default.Save();
+        }
+
+        public static void SavePresetEditFontList(List<PresetFontItem> list)
+        {
+            if (list == null) return;
+
+            if (Settings.Default.PresetEditFontList == null)
+                Settings.Default.PresetEditFontList = new PresetEditFontList();
+
+            if (Settings.Default.PreinstallEditFontList == null)
+                Settings.Default.PreinstallEditFontList = new PreinstallEditFontList();
+
+            bool isCanSave = false;
+            List<PresetFontItem> TempLists = new List<PresetFontItem>();
+
+            foreach (var item in list)
+            {
+                //根据预设标题 ,找到 相对应数据
+                var cacheItem = Settings.Default.PreinstallEditFontList.FirstOrDefault(temp => temp.mTag == item.mTag);
+                if (cacheItem != null)
+                {
+                    //比对数据,如果不一样 ,更新数据
+                    if (cacheItem.mFontFamily != item.mFontFamily.Source ||
+                       cacheItem.mFontSize != item.mFontSize ||
+                       cacheItem.mFontStyle != item.mFontStyle.ToString() ||
+                       cacheItem.mFontWeight != item.mFontWeight.ToString()
+                        )
+                    {
+                        isCanSave = true;
+                        var index = Settings.Default.PreinstallEditFontList.FindIndex(temp => temp.mTag == cacheItem.mTag);
+                        if (index != -1)
+                        {
+                            Settings.Default.PreinstallEditFontList.Remove(cacheItem);
+
+                            var newItem1 = new PreinstallItem();
+                            newItem1.mTag = item.mTag;
+                            newItem1.mTagContent = item.mTagContent;
+                            newItem1.mFontStyle = item.mFontStyle.ToString();
+                            newItem1.mFontWeight = item.mFontWeight.ToString();
+                            newItem1.mFontSize = item.mFontSize;
+                            newItem1.mFontFamily = item.mFontFamily.Source;
+                            Settings.Default.PreinstallEditFontList.Insert(index, newItem1);
+                        }
+                        //cacheItem.mFontFamily = new FontFamily(item.mFontFamily.Source);
+                        //cacheItem.mFontSize = item.mFontSize;
+                        //cacheItem.mFontStyle = item.mFontStyle;
+                        //cacheItem.mFontWeight = item.mFontWeight;
+
+                        break;
+                    }
+                }
+                //else
+                //{
+                //    TempLists.Add(item);
+                //}
+            }
+
+            //foreach (var itemTemp in TempLists)
+            //{
+            //    Settings.Default.PresetFontList.Add(itemTemp);
+            //}
+
+            if (isCanSave)
+                Settings.Default.Save();
         }
 
         public static void BackDefaultPresetFontStyle(string tag)
@@ -211,25 +370,25 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             custom.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_Customize");
 
             custom.mFontSize = 24;
-            custom.mFontFamily = new FontFamily("Helvetica");
+            custom.mFontFamily = new FontFamily("Arial");
             custom.mFontStyle = FontStyles.Normal;
             custom.mFontWeight = FontWeights.Normal;
 
             PresetFontItem h1 = new PresetFontItem();
             h1.mTag = "H1";
-            h1.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_H1Title");
-
+            h1.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_H1Title");
+
             h1.mFontSize = 36;
-            h1.mFontFamily = new FontFamily("Helvetica");
+            h1.mFontFamily = new FontFamily("Arial");
             h1.mFontStyle = FontStyles.Normal;
             h1.mFontWeight = FontWeights.Bold;
 
             PresetFontItem h2 = new PresetFontItem();
             h2.mTag = "H2";
-            h2.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_H2Title");
-
+            h2.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_H2Title");
+
             h2.mFontSize = 24;
-            h2.mFontFamily = new FontFamily("Helvetica");
+            h2.mFontFamily = new FontFamily("Arial");
             h2.mFontStyle = FontStyles.Normal;
             h2.mFontWeight = FontWeights.Bold;
 
@@ -238,7 +397,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             h3.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_H3Title");
 
             h3.mFontSize = 18;
-            h3.mFontFamily = new FontFamily("Helvetica");
+            h3.mFontFamily = new FontFamily("Arial");
             h3.mFontStyle = FontStyles.Normal;
             h3.mFontWeight = FontWeights.Bold;
 
@@ -247,7 +406,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             b1.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_B1NormalTextStandard");
 
             b1.mFontSize = 14;
-            b1.mFontFamily = new FontFamily("Helvetica");
+            b1.mFontFamily = new FontFamily("Arial");
             b1.mFontStyle = FontStyles.Normal;
             b1.mFontWeight = FontWeights.Regular;
 
@@ -256,7 +415,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             b2.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_B2NormalTextSmall");
 
             b2.mFontSize = 12;
-            b2.mFontFamily = new FontFamily("Helvetica");
+            b2.mFontFamily = new FontFamily("Arial");
             b2.mFontStyle = FontStyles.Normal;
             b2.mFontWeight = FontWeights.Regular;
 
@@ -265,7 +424,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             b3.mTagContent = App.MainPageLoader.GetString("PresetTextStyle_B3Description");
 
             b3.mFontSize = 11;
-            b3.mFontFamily = new FontFamily("Helvetica");
+            b3.mFontFamily = new FontFamily("Arial");
             b3.mFontStyle = FontStyles.Normal;
             b3.mFontWeight = FontWeights.Regular;
 
@@ -293,59 +452,99 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             FontStyleItems.Add(item);
 
             return FontStyleItems;
-        }
-
-        internal static List<ComboDataItem> GetFontSize()
-        {
-            var FontSizeItems = new List<ComboDataItem>();
-            ComboDataItem item = new ComboDataItem(8);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(9);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(10);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(11);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(12);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(14);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(16);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(18);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(20);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(22);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(24);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(26);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(28);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(36);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(48);
-            FontSizeItems.Add(item);
-            item = new ComboDataItem(72);
-            FontSizeItems.Add(item);
-            return FontSizeItems;
-        }
+        }
+
+        internal static List<ComboDataItem> GetFontSize()
+        {
+            var FontSizeItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem(8);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(9);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(10);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(11);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(12);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(14);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(16);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(18);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(20);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(22);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(24);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(26);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(28);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(36);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(48);
+            FontSizeItems.Add(item);
+            item = new ComboDataItem(72);
+            FontSizeItems.Add(item);
+            return FontSizeItems;
+        }
 
         public static List<ComboDataItem> GetFamily()
         {
             var FontFamilyItems = new List<ComboDataItem>();
             ComboDataItem item = new ComboDataItem("Courier", "Courier New");
             FontFamilyItems.Add(item);
-            item = new ComboDataItem("Helvetica", "Helvetica");
+            item = new ComboDataItem("Arial", "Arial");
             FontFamilyItems.Add(item);
             item = new ComboDataItem(/*"Times-Roman"*/"Times", "Times New Roman");
             FontFamilyItems.Add(item);
+            return FontFamilyItems;
+        }
 
+        public static List<ComboDataItem> GetFamilyEdit()
+        {
+            System.Drawing.Text.InstalledFontCollection objFont = new System.Drawing.Text.InstalledFontCollection();
+            var FontFamilyItems = new List<ComboDataItem>();
+            ComboDataItem item;
+
+            foreach (var itemFam in EditHelper.GetFontFamily())
+            {
+                string content = itemFam;
+                if (itemFam.Equals("Informal"))
+                {
+                    content = "Informal Roman";
+                }
+                //屏蔽 SDK暂时无效的字体
+                if (itemFam.Equals("Marlett") || itemFam.Equals("MT Extra")
+                 || itemFam.Equals("Symbol") || itemFam.Equals("HoloLens MDL2 Assets")
+                 || itemFam.Equals("Wingdings") || itemFam.Equals("Wingdings 2")
+                 || itemFam.Equals("Wingdings 3") || itemFam.Equals("Webdings")
+                 || itemFam.Equals("ZWAdobeF") || itemFam.Equals("Algerian")
+                 || itemFam.Equals("Bookshelf Symbol 7") || itemFam.Equals("Castellar")
+                 || itemFam.Equals("MS Outlook") || itemFam.Equals("MS Reference Specialty")
+                 || itemFam.Equals("Segoe Fluent Icons") || itemFam.Equals("Segoe MDL2 Assets")
+                 || itemFam.Equals("Stencil"))
+                {
+                    continue;
+                }
+                item = new ComboDataItem(DeleteCharacters(itemFam), content);
+                item.FontFamily = new FontFamily(content);
+                FontFamilyItems.Add(item);
+            }
             return FontFamilyItems;
         }
 
+        public static string DeleteCharacters(string str)
+        {
+            str = str.Replace(" ", string.Empty);
+            str = str.Replace("-", string.Empty);
+            str = str.Replace("_", string.Empty);
+            return str;
+        }
+
         public static List<ComboDataItem> GetDateFormats()
         {
             var dateFormatItems = new List<ComboDataItem>();
@@ -389,6 +588,6 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             TimesItems.Add("yy-MM-dd");
             TimesItems.Add("yyyy-MM-dd");
             return TimesItems;
-        }
+        }
     }
 }

+ 24 - 0
PDF Office/MultilingualResources/PDF Office.en.xlf

@@ -3520,6 +3520,30 @@ Some functions may not work, please restart or re-download PDF Reader Pro from o
           <source>Save Failed</source>
           <target state="new">Save Failed</target>
         </trans-unit>
+        <trans-unit id="OCR_CancelDownload" translate="yes" xml:space="preserve">
+          <source>Cancel</source>
+          <target state="new">Cancel</target>
+        </trans-unit>
+        <trans-unit id="OCR_Download" translate="yes" xml:space="preserve">
+          <source>Download</source>
+          <target state="new">Download</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadError" translate="yes" xml:space="preserve">
+          <source>Download failed</source>
+          <target state="new">Download failed</target>
+        </trans-unit>
+        <trans-unit id="OCR_Downloading" translate="yes" xml:space="preserve">
+          <source>Downloading OCR, please wait...</source>
+          <target state="new">Downloading OCR, please wait...</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadRedownload" translate="yes" xml:space="preserve">
+          <source>Redownload</source>
+          <target state="new">Redownload</target>
+        </trans-unit>
+        <trans-unit id="OCR_PleaseDownload" translate="yes" xml:space="preserve">
+          <source>Please download OCR component first</source>
+          <target state="new">Please download OCR component first</target>
+        </trans-unit>
       </group>
     </body>
   </file>

+ 24 - 0
PDF Office/MultilingualResources/PDF Office.zh-Hans.xlf

@@ -3520,6 +3520,30 @@ Some functions may not work, please restart or re-download PDF Reader Pro from o
           <source>Save Failed</source>
           <target state="new">Save Failed</target>
         </trans-unit>
+        <trans-unit id="OCR_CancelDownload" translate="yes" xml:space="preserve">
+          <source>Cancel</source>
+          <target state="new">Cancel</target>
+        </trans-unit>
+        <trans-unit id="OCR_Download" translate="yes" xml:space="preserve">
+          <source>Download</source>
+          <target state="new">Download</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadError" translate="yes" xml:space="preserve">
+          <source>Download failed</source>
+          <target state="new">Download failed</target>
+        </trans-unit>
+        <trans-unit id="OCR_Downloading" translate="yes" xml:space="preserve">
+          <source>Downloading OCR, please wait...</source>
+          <target state="new">Downloading OCR, please wait...</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadRedownload" translate="yes" xml:space="preserve">
+          <source>Redownload</source>
+          <target state="new">Redownload</target>
+        </trans-unit>
+        <trans-unit id="OCR_PleaseDownload" translate="yes" xml:space="preserve">
+          <source>Please download OCR component first</source>
+          <target state="new">Please download OCR component first</target>
+        </trans-unit>
       </group>
     </body>
   </file>

+ 24 - 0
PDF Office/MultilingualResources/PDF Office.zh-Hant.xlf

@@ -3520,6 +3520,30 @@ Some functions may not work, please restart or re-download PDF Reader Pro from o
           <source>Save Failed</source>
           <target state="new">Save Failed</target>
         </trans-unit>
+        <trans-unit id="OCR_CancelDownload" translate="yes" xml:space="preserve">
+          <source>Cancel</source>
+          <target state="new">Cancel</target>
+        </trans-unit>
+        <trans-unit id="OCR_Download" translate="yes" xml:space="preserve">
+          <source>Download</source>
+          <target state="new">Download</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadError" translate="yes" xml:space="preserve">
+          <source>Download failed</source>
+          <target state="new">Download failed</target>
+        </trans-unit>
+        <trans-unit id="OCR_Downloading" translate="yes" xml:space="preserve">
+          <source>Downloading OCR, please wait...</source>
+          <target state="new">Downloading OCR, please wait...</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadRedownload" translate="yes" xml:space="preserve">
+          <source>Redownload</source>
+          <target state="new">Redownload</target>
+        </trans-unit>
+        <trans-unit id="OCR_PleaseDownload" translate="yes" xml:space="preserve">
+          <source>Please download OCR component first</source>
+          <target state="new">Please download OCR component first</target>
+        </trans-unit>
       </group>
     </body>
   </file>

+ 13 - 1
PDF Office/PDF Master.csproj

@@ -398,10 +398,12 @@
     <Compile Include="Helper\ConverterHelper.cs" />
     <Compile Include="Helper\CropPageUndoManager.cs" />
     <Compile Include="Helper\DataTrackingHelper.cs" />
+    <Compile Include="Helper\EditHelper.cs" />
     <Compile Include="Helper\ErrorCodeHelper.cs" />
     <Compile Include="Helper\FileComparisonHelper.cs" />
     <Compile Include="Helper\GlobalCommands.cs" />
     <Compile Include="Helper\KeyEventsHelper.cs" />
+    <Compile Include="Helper\PDFEditHelper.cs" />
     <Compile Include="Helper\Win32Helper.cs" />
     <Compile Include="Helper\DpiHelpers.cs" />
     <Compile Include="Helper\EditToolsHelper.cs" />
@@ -424,6 +426,7 @@
     <Compile Include="Model\AnnotPanel\AnnotColorList.cs" />
     <Compile Include="Model\AnnotPanel\AnnotCommon.cs" />
     <Compile Include="Model\AnnotPanel\FontBoard.cs" />
+    <Compile Include="Model\AnnotPanel\FontBoardVm.cs" />
     <Compile Include="Model\AnnotPanel\Signature.cs" />
     <Compile Include="Model\BOTA\AnnotationHandlerEventArgs.cs" />
     <Compile Include="Model\AnnotPanel\Stamp.cs" />
@@ -488,7 +491,7 @@
     <Compile Include="Model\PageEdit\PageSizeInfo.cs" />
     <Compile Include="Model\ParameterNames.cs" />
     <Compile Include="Model\PDFTool\ToolItem.cs" />
-    <Compile Include="Model\PropertyPanel\AnnotPanel\FontStyleItem.cs" />
+    <Compile Include="Model\PropertyPanel\AnnotPanel\TextFont.cs" />
     <Compile Include="Model\RegionNames.cs" />
     <Compile Include="CustomControl\SystemControl\TabablzRegionBehavior.cs" />
     <Compile Include="DataConvert\BoolToVisible.cs" />
@@ -638,6 +641,7 @@
     <Compile Include="ViewModels\PropertyPanel\PDFEdit\ImageTextEditPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\PDFEdit\PDFEditVM.cs" />
     <Compile Include="ViewModels\PropertyPanel\PDFEdit\TextEditPropertyViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\PropertyPanelContentEditViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\Scan\ScanPropertyPanelViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\ViewModular\ReadViewContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\RecentFiles\RecentFilesContentViewModel.cs" />
@@ -1261,6 +1265,9 @@
     <Compile Include="Views\PropertyPanel\PropertyPanelContent.xaml.cs">
       <DependentUpon>PropertyPanelContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\PropertyPanel\PropertyPanelContentEdit.xaml.cs">
+      <DependentUpon>PropertyPanelContentEdit.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\PropertyPanel\Scan\ScanPropertyPanel.xaml.cs">
       <DependentUpon>ScanPropertyPanel.xaml</DependentUpon>
     </Compile>
@@ -2161,6 +2168,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\PropertyPanel\PropertyPanelContentEdit.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\PropertyPanel\Scan\ScanPropertyPanel.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -2406,6 +2417,7 @@
     <Resource Include="Resources\Service\IAPTop.png" />
     <Resource Include="Resources\HomeIcon\noScanner.png" />
     <Resource Include="Resources\PropertyPanel\no link.png" />
+    <Resource Include="Resources\PropertyPanel\addimage.png" />
     <Content Include="Resources\Service\Login.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>

+ 1 - 1
PDF Office/PDF Master.csproj.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
-    <ProjectView>ShowAllFiles</ProjectView>
+    <ProjectView>ProjectFiles</ProjectView>
   </PropertyGroup>
 </Project>

+ 2 - 2
PDF Office/Properties/AssemblyInfo.cs

@@ -52,5 +52,5 @@ using System.Windows;
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
 //通过使用 "*",如下所示:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.0.0")]
-[assembly: AssemblyFileVersion("1.2.0.0")]
+[assembly: AssemblyVersion("1.3.0.0")]
+[assembly: AssemblyFileVersion("1.3.0.0")]

+ 37 - 4
PDF Office/Properties/Settings.Designer.cs

@@ -12,7 +12,7 @@ namespace PDF_Master.Properties {
     
     
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")]
     internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
         
         private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -295,6 +295,17 @@ namespace PDF_Master.Properties {
             }
         }
         
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        public global::PDFSettings.PreinstallFontList PreinstallFontList {
+            get {
+                return ((global::PDFSettings.PreinstallFontList)(this["PreinstallFontList"]));
+            }
+            set {
+                this["PreinstallFontList"] = value;
+            }
+        }
+        
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
         public global::PDFSettings.PDFEditList PDFEditList {
@@ -308,12 +319,34 @@ namespace PDF_Master.Properties {
         
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        public global::PDFSettings.PreinstallFontList PreinstallFontList {
+        public global::PDFSettings.DefaultEditProperties DefaultEditProperties {
             get {
-                return ((global::PDFSettings.PreinstallFontList)(this["PreinstallFontList"]));
+                return ((global::PDFSettings.DefaultEditProperties)(this["DefaultEditProperties"]));
             }
             set {
-                this["PreinstallFontList"] = value;
+                this["DefaultEditProperties"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        public global::PDFSettings.PresetEditFontList PresetEditFontList {
+            get {
+                return ((global::PDFSettings.PresetEditFontList)(this["PresetEditFontList"]));
+            }
+            set {
+                this["PresetEditFontList"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        public global::PDFSettings.PreinstallEditFontList PreinstallEditFontList {
+            get {
+                return ((global::PDFSettings.PreinstallEditFontList)(this["PreinstallEditFontList"]));
+            }
+            set {
+                this["PreinstallEditFontList"] = value;
             }
         }
     }

+ 9 - 0
PDF Office/Properties/Settings.settings

@@ -80,5 +80,14 @@
     <Setting Name="PDFEditList" Type="PDFSettings.PDFEditList" Scope="User">
       <Value Profile="(Default)" />
     </Setting>
+    <Setting Name="DefaultEditProperties" Type="PDFSettings.DefaultEditProperties" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
+    <Setting Name="PresetEditFontList" Type="PDFSettings.PresetEditFontList" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
+    <Setting Name="PreinstallEditFontList" Type="PDFSettings.PreinstallEditFontList" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
   </Settings>
 </SettingsFile>

BIN
PDF Office/Resources/GuidItems/GuidItem1.png


BIN
PDF Office/Resources/GuidItems/GuidItem2.png


BIN
PDF Office/Resources/GuidItems/GuidItem3.png


BIN
PDF Office/Resources/GuidItems/GuidItem4.png


BIN
PDF Office/Resources/GuidItems/GuidItem5.png


BIN
PDF Office/Resources/GuidItems/GuidItem6.png


BIN
PDF Office/Resources/GuidPDF/Quick Start Guide.pdf


BIN
PDF Office/Resources/PropertyPanel/addimage.png


+ 55 - 1
PDF Office/Strings/MainPage/MainPage.Designer.cs

@@ -19,7 +19,7 @@ namespace PDF_Master.Strings.MainPage {
     // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
     // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
     // (以 /str 作为命令选项),或重新生成 VS 项目。
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     public class MainPage {
@@ -1417,6 +1417,60 @@ namespace PDF_Master.Strings.MainPage {
             }
         }
         
+        /// <summary>
+        ///   查找类似 Cancel 的本地化字符串。
+        /// </summary>
+        public static string OCR_CancelDownload {
+            get {
+                return ResourceManager.GetString("OCR_CancelDownload", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Download 的本地化字符串。
+        /// </summary>
+        public static string OCR_Download {
+            get {
+                return ResourceManager.GetString("OCR_Download", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Download failed 的本地化字符串。
+        /// </summary>
+        public static string OCR_DownloadError {
+            get {
+                return ResourceManager.GetString("OCR_DownloadError", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Downloading OCR, please wait... 的本地化字符串。
+        /// </summary>
+        public static string OCR_Downloading {
+            get {
+                return ResourceManager.GetString("OCR_Downloading", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Redownload 的本地化字符串。
+        /// </summary>
+        public static string OCR_DownloadRedownload {
+            get {
+                return ResourceManager.GetString("OCR_DownloadRedownload", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Please download OCR component first 的本地化字符串。
+        /// </summary>
+        public static string OCR_PleaseDownload {
+            get {
+                return ResourceManager.GetString("OCR_PleaseDownload", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   查找类似 Opacity 的本地化字符串。
         /// </summary>

+ 18 - 0
PDF Office/Strings/MainPage/MainPage.resx

@@ -611,6 +611,24 @@ You can also add files or folders via the lower left button.</value>
   <data name="NoPrinter_Warning" xml:space="preserve">
     <value>Printer busy or error</value>
   </data>
+  <data name="OCR_CancelDownload" xml:space="preserve">
+    <value>Cancel</value>
+  </data>
+  <data name="OCR_Download" xml:space="preserve">
+    <value>Download</value>
+  </data>
+  <data name="OCR_DownloadError" xml:space="preserve">
+    <value>Download failed</value>
+  </data>
+  <data name="OCR_Downloading" xml:space="preserve">
+    <value>Downloading OCR, please wait...</value>
+  </data>
+  <data name="OCR_DownloadRedownload" xml:space="preserve">
+    <value>Redownload</value>
+  </data>
+  <data name="OCR_PleaseDownload" xml:space="preserve">
+    <value>Please download OCR component first</value>
+  </data>
   <data name="Opacity_Title" xml:space="preserve">
     <value>Opacity</value>
     <comment>点击水滴按钮打开的透明度弹窗标题</comment>

+ 1 - 0
PDF Office/Styles/ListViewStyle.xaml

@@ -404,6 +404,7 @@
     </Style>
 
     <Style x:Key="ListBoxItemGraySelectStyle" TargetType="{x:Type ListBoxItem}">
+        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
         <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
         <Setter Property="Panel.Background" Value="{StaticResource color.sys.layout.mg}" />
         <Setter Property="Border.BorderBrush" Value="{StaticResource color.sys.layout.mg}" />

+ 4 - 5
PDF Office/Styles/OutLineItemStyle.xaml

@@ -96,13 +96,13 @@
                             BorderThickness="{TemplateBinding BorderThickness}"
                             CornerRadius="4"
                             SnapsToDevicePixels="True">
-                            <Grid >
+                            <Grid>
 
                                 <DockPanel x:Name="PART_DockPanel" LastChildFill="True">
                                     <ToggleButton
+                                        x:Name="Expander"
                                         Margin="0,0,0,0"
                                         VerticalAlignment="Top"
-                                        x:Name="Expander"
                                         ClickMode="Press"
                                         IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
                                         Style="{StaticResource ExpandCollapseToggleStyle}" />
@@ -159,9 +159,9 @@
                         <MultiTrigger>
                             <MultiTrigger.Conditions>
                                 <Condition Property="IsSelected" Value="True" />
-                                <Condition Property="IsSelectionActive" Value="False" />
+                                <Condition Property="IsSelectionActive" Value="True" />
                             </MultiTrigger.Conditions>
-                            <Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
+                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
                             <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}" />
                         </MultiTrigger>
                     </ControlTemplate.Triggers>
@@ -181,7 +181,6 @@
         </Style.Triggers>
     </Style>
 
-
     <SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3" />
     <SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA" />
     <SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5" />

+ 46 - 31
PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs

@@ -302,7 +302,9 @@ namespace PDF_Master.ViewModels.BOTA
         private bool IsFirst = true;
         private bool isHiddenAnnot = false;
 
-        //判断是否为属性修改进入,属性修改,改变后不让再次其选中注释
+        /// <summary>
+        /// 判断是否为属性修改进入,属性修改,改变后不让再次其选中注释
+        /// </summary>
         public bool IsModified = true;
 
         public AnnotationContentViewModel(IRegionManager regionManager, IDialogService dialogService, IEventAggregator eventAggregator)
@@ -1082,7 +1084,7 @@ namespace PDF_Master.ViewModels.BOTA
             }
         }
 
-        public async void ScrollToAnnot(int pageindex, int annotindex, ListBox AnnotationList)
+        public void ScrollToAnnot(int pageindex, int annotindex, ListBox AnnotationList)
         {
             //var list = PdfViewer.GetAnnotCommentList(pageindex, PdfViewer.Document);
             for (int i = 0; i < AnnotationList.Items.Count; i++)
@@ -1094,16 +1096,22 @@ namespace PDF_Master.ViewModels.BOTA
                         //var item = AnnotationList.Items[i] as AnnotationHandlerEventArgs;
                         if (item.EventType != AnnotArgsType.AnnotLink)
                         {
+                            #region 失败率比较高 当数据多的时候
+
                             //需要手动搜寻在哪一个分组 展开分组头
-                            ExpandGroupHeader(item, AnnotationList);
-                            if (AnnotationList.SelectedItems.IndexOf(item) == -1)
-                            {
-                                AnnotationList.SelectedItem = item;
-                            }
+                            //ExpandGroupHeader(item, AnnotationList);
+                            //if (AnnotationList.SelectedItems.IndexOf(item) == -1)
+                            //{
+                            //    AnnotationList.SelectedItem = item;
+
+                            //    await Task.Delay(5);
+
+                            //    AnnotationList.ScrollIntoView(item);
+                            //}
 
-                            await Task.Delay(5);
-                            AnnotationList.ScrollIntoView(item);
-                            //events.GetEvent<RefreshAnnotationEvent>().Publish(new RefreshAnnotationArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, IsAll = false, IsSelect = true, annotHandlerArgs = item });
+                            #endregion 失败率比较高 当数据多的时候
+
+                            events.GetEvent<RefreshAnnotationEvent>().Publish(new RefreshAnnotationArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, IsAll = false, IsSelect = true, annotHandlerArgs = item, IsExpand = false });
                         }
                     }
                 }
@@ -1127,6 +1135,17 @@ namespace PDF_Master.ViewModels.BOTA
             if (obj is AnnotationHandlerEventArgs annotation)
             {
                 ViewContentViewModel.mainViewModel.AnnotMouseLeftButtonDown = true;
+                if (PdfViewer.GetSelectAnnotCount() == 1)
+                {
+                    List<AnnotHandlerEventArgs> annotationHandlers = PdfViewer.GetSelectionAnnots();
+
+                    var result = annotationHandlers.FindAll(x => x.PageIndex == annotation.PageIndex && x.AnnotIndex == annotation.AnnotIndex);
+                    if (result != null && result.Count > 0)
+                    {
+                        return;
+                    }
+                }
+
                 PdfViewer.SelectAnnotation(annotation.PageIndex, annotation.AnnotIndex);
             }
             else
@@ -1139,7 +1158,7 @@ namespace PDF_Master.ViewModels.BOTA
             }
         }
 
-        public async void UpdateAddedAnnot(int pageIndex, int annotIndex)
+        public async void UpdateAddedAnnot(BOTAContent bOTAContent, int pageIndex, int annotIndex)
         {
             var annots = PdfViewer.GetAnnotCommentList(pageIndex, PdfViewer.Document);
             for (int i = 0; i < annots.Count; i++)
@@ -1173,19 +1192,10 @@ namespace PDF_Master.ViewModels.BOTA
                         }
                         //ExpandGroupHeader(args, listBox);
                         // 关闭后选中关闭前的位置
-                        if (ViewContentViewModel.OpenBOTA)
+                        if (ViewContentViewModel.OpenBOTA && bOTAContent.TabItemAnnotation.IsSelected)
                         {
-                            //await Task.Delay(5);//不加延时 会有不滚动的现象
-
-                            //events.GetEvent<ScrollIntoAnnotViewEvent>().Publish(new ScrollIntoAnnotViewArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, Annotation = item });
-                            //listBox.ScrollIntoView(args);
                             events.GetEvent<RefreshAnnotationEvent>().Publish(new RefreshAnnotationArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, IsAll = false, annotHandlerArgs = args });
-                        }
-                        //if (!listBox.SelectedItems.Contains(args))
-                        //{
-                        //    listBox.SelectedItem = args;
-                        //    //PdfViewer.SelectAnnotation(args.PageIndex, args.AnnotIndex);
-                        //}
+                        }
                     }
                 }
             }
@@ -1386,14 +1396,17 @@ namespace PDF_Master.ViewModels.BOTA
                         {
                             var scroller = GetScrollHost(listBox);
                             var stackpanel = CommonHelper.FindVisualChild<StackPanel>(scroller);
-                            int count = VisualTreeHelper.GetChildrenCount(stackpanel);
-                            var groupItem = VisualTreeHelper.GetChild(stackpanel, i) as GroupItem;
-                            var g = CommonHelper.FindVisualChild<Expander>(groupItem);
-                            if (g != null)
+                            if (stackpanel != null)
                             {
-                                await Task.Delay(5);
-                                g.IsExpanded = true;
-                            }
+                                int count = VisualTreeHelper.GetChildrenCount(stackpanel);
+                                var groupItem = VisualTreeHelper.GetChild(stackpanel, i) as GroupItem;
+                                var g = CommonHelper.FindVisualChild<Expander>(groupItem);
+                                if (g != null)
+                                {
+                                    await Task.Delay(5);
+                                    g.IsExpanded = true;
+                                }
+                            }
                         }
                     }
                 }
@@ -1458,8 +1471,9 @@ namespace PDF_Master.ViewModels.BOTA
                 iCollectionView.SortDescriptions.Add(new SortDescription(nameof(AnnotationHandlerEventArgs.PageIndex), ListSortDirection.Ascending));
                 iCollectionView.SortDescriptions.Add(new SortDescription(nameof(AnnotationHandlerEventArgs.AnnotIndex), ListSortDirection.Ascending));
 
+                //Load会触发 重复触发,暂时注释
                 //按照PageIndex,分组 排序
-                SetGroupHeader(listBox);
+                //SetGroupHeader(listBox);
                 Screen = Visibility.Collapsed;
                 colors.Clear();
                 authors.Clear();
@@ -1497,7 +1511,8 @@ namespace PDF_Master.ViewModels.BOTA
                     {
                         return;
                     }
-                    listBox.SelectedItems.Clear();
+                    //Windows:BOTA列表,移除Esc取消选中逻辑
+                    //listBox.SelectedItems.Clear();
                 }
             }
             if (KeyEventsHelper.IsSingleKey(System.Windows.Input.Key.Delete))

+ 16 - 0
PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs

@@ -15,6 +15,9 @@ using PDF_Master.Views.PageEdit;
 using PDF_Master.Properties;
 using PDF_Master.Helper;
 using PDFReader_WPF.Helper;
+using System.Drawing;
+using PDF_Master.Views.BOTA;
+using ImTools;
 
 namespace PDF_Master.ViewModels.BOTA
 {
@@ -138,6 +141,7 @@ namespace PDF_Master.ViewModels.BOTA
                 }
             }
         }
+
         /// <summary>
         /// 侧边按钮埋点
         /// </summary>
@@ -153,17 +157,21 @@ namespace PDF_Master.ViewModels.BOTA
                 case "TabItemThumbnail":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.LeftSideBar, "LeftSideBar_Btn", "Btn_LeftSideBar_Thumbnail");
                     break;
+
                 case "TabItemBookMark":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.LeftSideBar, "LeftSideBar_Btn", "Btn_LeftSideBar_BookMark");
                     break;
+
                 case "TabItemAnnotation":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.LeftSideBar, "LeftSideBar_Btn", "Btn_LeftSideBar_Annotation");
                     break;
+
                 case "TabItemSearch":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.LeftSideBar, "LeftSideBar_Btn", "Btn_LeftSideBar_Search");
                     break;
             }
         }
+
         private void InitString()
         {
             Tip_Annote = App.MainPageLoader.GetString("ViewTopToolbar_Annotation");
@@ -208,6 +216,13 @@ namespace PDF_Master.ViewModels.BOTA
                 if (viewNameByTabItem.ContainsKey(currentBar))
                 {
                     regions.RequestNavigate(BOTAContentRegionName, viewNameByTabItem[currentBar], param);
+
+                    var views = regions.Regions[BOTAContentRegionName].Views;
+                    var search = views.FindFirst(x => x is SearchContent);
+                    if (search is SearchContent searchContent)
+                    {
+                        viewContentViewModel.SearchTextFocus(searchContent);
+                    }
                 }
 
                 //增加判空逻辑
@@ -249,6 +264,7 @@ namespace PDF_Master.ViewModels.BOTA
         }
 
         #region Navigate
+
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;

+ 2 - 1
PDF Office/ViewModels/BOTA/SearchContentViewModel.cs

@@ -313,9 +313,10 @@ namespace PDF_Master.ViewModels.BOTA
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             //切换到缩略图等模块时,需要清空搜索结果显示
-            if (SearchItemList.Count>0)
+            if (SearchItemList.Count > 0)
             {
                 PDFViewer.ClearPageSelectText();
+                SearchItemList.Clear();
             }
             return;
         }

+ 50 - 3
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterExcelDialogViewModel.cs

@@ -1,6 +1,8 @@
 using ComDocumentAIKit;
+using ComPDFKit_Conversion.Converter;
 using ComPDFKit_Conversion.Options;
 using ComPDFKitViewer.PdfViewer;
+using ImageMagick;
 using Microsoft.Office.Interop.Excel;
 using PDF_Master.CustomControl;
 using PDF_Master.Helper;
@@ -337,11 +339,13 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
         public DelegateCommand BatchConverterCommand { get; set; }
 
         public DelegateCommand<object> PreviewCancelDownCommand { get; set; }
-       
+
         public DelegateCommand SetCustomPageRangeCommand { get; set; }
 
         public DelegateCommand UnlockMouseDownCommand { get; set; }
 
+        public DelegateCommand OpenOCRCommand { get; set; }
+
         #endregion
 
         public ConverterExcelDialogViewModel(IDialogService dialogService)
@@ -356,11 +360,53 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             PreviewCancelDownCommand = new DelegateCommand<object>(PreviewCancelDown);
             BatchConverterCommand = new DelegateCommand(BatchConverter);
             UnlockMouseDownCommand = new DelegateCommand(UnlockMouseDown);
-
+            OpenOCRCommand = new DelegateCommand(openOCR);
             dialogs = dialogService;
         }
         #region 逻辑函数
 
+        private void openOCR()
+        {
+            if (OCRCheckBoxIsCheckBox == true)
+            {
+                bool folderMD5 = FileComparisonHelper.OCRModelItExist();
+                if (folderMD5)
+                {
+                    string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                    CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                    CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                }
+                else
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                     alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
+                    if (alertsMessage.result == ContentResult.Ok)
+                    {
+                        FileComparisonHelper.RemoveOCRModel();
+                        DialogParameters oCRDownloadProgress = new DialogParameters();
+                        dialogs.ShowDialog(DialogNames.OCRDownloadProgress, oCRDownloadProgress, e =>
+                        {
+
+                            if (e.Result == Prism.Services.Dialogs.ButtonResult.OK)
+                            {
+                                string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                                CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                                CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                            }
+                            else
+                            {
+                                OCRCheckBoxIsCheckBox = false;
+                            }
+                        });
+                    }
+                    else
+                    {
+                        OCRCheckBoxIsCheckBox = false;
+                    }
+                }
+            }
+        }
+
         public void SetCustomPageRange()
         {
             if (PageRangeSelectIndex == CheckPageSelect["4"])
@@ -664,7 +710,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
 
         private void SelectLanguage(int SelectedIndex)
         {
-       
+
             switch (SelectedIndex)
             {
                 case 0:
@@ -718,6 +764,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 48 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterHTMLDialogViewModel.cs

@@ -1,4 +1,5 @@
 using ComDocumentAIKit;
+using ComPDFKit_Conversion.Converter;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Master.CustomControl;
 using PDF_Master.Helper;
@@ -165,6 +166,8 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
         public DelegateCommand BatchConverterCommand { get; set; }
 
         public DelegateCommand UnlockMouseDownCommand { get; set; }
+
+        public DelegateCommand OpenOCRCommand { get; set; }
         #endregion
 
         public ConverterHTMLDialogViewModel(IDialogService dialogService)
@@ -178,10 +181,54 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             PreviewCancelDownCommand = new DelegateCommand<object>(PreviewCancelDown);
             BatchConverterCommand = new DelegateCommand(BatchConverter);
             UnlockMouseDownCommand = new DelegateCommand(UnlockMouseDown);
+            OpenOCRCommand = new DelegateCommand(openOCR);
             dialogs = dialogService;
 
         }
         #region 逻辑函数
+
+        private void openOCR()
+        {
+            if (OCRCheckBoxIsCheckBox == true)
+            {
+                bool folderMD5 = FileComparisonHelper.OCRModelItExist();
+                if (folderMD5)
+                {
+                    string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                    CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                    CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                }
+                else
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                     alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
+                    if (alertsMessage.result == ContentResult.Ok)
+                    {
+                        FileComparisonHelper.RemoveOCRModel();
+                        DialogParameters oCRDownloadProgress = new DialogParameters();
+                        dialogs.ShowDialog(DialogNames.OCRDownloadProgress, oCRDownloadProgress, e =>
+                        {
+
+                            if (e.Result == Prism.Services.Dialogs.ButtonResult.OK)
+                            {
+                                string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                                CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                                CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                            }
+                            else
+                            {
+                                OCRCheckBoxIsCheckBox = false;
+                            }
+                        });
+                    }
+                    else
+                    {
+                        OCRCheckBoxIsCheckBox = false;
+                    }
+                }
+            }
+        }
+
         public void SetCustomPageRange()
         {
             if (PageRangeSelectIndex == "4")
@@ -475,6 +522,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 48 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterPPTDialogViewModel.cs

@@ -1,5 +1,7 @@
 using ComDocumentAIKit;
+using ComPDFKit_Conversion.Converter;
 using ComPDFKitViewer.PdfViewer;
+using ImageMagick;
 using PDF_Master.CustomControl;
 using PDF_Master.Helper;
 using PDF_Master.Model;
@@ -193,6 +195,8 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
         public DelegateCommand BatchConverterCommand { get; set; }
 
         public DelegateCommand UnlockMouseDownCommand { get; set; }
+
+        public DelegateCommand OpenOCRCommand { get; set; }
         #endregion
 
         public ConverterPPTDialogViewModel(IDialogService dialogService)
@@ -205,11 +209,54 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             PreviewCancelDownCommand = new DelegateCommand<object>(PreviewCancelDown);
             BatchConverterCommand = new DelegateCommand(BatchConverter);
             UnlockMouseDownCommand = new DelegateCommand(UnlockMouseDown);
+            OpenOCRCommand = new DelegateCommand(openOCR);
             dialogs = dialogService;
             IntString();
         }
         #region 逻辑函数
 
+        private void openOCR()
+        {
+            if (OCRCheckBoxIsCheckBox == true)
+            {
+                bool folderMD5 = FileComparisonHelper.OCRModelItExist();
+                if (folderMD5)
+                {
+                    string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                    CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                    CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                }
+                else
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                     alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
+                    if (alertsMessage.result == ContentResult.Ok)
+                    {
+                        FileComparisonHelper.RemoveOCRModel();
+                        DialogParameters oCRDownloadProgress = new DialogParameters();
+                        dialogs.ShowDialog(DialogNames.OCRDownloadProgress, oCRDownloadProgress, e =>
+                        {
+
+                            if (e.Result == Prism.Services.Dialogs.ButtonResult.OK)
+                            {
+                                string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                                CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                                CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                            }
+                            else
+                            {
+                                OCRCheckBoxIsCheckBox = false;
+                            }
+                        });
+                    }
+                    else
+                    {
+                        OCRCheckBoxIsCheckBox = false;
+                    }
+                }
+            }
+        }
+
         public void SetCustomPageRange()
         {
             if (PageRangeSelectIndex == CheckPageSelect["4"])
@@ -504,6 +551,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 48 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterRTFDialogViewModel.cs

@@ -1,4 +1,5 @@
 using ComDocumentAIKit;
+using ComPDFKit_Conversion.Converter;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Master.CustomControl;
 using PDF_Master.Helper;
@@ -165,6 +166,8 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
         public DelegateCommand BatchConverterCommand { get; set; }
 
         public DelegateCommand UnlockMouseDownCommand { get; set; }
+
+        public DelegateCommand OpenOCRCommand { get; set; }
         #endregion
 
         public ConverterRTFDialogViewModel(IDialogService dialogService)
@@ -177,11 +180,55 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             PreviewCancelDownCommand = new DelegateCommand<object>(PreviewCancelDown);
             BatchConverterCommand = new DelegateCommand(BatchConverter);
             UnlockMouseDownCommand = new DelegateCommand(UnlockMouseDown);
+            OpenOCRCommand = new DelegateCommand(openOCR);
             dialogs = dialogService;
             IntString();
         }
 
         #region 逻辑函数
+
+        private void openOCR()
+        {
+            if (OCRCheckBoxIsCheckBox == true)
+            {
+                bool folderMD5 = FileComparisonHelper.OCRModelItExist();
+                if (folderMD5)
+                {
+                    string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                    CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                    CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                }
+                else
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                     alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
+                    if (alertsMessage.result == ContentResult.Ok)
+                    {
+                        FileComparisonHelper.RemoveOCRModel();
+                        DialogParameters oCRDownloadProgress = new DialogParameters();
+                        dialogs.ShowDialog(DialogNames.OCRDownloadProgress, oCRDownloadProgress, e =>
+                        {
+
+                            if (e.Result == Prism.Services.Dialogs.ButtonResult.OK)
+                            {
+                                string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                                CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                                CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                            }
+                            else
+                            {
+                                OCRCheckBoxIsCheckBox = false;
+                            }
+                        });
+                    }
+                    else
+                    {
+                        OCRCheckBoxIsCheckBox = false;
+                    }
+                }
+            }
+        }
+
         public void SetCustomPageRange()
         {
             if (PageRangeSelectIndex == "4")
@@ -473,6 +520,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 53 - 3
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterTextDialogViewModel.cs

@@ -1,4 +1,5 @@
 using ComDocumentAIKit;
+using ComPDFKit_Conversion.Converter;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Master.CustomControl;
 using PDF_Master.Helper;
@@ -167,6 +168,8 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
         public DelegateCommand BatchConverterCommand { get; set; }
 
         public DelegateCommand UnlockMouseDownCommand { get; set; }
+
+        public DelegateCommand OpenOCRCommand { get; set; }
         #endregion
 
         public ConverterTextDialogViewModel(IDialogService dialogService)
@@ -180,9 +183,55 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             PreviewCancelDownCommand = new DelegateCommand<object>(PreviewCancelDown);
             BatchConverterCommand = new DelegateCommand(BatchConverter);
             UnlockMouseDownCommand = new DelegateCommand(UnlockMouseDown);
+            OpenOCRCommand = new DelegateCommand(openOCR);
             dialogs = dialogService;
         }
         #region 逻辑函数
+
+        private void openOCR()
+        {
+            if (OCRCheckBoxIsCheckBox == true)
+            {
+                bool folderMD5 = FileComparisonHelper.OCRModelItExist();
+                if (folderMD5)
+                {
+                    string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                    CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                    CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                }
+                else
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                     alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
+                    if (alertsMessage.result == ContentResult.Ok)
+                    {
+                        FileComparisonHelper.RemoveOCRModel();
+                        DialogParameters oCRDownloadProgress = new DialogParameters();
+                        dialogs.ShowDialog(DialogNames.OCRDownloadProgress, oCRDownloadProgress, e =>
+                        {
+
+                            if (e.Result == Prism.Services.Dialogs.ButtonResult.OK)
+                            {
+                                string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                                CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                                CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                            }
+                            else
+                            {
+                                OCRCheckBoxIsCheckBox = false;
+                            }
+                        });
+                    }
+                    else
+                    {
+                        OCRCheckBoxIsCheckBox = false;
+                    }
+                }
+
+            }
+
+        }
+
         public void SetCustomPageRange()
         {
             if (PageRangeSelectIndex == "4")
@@ -224,7 +273,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             }
         }
 
-        private  void converter()
+        private void converter()
         {
             if (PageRangeSelectIndex == "4")
             {
@@ -282,7 +331,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             {
                 return;
             }
-            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref ConverterTextModel.PageRange, PageRangeText,true, CurrentPageIndex);
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref ConverterTextModel.PageRange, PageRangeText, true, CurrentPageIndex);
             if (ConverterTextModel.PageRange == "")
             {
                 Trace.WriteLine("输入不对");
@@ -468,11 +517,12 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 if (currentViewer.Tag != null) { ConverterTextModel.Pawssword = currentViewer.Tag.ToString(); }
                 ConverterTextModel.InputPath = pdfViewer.Document.FilePath;
                 FileInfo fileinfo = new FileInfo(ConverterTextModel.InputPath);
-                ConverterTextModel.OutputPath=fileinfo.DirectoryName;
+                ConverterTextModel.OutputPath = fileinfo.DirectoryName;
                 if (Settings.Default.UserDate.subscribestatus != 1)
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 55 - 6
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterWordDialogViewModel.cs

@@ -2,6 +2,7 @@
 using ComPDFKit_Conversion.Converter;
 using ComPDFKit_Conversion.Options;
 using ComPDFKitViewer.PdfViewer;
+using ImageMagick;
 using PDF_Master.CustomControl;
 using PDF_Master.EventAggregators;
 using PDF_Master.Helper;
@@ -15,6 +16,7 @@ using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Globalization;
 using System.IO;
 using System.Linq;
 using System.Windows;
@@ -125,9 +127,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             set
             {
                 SetProperty(ref oCRCheckBoxIsCheckBox, value);
-                //测试代码,到时候需要去除
-                //CPDFConverter.InitOcrLibrary(Path.Combine("C:\\Users\\kdanmobile\\Documents\\PDF Master\\ConvertAndOCRSource", "x64"));
-                //CPDFConverter.SetOCRModelPath(Path.Combine("C:\\Users\\kdanmobile\\Documents\\PDF Master\\ConvertAndOCRSource", "source", "models"));
                 ConverterWordModel.Options.IsAllowOCR = oCRCheckBoxIsCheckBox;
             }
         }
@@ -201,6 +200,8 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
 
         public DelegateCommand UnlockMouseDownCommand { get; set; }
 
+        public DelegateCommand OpenOCRCommand { get; set; }
+
         #endregion
 
         public ConverterWordDialogViewModel(IDialogService dialogService)
@@ -214,11 +215,57 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             BatchConverterCommand = new DelegateCommand(BatchConverter);
             PreviewCancelDownCommand = new DelegateCommand<object>(PreviewCancelDown);
             UnlockMouseDownCommand = new DelegateCommand(UnlockMouseDown);
+            OpenOCRCommand = new DelegateCommand(openOCR);
             dialogs = dialogService;
             IntString();
         }
         #region 逻辑函数
 
+
+        private void openOCR()
+        {
+            if (OCRCheckBoxIsCheckBox == true)
+            {
+                bool folderMD5 = FileComparisonHelper.OCRModelItExist();
+                if (folderMD5)
+                {
+                    string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                    CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                    CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                }
+                else
+                {
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                    alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
+                    if (alertsMessage.result == ContentResult.Ok)
+                    {
+                        FileComparisonHelper.RemoveOCRModel();
+                        DialogParameters oCRDownloadProgress = new DialogParameters();
+                        dialogs.ShowDialog(DialogNames.OCRDownloadProgress, oCRDownloadProgress, e =>
+                        {
+
+                            if (e.Result == Prism.Services.Dialogs.ButtonResult.OK)
+                            {
+                                string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
+                                CPDFConverter.InitOCRLibrary(Path.Combine(folderPath, "x64"));
+                                CPDFConverter.SetOCRModelPath(Path.Combine(folderPath, "source", "models"));
+                            }
+                            else
+                            {
+                                OCRCheckBoxIsCheckBox = false;
+                            }
+                        });
+                    }
+                    else
+                    {
+                        OCRCheckBoxIsCheckBox = false;
+                    }
+                }
+
+            }
+
+        }
+
         public void SetCustomPageRange()
         {
             if (PageRangeSelectIndex == CheckPageSelect["4"])
@@ -311,13 +358,14 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 ConverterWordModel.OutputPath = sfd.FileName;
-                try {if(File.Exists(ConverterWordModel.OutputPath)) File.Delete(ConverterWordModel.OutputPath); }
-                catch {
+                try { if (File.Exists(ConverterWordModel.OutputPath)) File.Delete(ConverterWordModel.OutputPath); }
+                catch
+                {
                     AlertsMessage alertsMessage = new AlertsMessage();
                     alertsMessage.ShowDialog("", App.MainPageLoader.GetString("FileNotExistWarning"), App.ServiceLoader.GetString("Text_ok"));
                     return;
                 }
-               
+
             }
             else
             {
@@ -531,6 +579,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 35 - 65
PDF Office/ViewModels/Dialog/ConverterDialogs/OCRDownloadProgressViewModel.cs

@@ -2,6 +2,7 @@
 using Microsoft.Office.Interop.Excel;
 using PDF_Master.CustomControl;
 using PDF_Master.Helper;
+using PDF_Master.Model;
 using PDF_Master.Properties;
 using PDF_Master.Strings.MainPage;
 using Prism.Commands;
@@ -72,7 +73,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             T_ProgressBarName = App.MainPageLoader.GetString("OCR_Downloading");
             T_tryAgainBtn = App.MainPageLoader.GetString("OCR_DownloadRedownload");
             T_ErrorTextBlock = App.MainPageLoader.GetString("OCR_DownloadError");
-            T_CancelBtn= App.MainPageLoader.GetString("OCR_CancelDownload");
+            T_CancelBtn = App.MainPageLoader.GetString("OCR_CancelDownload");
 
         }
 
@@ -116,11 +117,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
 
         private double currentSize;
 
-        //home 是false
-        private bool SelectHomeOrmain = false;
-
-
-        private string progressBarCurrentSizeValue="0 MB";
+        private string progressBarCurrentSizeValue = "0 MB";
 
         public string ProgressBarCurrentSizeValue
         {
@@ -131,7 +128,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             }
         }
 
-        private string progressBarFileSize="0 MB";
+        private string progressBarFileSize = "0 MB";
 
         public string ProgressBarFileSize
         {
@@ -163,11 +160,12 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
 
         public OCRDownloadProgressViewModel()
         {
-            CancelCommand= new DelegateCommand(cancel);
-            TryAgainCommnad= new DelegateCommand(tryAgain);
+            CancelCommand = new DelegateCommand(cancel);
+            TryAgainCommnad = new DelegateCommand(tryAgain);
+            SetLangText();
         }
 
-        private async void  tryAgain()
+        private async void tryAgain()
         {
             try
             {
@@ -187,6 +185,13 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
         private void cancel()
         {
             isDownloadCancelled = true;
+            if (client != null)
+            {
+                //防止退出没释放
+                client.CancelAsync();
+                client.Dispose();
+                FileComparisonHelper.RemoveOCRModel();
+            }
             RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
         }
 
@@ -200,9 +205,9 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 await Task.Run(() =>
                 {
 
-                    string folder = System.IO.Path.Combine(App.CurrentPath, "modelzip");
+                    string folder = System.IO.Path.Combine(App.CurrentPath, "OCREnginezip");
 
-                    FileNameComPDFKit = folder + "\\" + "model" + ".zip";
+                    FileNameComPDFKit = folder + "\\" + "OCREngine" + ".zip";
                     long fileSize = 0;
                     if (!Directory.Exists(folder))
                     {
@@ -250,7 +255,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             string folderPath = App.CurrentPath;
             //解压转档资源文件,intiRes
             string folderModelPath = App.CurrentPath;
-            if (!Directory.Exists(folderModelPath + "//model"))
+            if (!Directory.Exists(folderModelPath + "//OCREngine"))
             {
                 ExtractWithProgress(FileNameComPDFKit, folderModelPath);
             }
@@ -273,7 +278,14 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                         foreach (var entry in zip.Entries)
                         {
                             var extractionPath = System.IO.Path.Combine(destinationFolderPath, entry.FullName);
-
+                            string replacement = "OCREngine";
+                            //提换文件夹名字保证文件夹统一
+                            int slashIndex = entry.FullName.IndexOf('/');
+                            if (slashIndex != -1)
+                            {
+                                string modifiedString = replacement + entry.FullName.Substring(slashIndex);
+                                extractionPath = System.IO.Path.Combine(destinationFolderPath, modifiedString);
+                            }
                             if (entry.Name == "")
                             {
                                 // 处理目录的情况,例如在ZIP文件中的文件夹
@@ -303,44 +315,25 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                     {
                         ProgressBarCurrentValue = 0;
                         ProgressBarCurrentSizeValue = (currentSize * (ProgressBarCurrentValue / 100)).ToString("0.00") + " MB";
-                        string folderzipPath = System.IO.Path.Combine(App.CurrentPath, "modelzip");
+                        string folderzipPath = System.IO.Path.Combine(App.CurrentPath, "OCREnginezip");
                         if (Directory.Exists(folderzipPath))
                         {
                             Directory.Delete(folderzipPath, true);
                         }
-                        //Close();
+                        //Close()
                         if (FileComparisonHelper.OCRModelItExist())
                         {
-                            if (SelectHomeOrmain)
-                            {
-                                if (mainPage != null)
-                                {
-                                    //mainPage.ShowOCRDialog(isItemClieck);
-                                }
-
-                            }
-                            else
-                            {
-                                //新OCR弹窗
-                                //ConvertOCRNewDialog convertOCRNewDialog = new ConvertOCRNewDialog();
-                                //convertOCRNewDialog.InitBeforeShow(Pdfviewer, password);
-                                //convertOCRNewDialog.Owner = App.Current.MainWindow;
-                                //convertOCRNewDialog.ShowDialog();
-                                //ConvertOCRDialog dialog = new ConvertOCRDialog();
-                                //dialog.InitBeforeShow(Pdfviewer, password);
-                                //dialog.StartPosition = FormStartPosition.CenterScreen;
-                                //dialog.ShowDialog();
-
-                            }
+                            var dialogresult = new DialogResult(ButtonResult.OK);
+                            RequestClose.Invoke(dialogresult);
                         }
                         else
                         {
-                            string folderPath = System.IO.Path.Combine(App.CurrentPath, "model");
+                            string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
                             if (Directory.Exists(folderPath))
                             {
                                 Directory.Delete(folderPath, true);
                             }
-                            MessageBoxEx.Show("需要更新最新版的APP才能下载哦");
+                            //MessageBoxEx.Show("需要更新最新版的APP才能下载哦");
 
                         }
 
@@ -397,30 +390,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             }
         }
 
-        public bool? ShowDialog(MainPage mainPage, bool isItemClieck)
-        {
-            this.mainPage = mainPage;
-            this.isItemClieck = isItemClieck;
-            SelectHomeOrmain = true;
-            return false;
-            //return base.ShowDialog();
-        }
-
-        public bool? ShowDialog(CPDFViewer kmpdfviewer, string password)
-        {
-            Pdfviewer = kmpdfviewer;
-            this.password = password;
-            SelectHomeOrmain = false;
-            return false;
-        }
-
-        private async void Window_Loaded(object sender, RoutedEventArgs e)
-        {
-
-            await DownloadOCR();
-        }
-
-
         public event Action<IDialogResult> RequestClose;
 
         public bool CanCloseDialog()
@@ -430,11 +399,12 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
 
         public void OnDialogClosed()
         {
+
         }
 
-        public void OnDialogOpened(IDialogParameters parameters)
+        public async void OnDialogOpened(IDialogParameters parameters)
         {
-
+            await DownloadOCR();
         }
     }
 }

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

@@ -312,7 +312,7 @@ namespace PDF_Master.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 }
                 if (SecurityIsRemove)
                 {
-                    document.Descrypt(CommonHelper.CreateFilePath(saveSelectedPath + document.FileName  + "_Remove.pdf"));
+                    document.Decrypt(CommonHelper.CreateFilePath(saveSelectedPath + document.FileName  + "_Remove.pdf"));
 
                 }
                 else

+ 89 - 42
PDF Office/ViewModels/Dialog/ToolsDialogs/MergeDialogViewModel.cs

@@ -33,15 +33,17 @@ using static PDF_Master.Model.Dialog.ToolsDialogs.SaftyDialogs.DeleteSafetySetti
 
 namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
 {
-    class MergeDialogViewModel : BindableBase, IDialogAware
+    internal class MergeDialogViewModel : BindableBase, IDialogAware
     {
         // Fix:存储当前程序加载的文档的路径和tag,
         //如果路径相同则用tag里的密码解锁,
         //解锁失败再另行提权
         private string CurrentFilePath = string.Empty;
+
         private string currentLoadedPassword = string.Empty;
-        private IEventAggregator eventAggregator;
-        enum PageSizeType
+        private IEventAggregator eventAggregator;
+
+        private enum PageSizeType
         {
             kDefault = 0,
             A4 = 1,
@@ -63,8 +65,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
         }
 
         public void OnDialogClosed()
-        {
-
+        {
         }
 
         public void OnDialogOpened(IDialogParameters parameters)
@@ -112,7 +113,8 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
             }
         }
 
-        #endregion
+        #endregion 框架内容
+
         #region 定义与初始化
 
         public ObservableCollection<MergeObject> MergeObjectlist { get; set; }
@@ -143,6 +145,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
         }
 
         private Visibility processVisible = Visibility.Collapsed;
+
         /// <summary>
         /// 是否显示进度条
         /// </summary>
@@ -156,6 +159,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
         }
 
         private bool _AddOpenFileIsEn = false;
+
         /// <summary>
         /// 添加已打开文件是否置灰
         /// </summary>
@@ -167,6 +171,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                 SetProperty(ref _AddOpenFileIsEn, value);
             }
         }
+
         private string inputHeight;
 
         public string InputHeight
@@ -179,6 +184,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
         }
 
         private double maxValue;
+
         /// <summary>
         /// 最大文件数 用于显示进度条
         /// </summary>
@@ -204,15 +210,18 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                 SetProperty(ref currentvalue, value);
             }
         }
-       /// <summary>
-       /// 订阅按钮
-       /// </summary>
+
+        /// <summary>
+        /// 订阅按钮
+        /// </summary>
         private string _TextUpgrade;
+
         public string TextUpgrade
         {
             get { return _TextUpgrade; }
             set { _TextUpgrade = value; }
         }
+
         /// <summary>
         /// 是否显示限制字段
         /// </summary>
@@ -231,9 +240,8 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
         /// 是否取消添加文件
         /// </summary>
 
-        private bool CancelAddFiles = false;
-
-
+        private bool CancelAddFiles = false;
+
         public MergeDialogViewModel(IDialogService dialogService, IEventAggregator eventAggregator)
         {
             IntString();
@@ -249,6 +257,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
             CancelAddFileCommand = new DelegateCommand(CancelAddFileOpention);
             UnlockMouseDownCommand = new DelegateCommand(UnlockMouseDown);
         }
+
         /// <summary>
         /// 多语
         /// </summary>
@@ -257,14 +266,15 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
             TextUpgrade = App.ServiceLoader.GetString("TextUpgrade");
         }
 
-        #endregion
+        #endregion 定义与初始化
 
         #region 私有方法
 
         private void UnlockMouseDown()
         {
             ConverterHelper.convertUnlock();
-        }
+        }
+
         private void CancelAddFileOpention()
         {
             CancelAddFiles = true;
@@ -284,6 +294,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
             Clear();
             RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
         }
+
         /// <summary>
         /// 点击取消页面范围控件使失去焦点不生效
         /// </summary>
@@ -307,6 +318,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                 }
             }
         }
+
         public void ButtonAddFiles(object data)
         {
             int index = Convert.ToInt32(data);
@@ -316,11 +328,13 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                 case 0:
                     //打开文件
                     AddFiles(OpenFile());
-                    break;
+                    break;
+
                 case 1:
                     //打开文件夹
                     AddFiles(OpenFileFolder());
-                    break;
+                    break;
+
                 case 2:
                     //打开当前文件
                     List<string> list = new List<string>();
@@ -330,7 +344,8 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                         list.Add(App.OpenedFileList[i]);
                     }
                     AddFiles(list.ToArray());
-                    break;
+                    break;
+
                 default:
                     break;
             }
@@ -342,7 +357,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
         private void AddOpenFileIsEnChange()
         {
             AddOpenFileIsEn = false;
-            if (MergeObjectlist.Count> App.OpenedFileList.Count)
+            if (MergeObjectlist.Count > App.OpenedFileList.Count)
             {
                 AddOpenFileIsEn = true;
                 return;
@@ -365,9 +380,8 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                     break;
                 }
             }
-        }
-
-
+        }
+
         private string[] OpenFileFolder()
         {
             System.Windows.Forms.FolderBrowserDialog openFile = new System.Windows.Forms.FolderBrowserDialog();
@@ -395,7 +409,8 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
             }
 
             return list.ToArray();
-        }
+        }
+
         private string[] OpenFile()
         {
             OpenFileDialog openFile = new OpenFileDialog();
@@ -410,7 +425,6 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
 
         private void Merge()
         {
-
             bool result = true;
             CPDFDocument SaveDoc = CPDFDocument.CreateDocument();
             int sum = MergeObjectlist.Count;
@@ -423,7 +437,8 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                 List<int> listnum = new List<int>();
                 if (MergeObjectlist[i].SetPageRange == null || MergeObjectlist[i].SetPageRange.Count == 0)
                 {
-                    if (MergeObjectlist[i].SDKPageCount == 0) {
+                    if (MergeObjectlist[i].SDKPageCount == 0)
+                    {
                         AlertsMessage alertsMessage = new AlertsMessage();
                         alertsMessage.ShowDialog("", App.MainPageLoader.GetString("PageRangeWarning"), App.ServiceLoader.GetString("Text_ok"));
                         return;
@@ -434,7 +449,6 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                         pageRangeList.Add(page1);
                     }
                     MergeObjectlist[i].SetPageRange = pageRangeList;
-                   
                 }
             }
 
@@ -474,8 +488,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                         catch
                         {
                             continue;
-                        }
-
+                        }
                     }
                     else
                     {
@@ -554,24 +567,29 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
             switch (pageSizeType)
             {
                 case PageSizeType.kDefault:
-                    break;
+                    break;
+
                 case PageSizeType.A4:
 
                     rect.Width = CommonHelper.GetPageSizeFomrUnit(210);
                     rect.Height = CommonHelper.GetPageSizeFomrUnit(297);
-                    break;
+                    break;
+
                 case PageSizeType.A3:
                     rect.Width = CommonHelper.GetPageSizeFomrUnit(297);
                     rect.Height = CommonHelper.GetPageSizeFomrUnit(420);
-                    break;
+                    break;
+
                 case PageSizeType.Letter:
                     rect.Width = CommonHelper.GetPageSizeFomrUnit(216);
                     rect.Height = CommonHelper.GetPageSizeFomrUnit(279);
-                    break;
+                    break;
+
                 case PageSizeType.Legal:
                     rect.Width = CommonHelper.GetPageSizeFomrUnit(216);
                     rect.Height = CommonHelper.GetPageSizeFomrUnit(356);
-                    break;
+                    break;
+
                 case PageSizeType.Customized:
                     if (!string.IsNullOrEmpty(InputWidth) && !string.IsNullOrEmpty(InputHeight))
                     {
@@ -583,7 +601,8 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                         rect.Width = CommonHelper.GetPageSizeFomrUnit(595);
                         rect.Height = CommonHelper.GetPageSizeFomrUnit(841);
                     }
-                    break;
+                    break;
+
                 default:
                     break;
             }
@@ -619,7 +638,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
             }
         }
 
-        #endregion
+        #endregion 私有方法
 
         #region 公开方法
 
@@ -660,9 +679,18 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
             {
                 return;
             }
+            // 免费用户 限制只选两个文件的逻辑
+            //if (Settings.Default.UserDate.subscribestatus != 1 && MergeObjectlist.Count >= 2)
+            //{
+            //    return;
+            //}
             bool showDialog = false;
             ProcessVisible = Visibility.Visible;
             MaxValue = FilePath.Length;
+
+            // 免费用户 限制只选两个文件的逻辑
+            //int sum = SetFilesLength(FilePath);
+
             for (int i = 0; i < FilePath.Length; i++)
             {
                 //加入异步语句,防止UI卡死,显示加载进度条
@@ -763,7 +791,6 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                     }
                     else
                     {
-
                         VerifyPasswordResult condition = new VerifyPasswordResult();
                         App.Current.Dispatcher.Invoke(() =>
                         {
@@ -777,7 +804,6 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                                 mergeObject.Password = condition.Password;
                                 if (doc.UnlockWithPassword(condition.Password) && doc.CheckOwnerPassword(condition.Password))
                                 {
-
                                 }
                             }
                         }
@@ -786,8 +812,6 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                             doc.Release();
                             continue;
                         }
-
-
                     }
 
                     mergeObject.DocName = doc.FileName;
@@ -803,7 +827,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                         mergeObject.IsEvenPageIsEnabled = false;
                     }
                     mergeObject.SDKPageCount = doc.PageCount;
-                    
+
                     mergeObject.DocSize = CommonHelper.GetFileSize(mergeObject.FilePath);
 
                     //获取第一页缩略图
@@ -836,7 +860,30 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                 {
                 }
             }
-        }
-        #endregion
+        }
+
+        /// <summary>
+        ///  未购买的用户 设置文件数量
+        /// </summary>
+        /// <param name="filePath"></param>
+        /// <returns></returns>
+        private int SetFilesLength(string[] filePath)
+        {
+            int sum = filePath.Length;
+            if (Settings.Default.UserDate.subscribestatus != 1 && sum >= 2)
+            {
+                if (MergeObjectlist.Count >= 1)
+                {
+                    sum = 1;
+                }
+                else
+                {
+                    sum = 2;
+                }
+            }
+            return sum;
+        }
+
+        #endregion 公开方法
     }
-}
+}

+ 9 - 1
PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs

@@ -1865,7 +1865,15 @@ namespace PDF_Master.ViewModels.PageEdit
         /// </summary>
         private void clearSelected()
         {
-            ListSelectedIndex = -1;
+            //缩略图不支持esc取消选中;
+            if (IsBOTAThumb == Visibility.Visible)
+            {
+                return;
+            }
+            else
+            {
+                ListSelectedIndex = -1;
+            }
         }
 
         /// <summary>

+ 77 - 66
PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageEditPropertyViewModel.cs

@@ -28,15 +28,16 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
     {
         public TextEditToolContentViewModel TextEditToolContentViewModel;
         private IEventAggregator events;
+
         /// <summary>
         /// 用于区分事件的唯一码
         /// </summary>
         private string unicode;
+
         #region 快捷键
+
         private void ShortCut_KeyDown(object sender, KeyEventArgs e)
         {
-
-
             if (e.Key == Key.Escape)
             {
                 if (PDFViewer != null)
@@ -44,33 +45,34 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                     if (PDFViewer.ToolManager != null && IsCrop == true)
                     {
                         CancelCropImg();
-
-                    } 
-                   
+                    }
                 }
             }
-            else if(e.Key==Key.Enter)
+            else if (e.Key == Key.Enter)
             {
                 CropImg();
             }
-
-
         }
 
+        #endregion 快捷键
 
-        #endregion
         #region 属性和变量
+
         //防止自动保存属性值
         private bool isCanSave = false;
-        public event EventHandler ClearCheckedAglin;
 
+        public event EventHandler ClearCheckedAglin;
 
         #region 是否为多选内容
+
         private bool _isMultiSelectImage = false;
-        public bool IsMultiSelectImage { get { return _isMultiSelectImage; } set { SetProperty(ref _isMultiSelectImage, value); } }
-        #endregion
-       
-       private string _opacity1= "Opacity";
+        public bool IsMultiSelectImage
+        { get { return _isMultiSelectImage; } set { SetProperty(ref _isMultiSelectImage, value); } }
+
+        #endregion 是否为多选内容
+
+        private string _opacity1 = "Opacity";
+
         public string Opacity
         {
             get { return _opacity1; }
@@ -79,30 +81,34 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 
         //不透明度
         private double _opacity;
+
         public double OpacityUI
         {
             get { return _opacity; }
             set { SetProperty(ref _opacity, value); }
         }
+
         private int _OpacitySelectedIndex = 1;
+
         public int OpacitySelectedIndex
         {
             get { return _OpacitySelectedIndex; }
             set { SetProperty(ref _OpacitySelectedIndex, value); }
         }
+
         private double _transpent;
+
         public double Transpent
         {
             get { return _transpent; }
             set
             {
                 SetProperty(ref _transpent, value);
-                if (Transpent == 100|| Transpent == 75||Transpent == 50|| (Transpent == 25))
+                if (Transpent == 100 || Transpent == 75 || Transpent == 50 || (Transpent == 25))
                 {
                     TextEditEvent.Transparency = (int)((_transpent * 255) / 100.0);
                     TextEditEvent.UpdatePDFEditByEventArgs();
                     OpacityUI = _transpent / 100.0;
-                  
                 }
                 else
                 {
@@ -110,11 +116,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 }
             }
         }
+
         //是否为图片裁剪状态
         private bool _isCrop = false;
-        public bool IsCrop { get { return _isCrop; } set { SetProperty(ref _isCrop, value); } }
-        public  TextEditToolContentViewModel _viewModel1;
 
+        public bool IsCrop
+        { get { return _isCrop; } set { SetProperty(ref _isCrop, value); } }
+        public TextEditToolContentViewModel _viewModel1;
 
         //public ImageEditPropertyViewModel(TextEditToolContentViewModel viewModel1)
         //{
@@ -122,16 +130,15 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
         //    _viewModel1.PropertyChanged += OnViewModel1PropertyChanged;
         //}
 
-     
         private void OnViewModel1PropertyChanged(object sender, PropertyChangedEventArgs e)
         {
             if (e.PropertyName == "flg")
             {
                 IsCrop = _viewModel1.flg;
             }
-            if(e.PropertyName== "ReplaceImgflg")
+            if (e.PropertyName == "ReplaceImgflg")
             {
-                if(_viewModel1.ReplaceImgflg==true)
+                if (_viewModel1.ReplaceImgflg == true)
                 {
                     ReplaceImg();
                     _viewModel1.ReplaceImgflg = false;
@@ -157,18 +164,23 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 
         //选中的图像
         private System.Windows.Media.Imaging.BitmapSource _currentImg;
-        public System.Windows.Media.Imaging.BitmapSource CurrentImg { get { return _currentImg; } set { SetProperty(ref _currentImg, value); } }
 
+        public System.Windows.Media.Imaging.BitmapSource CurrentImg
+        { get { return _currentImg; } set { SetProperty(ref _currentImg, value); } }
 
-        #endregion
+        #endregion 属性和变量
 
         #region Command
+
         //替换
         public DelegateCommand ReplaceImgCommand { get; set; }
+
         //导出
         public DelegateCommand ExportImgCommand { get; set; }
+
         //裁剪
         public DelegateCommand CropImgCommand { get; set; }
+
         //对齐
         public DelegateCommand<object> ImgAlignCheckedCommand { get; set; }
 
@@ -183,16 +195,19 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 
         //上下翻转
         public DelegateCommand UpsidedownCommand { get; set; }
+
         //裁剪状态
         public DelegateCommand CropModeCommand { get; set; }
+
         //取消裁剪状态
         public DelegateCommand CancelCropCommand { get; set; }
 
         //还原裁剪状态
         public DelegateCommand RestoreCropCommand { get; set; }
-       
+
         //添加文本
         public DelegateCommand AddTextCommand { get; set; }
+
         //添加图片
         public DelegateCommand AddImgCommand { get; set; }
 
@@ -200,7 +215,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
         public DelegateCommand TranspentslidCommand { get; set; }
 
         public DelegateCommand EditImgModeCommand { get; set; }
-        #endregion
+
+        #endregion Command
 
         public ImageEditPropertyViewModel(IEventAggregator eventAggregator)
         {
@@ -208,16 +224,16 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             events = eventAggregator;
             unicode = App.mainWindowViewModel.SelectedItem.Unicode;
         }
+
         private void InitCommand()
         {
-
             AddTextCommand = new DelegateCommand(AddText);
             AddImgCommand = new DelegateCommand(AddImg);
             ReplaceImgCommand = new DelegateCommand(ReplaceImg);
             ExportImgCommand = new DelegateCommand(ExportImg);
             CropImgCommand = new DelegateCommand(CropImg);
             ImgAlignCheckedCommand = new DelegateCommand<object>(ImgAlignChecked);
-            TranspentslidCommand = new DelegateCommand(Transpentslid);           
+            TranspentslidCommand = new DelegateCommand(Transpentslid);
             AntiClockwiseCommand = new DelegateCommand(AntiClockwise);
             ClockwiseCommand = new DelegateCommand(Clockwise);
             FlipleftrightCommand = new DelegateCommand(Flipleftright);
@@ -225,14 +241,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             CropModeCommand = new DelegateCommand(CropMode);
             CancelCropCommand = new DelegateCommand(CancelCropImg);
             RestoreCropCommand = new DelegateCommand(RestoreCropImg);
-            EditImgModeCommand = new DelegateCommand(EditImgMode);      
+            EditImgModeCommand = new DelegateCommand(EditImgMode);
         }
 
         #region Command实现
-     
 
         //不透明度滑动左键松开
-       private void Transpentslid()
+        private void Transpentslid()
         {
             if (TextEditEvent != null && isCanSave)
             {
@@ -247,19 +262,17 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 }
                 else
                 {
-                    TextEditEvent.Transparency = (int)((_transpent * 255)/100.0);
+                    TextEditEvent.Transparency = (int)((_transpent * 255) / 100.0);
                     TextEditEvent.UpdatePDFEditByEventArgs();
                     OpacityUI = _transpent / 100.0;
                     TextEditEvent.SaveClip();
                 }
- 
             }
         }
 
         //点击编辑按钮,暂时保留
         private void EditImgMode()
         {
-
         }
 
         //添加文本模式
@@ -284,6 +297,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 }
             }
         }
+
         /// <summary>
         /// 压缩
         /// </summary>
@@ -339,7 +353,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             }
         }
 
-
         /// <summary>
         ///  根据图片数据判断图片类型
         /// </summary>
@@ -363,7 +376,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 }
                 catch
                 {
-
                     extension = FileExtension.VALIDFILE;
                 }
                 return extension;
@@ -382,7 +394,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             }
         }
 
-
         //进入裁剪模式
         private void CropMode()
         {
@@ -471,20 +482,18 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                     TextEditEvent.ReplaceImagePath = openFileDialog.FileName;
                     TextEditEvent.UpdatePDFEditByEventArgs();
                     ReplaceimgTask();
-                    Transpent =100;
+                    Transpent = 100;
                 }
-            }       
+            }
         }
 
         //此处只有异步 ReplaceimgTask()才有作用
         private async void ReplaceimgTask()
         {
-            await Task.Delay(100);
+            await Task.Delay(10);
             GetImagePreView();
-
         }
 
-
         //顺时针旋转
         private void Clockwise()
         {
@@ -509,9 +518,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
         private void Upsidedown()
         {
             TextEditEvent.VerticalMirror = true;
-           
+
             TextEditEvent.UpdatePDFEditByEventArgs();
-              GetImagePreView();
+            GetImagePreView();
         }
 
         //旋转逻辑
@@ -533,9 +542,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             }
         }
 
-        #endregion
+        #endregion Command实现
 
         #region 布局处理
+
         private void ImgAlignChecked(object obj)
         {
             if (obj != null)
@@ -545,36 +555,44 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                     case "AlignLeft":
                         PDFViewer.SetPDFEditAligment(AlignModes.AlignLeft);
                         break;
+
                     case "AlignHorizonCenter":
                         PDFViewer.SetPDFEditAligment(AlignModes.AlignHorizonCenter);
                         break;
+
                     case "AlignRight":
                         PDFViewer.SetPDFEditAligment(AlignModes.AlignRight);
                         break;
+
                     case "DistributeHorizontal":
                         PDFViewer.SetPDFEditAligment(AlignModes.DistributeHorizontal);
                         break;
+
                     case "AlignTop":
                         PDFViewer.SetPDFEditAligment(AlignModes.AlignTop);
                         break;
+
                     case "AlignVerticalCenter":
                         PDFViewer.SetPDFEditAligment(AlignModes.AlignVerticalCenter);
                         break;
+
                     case "AlignBottom":
                         PDFViewer.SetPDFEditAligment(AlignModes.AlignBottom);
                         break;
+
                     case "DistributeVertical":
                         PDFViewer.SetPDFEditAligment(AlignModes.DistributeVertical);
                         break;
                 }
-
             }
         }
-        #endregion
+
+        #endregion 布局处理
+
         protected List<PDFEditEvent> TextEditEventList;
+
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
-
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<List<PDFEditEvent>>(ParameterNames.AnnotEvent, out TextEditEventList);
             navigationContext.Parameters.TryGetValue<TextEditToolContentViewModel>(ParameterNames.TextEditToolContentViewModel, out TextEditToolContentViewModel);
@@ -598,14 +616,12 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 
         private void PDFViewer_LostFocus(object sender, RoutedEventArgs e)
         {
-
             TextEditEvent.ClipImage = false;
             TextEditEvent.CancelClip();
             TextEditEvent.UpdatePDFEditByEventArgs();
             IsCrop = false;
         }
 
-
         //获取图片参数
         private void LoadedPDFEdit()
         {
@@ -643,9 +659,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             }
         }
 
-
-
         #region 右键菜单
+
         //点击空白处时
         private ContextMenu EmptyStateMenu(object sender)
         {
@@ -660,6 +675,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 
             return popMenu;
         }
+
         //选中图像时
         private ContextMenu SelectImgPDFEdit(object sender)
         {
@@ -697,6 +713,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             customMenu.SetMenuBinding(2, RestoreCropCommand);
             return popMenu;
         }
+
         //多选图片右键
         private ContextMenu SelectMoreImage(object sender)
         {
@@ -713,17 +730,16 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             //导出
             customMenu.SetMenuBinding(4, ExportImgCommand);
 
-
             return popMenu;
-        } 
-        #endregion
+        }
 
+        #endregion 右键菜单
 
         //左键点击逻辑
         private void PDFViewer_PDFEditActiveHandler(object sender, List<PDFEditEvent> e)
         {
             //退出编辑模式
-               IsCrop = false;
+            IsCrop = false;
             TextEditEvent.ClipImage = false;
             TextEditEvent.UpdatePDFEditByEventArgs();
         }
@@ -731,7 +747,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
         //右键逻辑
         private void PDFViewer_PDFEditCommandHandler(object sender, PDFEditCommand e)
         {
-            
             if (e == null)
                 return;
 
@@ -748,21 +763,19 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                     //    {
                     //        e.PopupMenu = SelectImgPDFEdit(sender);
                     //    }
-                        
+
                     //}
-                    //else 
+                    //else
                     if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.None)
                     {
                         e.PopupMenu = EmptyStateMenu(sender);
-
                     }
-           
+
                     break;
 
                 default:
                     e.DoCommand();
                     break;
-
             }
             if (e.PopupMenu != null)
             {
@@ -796,17 +809,15 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                         CurrentImg = bitmapSource;
                         events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
                     }
-
                 }
             }
             catch
             {
-
             }
-         
         }
-        public bool IsNavigationTarget(NavigationContext navigationContext) { return true; }
 
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        { return true; }
 
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
@@ -820,4 +831,4 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             PDFViewer.LostFocus -= PDFViewer_LostFocus;
         }
     }
-}
+}

+ 207 - 113
PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs

@@ -1,4 +1,5 @@
-using ComPDFKitViewer;
+using ComPDFKit.PDFPage;
+using ComPDFKitViewer;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using Microsoft.Win32;
@@ -7,6 +8,7 @@ using PDF_Master.Helper;
 using PDF_Master.Model;
 using PDF_Master.Model.AnnotPanel;
 using PDF_Master.Model.PropertyPanel.AnnotPanel;
+using PDF_Master.Properties;
 using PDF_Master.ViewModels.Tools.AnnotManager;
 using PDFSettings;
 using Prism.Commands;
@@ -14,6 +16,7 @@ using Prism.Mvvm;
 using Prism.Regions;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -21,30 +24,35 @@ using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
+using static Dropbox.Api.Files.WriteMode;
 
 namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 {
-
     public class TextEditPropertyViewModel : PDFEditVM, INavigationAware
     {
-
         #region 属性
+
         public event EventHandler ClearCheckedAglin;
+
         public TextEditPropertyViewModel()
         {
             InitVariable();
             InitCommand();
         }
+
         private void InitVariable()
         {
             InitBaseVariable();
         }
+
         private bool isSelectedEmpty;
+
         public bool IsSelectedEmpty
         {
             get { return isSelectedEmpty; }
             set { SetProperty(ref isSelectedEmpty, value); }
         }
+
         private string title;
 
         public string Title
@@ -55,6 +63,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 SetProperty(ref title, value);
             }
         }
+
         private FontBoardVm _fontVm = new FontBoardVm(true);
 
         public FontBoardVm FontVm
@@ -63,17 +72,18 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             set { SetProperty(ref _fontVm, value); }
         }
 
-
         private ComPDFKit.PDFPage.Edit.TextAlignType _textAlign;
+
         public ComPDFKit.PDFPage.Edit.TextAlignType TextAlign
         {
             get { return _textAlign; }
             set { _textAlign = value; }
         }
-        #endregion
+
+        #endregion 属性
+
         #region Command
 
-     
         public DelegateCommand AddTextCommand { get; set; }
         public DelegateCommand AddImgCommand { get; set; }
 
@@ -83,8 +93,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
         public DelegateCommand<object> FontSizeChangedCommand { get; set; }
 
         public DelegateCommand<object> TextAlignCheckedCommand { get; set; }
+
         //进入属性面板编辑
         public DelegateCommand EditTextModeCommand { get; set; }
+
         public DelegateCommand FontFamilyChangedCommand { get; set; }
         public DelegateCommand CustomFontStyleCommand { get; set; }
         public DelegateCommand FontStyleWeightChangedCommand { get; set; }
@@ -92,14 +104,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 
         //重定义
         public DelegateCommand ReDefineFontStyleCommand { get; set; }
+
         public DelegateCommand RestoreDefaultStyleCommand { get; set; }
         public DelegateCommand<object> LayoutAlignCheckedCommand { get; set; }
-        
 
-        #endregion
+        #endregion Command
 
         #region 初始化
-      
 
         private void InitCommand()
         {
@@ -133,7 +144,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             LayoutAlignCheckedCommand = new DelegateCommand<object>(LayoutAlignChecked);
         }
 
-        #endregion
+        #endregion 初始化
 
         #region 文本处理逻辑
 
@@ -150,8 +161,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 
         private void EditTextMode()
         {
-
         }
+
         /// <summary>
         /// 从预设样式设置文本
         /// </summary>
@@ -170,7 +181,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 
                         if (item.mFontFamily != null)
                         {
-                            GetCurrentFontFamily(item.mFontFamily.ToString(), item.mFontFamily.ToString());
+                            //GetCurrentFontFamily(item.mFontFamily.ToString(), item.mFontFamily.ToString());
+                            if (GetCurrentFontFamily(item) == false)
+                            {
+                                GetCurrentFontFamily(item.mFontFamily.ToString(), item.mFontFamily.ToString());
+                            }
                         }
                         GetFontWeights_Style(item.mFontStyle, item.mFontWeight);
                         //CurrentFontSize = new ComboDataItem(TextEditEvent.FontSize);
@@ -182,12 +197,31 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             }
         }
 
+        /// <summary>
+        /// 编辑 获取预设字体,需要做处理,有些字体带空格,不做处理无法识别
+        /// </summary>
+        /// <param name="item"></param>
+        /// <returns></returns>
+        private bool GetCurrentFontFamily(PresetFontItem item)
+        {
+            DefaultEditProperty defaultEdit = SettingHelper.GetPDFEditDefaultProperty(CPDFEditType.EditText);
+            if (defaultEdit != null && defaultEdit.SystemFontNameList != null)
+            {
+                List<string> itemq = defaultEdit.SystemFontNameList.FindAll(p => p.Replace(" ", "").Equals(item.mFontFamily.ToString()));
+                if (itemq != null && itemq.Count > 0)
+                {
+                    GetCurrentFontFamily(item.mFontFamily.ToString(), itemq[0]);
+                    return true;
+                }
+            }
+            return false;
+        }
+
         /// <summary>
         /// 自定义文字样式
         /// </summary>
         private void CustomFontStyle()
         {
-
             if (CurrentPresetFont != null)
             {
                 ContextMenu menu;
@@ -203,7 +237,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                     var currentItem = PresetFontList.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
                     if (currentItem.mTag != "Custom")
                     {
-                        
                         if (FontWeightItem != defaulItem.mFontWeight ||
                             FontStyleItem != defaulItem.mFontStyle ||
                             CurrentFontSize.Value != defaulItem.mFontSize ||
@@ -219,8 +252,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                     menu.IsOpen = true;
                 }
             }
-
-
         }
 
         //设置字体样式
@@ -237,26 +268,16 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                         {
                             if (CurrentFontFamily.ValueStr != item.mFontFamily.Source)
                             {
-                                string txt = string.Format($" * {currentItem.mTagContent}");
-
-                                if (Title == txt)
+                                if (noAddAnAsterisk(currentItem, item) == false)
                                 {
-                                    Title = "";
+                                    break;
                                 }
-                                Title = txt;
-                                break;
                             }
                             else
                             {
-                                if (FontWeightItem == item.mFontWeight && FontStyleItem == item.mFontStyle && CurrentFontSize.Value == item.mFontSize && CurrentFontFamily.ValueStr == item.mFontFamily.Source)
+                                if (noAddAnAsterisk(currentItem, item) == false)
                                 {
-                                    string txt = currentItem.mTagContent;
-
-                                    if (Title == txt)
-                                    {
-                                        Title = "";
-                                    }
-                                    Title = txt;
+                                    break;
                                 }
                             }
                         }
@@ -265,6 +286,37 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             }
         }
 
+        private bool noAddAnAsterisk(PresetFontItem currentItem, PresetFontItem item)
+        {
+            if (FontWeightItem == item.mFontWeight && FontStyleItem == item.mFontStyle && CurrentFontSize.Value == item.mFontSize && (CurrentFontFamily.ValueStr == item.mFontFamily.Source || (CurrentFontFamily.ValueStr == "Arial" && item.mFontFamily.Source == "Helvetica")))
+            {
+                string txt = currentItem.mTagContent;
+
+                if (Title == txt)
+                {
+                    Title = "";
+                }
+                Title = txt;
+                return true;
+            }
+            else
+            {
+                addAnAsterisk(currentItem);
+                return false;
+            }
+        }
+
+        private void addAnAsterisk(PresetFontItem currentItem)
+        {
+            string txt = string.Format($" * {currentItem.mTagContent}");
+
+            if (Title == txt)
+            {
+                Title = "";
+            }
+            Title = txt;
+        }
+
         /// <summary>
         /// 设置文本字重、样式
         /// </summary>
@@ -321,7 +373,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
         /// </summary>
         private void ReDefineFontStyle()
         {
-
             var item = PresetFontList.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
             if (item == null) return;
 
@@ -351,10 +402,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             item.mFontSize = (int)CurrentFontSize.Value;
 
             CurrentPresetFont = new ComboDataItem(item.mTag, item.mTagContent);
-            SelectedPresetFont();
+            //SelectedPresetFont();
             //更改后 保存到本地缓存
-            TextFont.SavePresetFontList(PresetFontList);
-
+            TextFont.SavePresetEditFontList(PresetFontList);
         }
 
         //重置定义
@@ -363,7 +413,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             var defaultlists = TextFont.GetPresetFontStyle();
             if (CurrentPresetFont.ValueStr != "Custom")
             {
-                var defaulItem = defaultlists.FirstOrDefault(temp => temp.mTag ==CurrentPresetFont.ValueStr);
+                var defaulItem = defaultlists.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
                 if (defaulItem != null)
                 {
                     var currentItem = PresetFontList.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
@@ -374,16 +424,19 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                         currentItem.mFontWeight = defaulItem.mFontWeight;
                         currentItem.mFontFamily = defaulItem.mFontFamily;
                         currentItem.mFontSize = defaulItem.mFontSize;
-                        GetCurrentFontFamily(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
-                       GetCurrentFontSize(currentItem.mFontSize);
+                        //GetCurrentFontFamily(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
+                        if (GetCurrentFontFamily(currentItem) == false)
+                        {
+                            GetCurrentFontFamily(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
+                        }
+                        GetCurrentFontSize(currentItem.mFontSize);
                         GetFontWeights_Style(currentItem.mFontStyle, currentItem.mFontWeight);
                         CurrentPresetFont = new ComboDataItem(defaulItem.mTag, defaulItem.mTagContent);
                         SelectedPresetFont();
-                        TextFont.SavePresetFontList(PresetFontList);
+                        TextFont.SavePresetEditFontList(PresetFontList);
                     }
                 }
             }
-
         }
 
         //设置多选对齐方式
@@ -398,34 +451,39 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                         case "AlignLeft":
                             PDFViewer.SetPDFEditAligment(AlignModes.AlignLeft);
                             break;
+
                         case "AlignHorizonCenter":
                             PDFViewer.SetPDFEditAligment(AlignModes.AlignHorizonCenter);
                             break;
+
                         case "AlignRight":
                             PDFViewer.SetPDFEditAligment(AlignModes.AlignRight);
                             break;
+
                         case "DistributeHorizontal":
                             PDFViewer.SetPDFEditAligment(AlignModes.DistributeHorizontal);
                             break;
+
                         case "AlignTop":
                             PDFViewer.SetPDFEditAligment(AlignModes.AlignTop);
                             break;
+
                         case "AlignVerticalCenter":
                             PDFViewer.SetPDFEditAligment(AlignModes.AlignVerticalCenter);
                             break;
+
                         case "AlignBottom":
                             PDFViewer.SetPDFEditAligment(AlignModes.AlignBottom);
                             break;
+
                         case "DistributeVertical":
                             PDFViewer.SetPDFEditAligment(AlignModes.DistributeVertical);
                             break;
                     }
-
                 }
             }
         }
 
-
         //设置文本框内对齐方式
         private void TextAlignChecked(object obj)
         {
@@ -494,7 +552,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 if (colorValue != null)
                 {
                     SelectColor = new SolidColorBrush(colorValue);
-
                 }
             }
         }
@@ -505,11 +562,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             if (obj != null && (PresetFontItem)obj != null)
             {
                 var item = (PresetFontItem)obj;
-
             }
         }
 
-
         //设置字体大小
         private void FontSizeChanged(object obj)
         {
@@ -556,8 +611,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             }
         }
 
-
-        #endregion
+        #endregion 文本处理逻辑
 
         #region 右键菜单
 
@@ -576,9 +630,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             return popMenu;
         }
 
-
-        #endregion
-
+        #endregion 右键菜单
 
         #region 编辑PDF内容触发的事件
 
@@ -587,7 +639,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
         /// </summary>
         private void PDFViewer_PDFEditCommandHandler(object sender, PDFEditCommand e)
         {
-
             //if (e == null)
             //    return;
 
@@ -630,7 +681,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 menuItem.IsEnabled = false;
                 if (currentItem.mTag != "Custom")
                 {
-
                     if (FontWeightItem != currentItem.mFontWeight ||
                         FontStyleItem != currentItem.mFontStyle ||
                         CurrentFontSize.Value != currentItem.mFontSize ||
@@ -640,7 +690,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                         menuItem.Command = ReDefineFontStyleCommand;
                     }
                 }
-              
+
                 //恢复默认预设样式
                 menuItem = popMenu.Items[1] as MenuItem;
                 menuItem.IsEnabled = isEnable;
@@ -648,25 +698,25 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             }
             return popMenu;
         }
-        #endregion
+
+        #endregion 编辑PDF内容触发的事件
 
         protected List<PDFEditEvent> TextEditEventList;
+
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
-
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<List<PDFEditEvent>>(ParameterNames.AnnotEvent, out TextEditEventList);
             if (PDFViewer != null)
             {
-               
                 if (TextEditEventList != null && TextEditEventList.Count > 0)
                 {
                     TextEditEvent = TextEditEventList[0];
-                    if(TextEditEvent.FontName!=""&& TextEditEvent.FontName !=null)
+                    if (TextEditEvent.FontName != "" && TextEditEvent.FontName != null)
                     {
                         GetPDFEdit();
                     }
-                    
+
                     if (TextEditEventList.Count > 1)
                         IsSelectedEmpty = true;
                     else
@@ -688,39 +738,28 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                         IsLayoutAvgAlign = false;
                     }
                 }
-                else if(TextEditEventList==null|| TextEditEvent.FontName == null|| TextEditEvent.FontName == "")
+                else if (TextEditEventList == null || TextEditEvent.FontName == null || TextEditEvent.FontName == "")
                 {
                     var defaultlists = TextFont.GetPresetFontStyle();
-
-                        //var defaulItem = defaultlists.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
-                        //if (defaulItem != null)
-                        //{
-                            var currentItem = PresetFontList.FirstOrDefault(temp => temp.mTag == "Custom");
-                            if (currentItem != null)
-                            {
-                           
-
-                                //currentItem.mTagContent = defaulItem.mTagContent;
-                                //currentItem.mFontStyle = defaulItem.mFontStyle;
-                                //currentItem.mFontWeight = defaulItem.mFontWeight;
-                                //currentItem.mFontFamily = defaulItem.mFontFamily;
-                                //currentItem.mFontSize = defaulItem.mFontSize;
-                                GetCurrentFontFamily(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
-                                GetCurrentFontSize(currentItem.mFontSize);
-                                GetFontWeights_Style(currentItem.mFontStyle, currentItem.mFontWeight);                           
-                                SelectedPresetFont();
-
-                            SelectColor = new SolidColorBrush(Colors.Black);
-                            CurrentFontSize = new ComboDataItem(currentItem.mFontSize);
+                    var currentItem = PresetFontList.FirstOrDefault(temp => temp.mTag == "Custom");
+                    if (currentItem != null)
+                    {
+                        SelectColor = new SolidColorBrush(Colors.Black);
+                        CurrentFontSize = new ComboDataItem(currentItem.mFontSize);
                         CurrentPresetFont = new ComboDataItem(currentItem.mTag, currentItem.mTagContent);
                         CurrentFontFamily = new ComboDataItem(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
-                            FontStyleItem = FontStyles.Normal;
-                            FontWeightItem = FontWeights.Normal;
-                            
-                        //}
-                        
-                    }
+                        FontStyleItem = FontStyles.Normal;
+                        FontWeightItem = FontWeights.Normal;
 
+                        //GetCurrentFontFamily(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
+                        if (GetCurrentFontFamily(currentItem) == false)
+                        {
+                            GetCurrentFontFamily(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
+                        }
+                        GetCurrentFontSize(currentItem.mFontSize);
+                        GetFontWeights_Style(currentItem.mFontStyle, currentItem.mFontWeight);
+                        SelectedPresetFont();
+                    }
                 }
 
                 PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
@@ -731,11 +770,27 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             }
         }
 
-        //文本内容改变触发
+        private DefaultEditProperty GetEditDefault(ComPDFKit.PDFPage.CPDFEditType editType)
+        {
+            var edit = SettingHelper.GetPDFEditDefaultProperty(editType);
+            if (edit == null)
+            {
+                edit = new DefaultEditProperty();
+                edit.EditType = editType;
+            }
+            return edit;
+        }
+
+        /// <summary>
+        /// 文本内容改变触发
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
         private void FontMode_ChangedValue(object sender, FontSetModeType e)
         {
             if (sender != null && TextEditEvent != null)
             {
+                PDFEditEvent pdfEditEvent = PDFEditHelper.GetPDFEditDefaultProperty(out DefaultEditProperty defaultEdit, PDFViewer);
                 switch (e)
                 {
                     case FontSetModeType.PresetFontStyes:
@@ -763,30 +818,44 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                                         itemlist.UpdatePDFEditByEventArgs();
                                     }
                                 }
-
+                                defaultEdit.FontName = TextEditEvent.FontName;
+                                defaultEdit.FontSize = TextEditEvent.FontSize;
+                                defaultEdit.IsBold = TextEditEvent.IsBold;
+                                defaultEdit.IsItalic = TextEditEvent.IsItalic;
                             }
                         }
                         break;
+
                     case FontSetModeType.FontFamilys:
                         if (sender is string == true)
                         {
                             TextEditEvent.FontName = (string)sender;
                             TextEditEvent.UpdatePDFEditByEventArgs();
+
+                            defaultEdit.FontName = TextEditEvent.FontName;
                         }
                         break;
+
                     case FontSetModeType.FontSizes:
-                        if (sender is double == true && (double)sender > 0 && TextEditEvent.FontSize > 0)
+                        if (sender is double == true && (double)sender > 0 && TextEditEvent.FontSize >= 0)
                         {
                             TextEditEvent.FontSize = (double)sender;
                             TextEditEvent.UpdatePDFEditByEventArgs();
+
+                            defaultEdit.FontSize = TextEditEvent.FontSize;
                         }
                         break;
+
                     case FontSetModeType.FontWeight_Style:
                         UpdateFontWeight_Style();
                         TextEditEvent.IsBold = FontWeightItem == FontWeights.Bold;
                         TextEditEvent.IsItalic = FontStyleItem == FontStyles.Italic;
                         TextEditEvent.UpdatePDFEditByEventArgs();
+
+                        defaultEdit.IsBold = TextEditEvent.IsBold;
+                        defaultEdit.IsItalic = TextEditEvent.IsItalic;
                         break;
+
                     case FontSetModeType.FontColor:
                         if (sender is Color == true)
                         {
@@ -802,50 +871,70 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                                 TextEditEvent.UpdatePDFEditByEventArgs();
                             }
                         }
-
+                        defaultEdit.FontColor = TextEditEvent.FontColor;
                         break;
 
                     case FontSetModeType.TextAlignment:
                         break;
-
                 }
+                PDFEditHelper.GetPDFEditEvent(defaultEdit, PDFViewer);
+                SettingHelper.SetPDFEditProperty(defaultEdit);
+                Settings.Default.Save();
             }
-        
         }
 
         //获取文本参数
         private void GetPDFEdit()
         {
+            DefaultEditProperty defaultEdit = SettingHelper.GetPDFEditDefaultProperty(CPDFEditType.EditText);
+            if (!App.IsGetTextFamily)
+            {
+                if (TextEditEvent.SystemFontNameList.Count > 0)
+                {
+                    EditHelper.FontFamily = TextEditEvent.SystemFontNameList;
+                    App.IsGetTextFamily = true;
+                }
+                InitBase_FontFamilys();
+                if (defaultEdit != null)
+                {
+                    if (defaultEdit.SystemFontNameList.Count < EditHelper.FontFamily.Count)
+                    {
+                        defaultEdit.SystemFontNameList = EditHelper.FontFamily;
+                        SettingHelper.SetPDFEditProperty(defaultEdit);
+                        Settings.Default.Save();
+                    }
+                }
+            }
 
             SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
-            CurrentFontSize =new ComboDataItem(TextEditEvent.FontSize);
-            
+            CurrentFontSize = new ComboDataItem(TextEditEvent.FontSize);
             CurrentFontFamily = new ComboDataItem(TextEditEvent.FontName, TextEditEvent.FontName);
             FontStyleItem = TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal;
             FontWeightItem = TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal;
             //GetCurrentFontFamily(TextEditEvent.FontName, TextEditEvent.FontName);
             GetFontWeights_Style(FontStyleItem, FontWeightItem);
-          
+
             //判断样式列表中是否存在对应样式
             bool isExist = false;
             foreach (var item in PresetFontList)
             {
                 string itemmFontFamily = item.mFontFamily.Source;
-                if (item.mFontFamily.Source == "Arial")
-                {
-                    itemmFontFamily = "Helvetica";
-                }
-                if (item.mFontFamily.Source == "Times-Roman" || itemmFontFamily == "Times")
+
+                if (item.mFontFamily.Source == "TimesRoman")
                 {
                     itemmFontFamily = "Times-Roman";
                 }
-                if (item.mFontFamily.Source == "Courier")
+                if (defaultEdit != null && defaultEdit.SystemFontNameList != null)
                 {
-                    itemmFontFamily = "Courier New";
+                    List<string> itemq = defaultEdit.SystemFontNameList.FindAll(p => p.Replace(" ", "").Equals(item.mFontFamily.ToString()));
+                    if (itemq != null && itemq.Count > 0)
+                    {
+                        itemmFontFamily = itemq[0];
+                    }
                 }
                 if (TextEditEvent.FontSize == item.mFontSize && TextEditEvent.IsBold == (item.mFontWeight == FontWeights.Bold) && TextEditEvent.IsItalic == (item.mFontStyle == FontStyles.Italic)
-                    && (TextEditEvent.FontName == itemmFontFamily || TextEditEvent.FontName == "Arial" && item.mFontFamily.Source == "Helvetica")
-                    )
+            && (TextEditEvent.FontName == itemmFontFamily || TextEditEvent.FontName == "Arial")
+            )
                 {
                     if (item.mTag != "Custom")
                     {
@@ -863,13 +952,18 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 CurrentPresetFont = new ComboDataItem("Custom", "Custom");
                 GetCurrentFontSize((int)TextEditEvent.FontSize);
 
-                if (TextEditEvent.FontName == ""|| TextEditEvent.FontName == null)
+                if (TextEditEvent.FontName == "" || TextEditEvent.FontName == null)
                 {
-                    GetCurrentFontFamily("Helvetica", "Helvetica");
+                    GetCurrentFontFamily("Arial", "Arial");
                 }
                 else
                 {
-                    GetCurrentFontFamily(TextEditEvent.FontName, TextEditEvent.FontName);
+                    GetCurrentFontFamily(TextEditEvent.FontName.Replace(" ", ""), TextEditEvent.FontName);
+                    //List<ComboDataItem> itemq = FontFamilyItems.FindAll(p => p.ValueStr == currentItem.mFontFamily.ToString());
+                    //if (itemq != null && itemq.Count > 0)
+                    //{
+                    //    GetCurrentFontFamily(TextEditEvent.FontName, itemq[0].Content);
+                    //}
                 }
                 GetFontWeights_Style(TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal, TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal);
             }
@@ -887,11 +981,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                             GetCurrentFontSize(item.mFontSize);
                             if (item.mFontFamily != null)
                             {
-                                GetCurrentFontFamily(item.mFontFamily.ToString(), item.mFontFamily.ToString());
+                                if (GetCurrentFontFamily(item) == false)
+                                {
+                                    GetCurrentFontFamily(item.mFontFamily.ToString(), item.mFontFamily.ToString());
+                                }
                             }
                             GetFontWeights_Style(TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal, TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal);
                         }
-                      
                     }
                 }
             }
@@ -916,11 +1012,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             }
             TextAlign = TextEditEvent.TextAlign;
             TextEditEvent.UpdatePDFEditByEventArgs();
-        
-    }
-
-        public bool IsNavigationTarget(NavigationContext navigationContext) { return true; }
+        }
 
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        { return true; }
 
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
@@ -931,6 +1026,5 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
             ChangedValue -= FontMode_ChangedValue;
         }
-
     }
 }

+ 70 - 0
PDF Office/ViewModels/PropertyPanel/PropertyPanelContentEditViewModel.cs

@@ -0,0 +1,70 @@
+using PDF_Master.DataConvert;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Master.ViewModels.PropertyPanel
+{
+    public class PropertyPanelContentEditViewModel : BindableBase, INavigationAware
+    {
+        private string _annotPanelType = "HighLight";
+        public string AnnotPanelType
+        {
+            get { return _annotPanelType; }
+            set
+            {
+                SetProperty(ref _annotPanelType, value);
+
+            }
+        }
+
+        private PanelType _propertyPanelType;
+        public PanelType PropertyPanelType
+        {
+            get { return _propertyPanelType; }
+            set
+            {
+                SetProperty(ref _propertyPanelType, value);
+
+            }
+        }
+
+        private IRegionManager regions { get; set; }
+        private string propertyPanelRegionNmae;
+        public string PropertyPanelRegionNmae
+        {
+            get { return propertyPanelRegionNmae; }
+            set
+            {
+                SetProperty(ref propertyPanelRegionNmae, value);
+            }
+        }
+
+        public PropertyPanelContentEditViewModel(IRegionManager regionManager)
+        {
+            regions = regionManager;
+
+            PropertyPanelRegionNmae = Guid.NewGuid().ToString();
+
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+
+        }
+    }
+}

+ 289 - 217
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -1,4 +1,5 @@
-using ComPDFKit.Import;
+using ComDocumentAIKit;
+using ComPDFKit.Import;
 using ComPDFKit.PDFAnnotation;
 using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFDocument.Action;
@@ -29,6 +30,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
 using System.Windows;
+using System.Windows.Annotations;
 using System.Windows.Controls;
 using System.Windows.Controls.Primitives;
 using System.Windows.Input;
@@ -244,12 +246,32 @@ namespace PDF_Master.ViewModels.Tools
                 int annotCount = PDFViewer.GetSelectAnnotCount();
                 if (annotCount == 0)
                 {
-                    this.events.GetEvent<CleanSelectAllEvent>().Publish(new CleanSelectAllArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, IsCleanSelectAll = true });
+                    //2023/08/23 Windows:BOTA列表,移除点击阅读页取消选中逻辑
+                    //this.events.GetEvent<CleanSelectAllEvent>().Publish(new CleanSelectAllArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, IsCleanSelectAll = true });
+
+                    CleanAnnotationSelect();
+                }
+                else if (annotCount == 1)
+                {
+                    selectedAnnotation = PDFViewer.GetSelectionAnnots()[0];
                 }
             }
         }
-
-        //超链接跳转
+
+        private void CleanAnnotationSelect()
+        {
+            bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
+            if (ViewContentViewModel.OpenBOTA && bOTAContent.TabItemAnnotation.IsSelected)
+            {
+                AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
+                if (annotation.AnnotationList.SelectedItems.Count > 0)
+                {
+                    annotation.AnnotationList.SelectedItems.Clear();
+                }
+            }
+        }
+
+        //超链接跳转
         private void PDFViewer_PDFActionHandler(object sender, ComPDFKit.PDFDocument.Action.CPDFAction action)
         {
             if (action == null)
@@ -527,6 +549,9 @@ namespace PDF_Master.ViewModels.Tools
             }
             if (e == null)
             {
+                //注释列表取消选中
+                //不能写在这里 容易造成死循环
+
                 ViewContentViewModel.mainViewModel.AnnotMouseLeftButtonDown = false;
                 if (ViewContentViewModel.IsRightMenuSelectedTextAddLink || ViewContentViewModel.IsRightMenuCreateLink)
                 {
@@ -555,84 +580,10 @@ namespace PDF_Master.ViewModels.Tools
                 }
                 else
                 {
-                    switch (StrAnnotToolChecked)
-                    {
-                        case "HighLight"://字体高亮
-                            CleanPropertyPanel();
-                            if (selectedAnnotation != null)
-                            {
-                                if (selectedAnnotation.EventType == AnnotArgsType.AnnotHighlight)
-                                {
-                                    GetHighLight();
-                                }
-                            }
-                            else
-                            {
-                                GetHighLight();
-                            }
-
-                            break;
-
-                        case "UnderLine"://下划线
-                            CleanPropertyPanel();
-                            if (selectedAnnotation != null)
-                            {
-                                if (selectedAnnotation.EventType == AnnotArgsType.AnnotUnderline)
-                                {
-                                    GetUnderLine();
-                                }
-                            }
-                            else
-                            {
-                                GetUnderLine();
-                            }
-                            break;
+                    SetTextAnnotProperty();
 
-                        case "Strikeout"://删除线
-                            CleanPropertyPanel();
+                    SetSharpsAnnotProperty();
 
-                            if (selectedAnnotation != null)
-                            {
-                                if (selectedAnnotation.EventType == AnnotArgsType.AnnotStrikeout)
-                                {
-                                    GetStrikeout();
-                                }
-                            }
-                            else
-                            {
-                                GetStrikeout();
-                            }
-                            break;
-                    }
-
-                    if (StrAnnotToolChecked == "Rect" && PropertyPanel.IsSelectedTextAddShape == false)
-                    {
-                        AnnotHandlerEventArgs annotArgs = null;
-                        //此处不能用这个方法更新创建注释的属性  会导致死循环
-                        //选择文字 点击矩形 会导致死循环
-                        // FindAnnotTypeKey(StrAnnotToolChecked, ref annotArgs);
-
-                        CleanPropertyPanel();
-                        switch (PropertyPanel.SharpsAnnot)
-                        {
-                            case "Rect":
-                                annotArgs = GetRect();
-                                break;
-
-                            case "Circle":
-                                annotArgs = GetCircle();
-                                break;
-
-                            case "Arrow":
-                                annotArgs = GetArrowLine("Arrow");
-                                break;
-
-                            case "Line":
-                                annotArgs = GetArrowLine("Line");
-                                break;
-                        }
-                        return;
-                    }
                     //不可以写,手绘 改透明度 会有问题
                     //if (StrAnnotToolChecked == "Freehand")
                     //{
@@ -681,53 +632,15 @@ namespace PDF_Master.ViewModels.Tools
                         {
                             CurrentSelectedAnnot = annot;
                             //未选注释工具-形状注释,选中形状注释,属性面板不显示(矩形、圆、线、箭头)
-                            if (StrAnnotToolChecked != "Rect"
-                                && (annot.EventType == AnnotArgsType.AnnotSquare ||
-                                        annot.EventType == AnnotArgsType.AnnotCircle ||
-                                        annot.EventType == AnnotArgsType.AnnotLine))
-                            {
-                                PropertyPanel.IsSharpAnnotSelected = false;
-                            }
-                            else
-                            {
-                                PropertyPanel.IsSharpAnnotSelected = true;
-                            }
-                            if (StrAnnotToolChecked != "Freehand" && annot.EventType == AnnotArgsType.AnnotFreehand)
-                            {
-                                PropertyPanel.IsFreeHandSelected = false;
-                            }
-                            else
-                            {
-                                PropertyPanel.IsFreeHandSelected = true;
-                            }
-                            isShowPropertyPanel = ViewContentViewModel.IsPropertyOpen;
+                            //未选注释工具-手绘,选中手绘注释,属性面板不显示橡皮擦
+                            SetPropertyPanelValue(annot);
+
                             if (ViewContentViewModel.mainViewModel.IsBookMode == false)
                             {
                                 GetSelectedAnnots(e, true);
                             }
-                            SelectedSignature(e.AnnotItemsList);
-
-                            if (Settings.Default.AppProperties.InitialVIew.AutoExpandProperty
-                                && annot.EventType != AnnotArgsType.AnnotStamp && StrAnnotToolChecked != "Signature"
-                                && annot.EventType != AnnotArgsType.AnnotLink && ViewContentViewModel.mainViewModel.IsBookMode == false)
-                            {
-                                var signAnnot = ViewContentViewModel.AnnotSignatures.FirstOrDefault(temp => temp.Item1 == annot.PageIndex && temp.Item2 == annot.AnnotIndex);
-                                if (signAnnot == null)
-                                {
-                                    if (e.IsMouseRightActive)
-                                    {
-                                        ShowPropertyPanel(isShowPropertyPanel);
-                                    }
-                                    else
-                                    {
-                                        ShowPropertyPanel(true);
-                                    }
-                                }
-                            }
-                            else if (StrAnnotToolChecked == "Signature")
-                            {
-                                GetSignature();
-                            }
+
+                            PropertyPanelShowOrVisibility(e, annot);
 
                             //注释列表同步选中
                             SelectedBotaAnnotationList(e);
@@ -751,30 +664,6 @@ namespace PDF_Master.ViewModels.Tools
                                 ViewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
                             }
 
-                            //switch (annot.EventType)
-                            //{
-                            //    case AnnotArgsType.AnnotFreeText:
-                            //        annot = GetFreetext(e.AnnotItemsList);
-                            //        PDFViewer.SetToolParam(annot);
-                            //        break;
-
-                            //    case AnnotArgsType.AnnotSticky:
-                            //        customStickyPopup.GetCurrentAnnot = e.AnnotItemsList[0] as StickyAnnotArgs;
-                            //        customStickyPopup.GetPDFViewer = PDFViewer;
-                            //        propertyPanel.annot = e.AnnotItemsList[0];
-                            //        var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
-                            //        propertyPanel.AnnotEvents = null;
-                            //        propertyPanel.AnnotEvent = AnnotEvent;
-                            //        propertyPanel.annotlists = e.AnnotItemsList;
-                            //        break;
-
-                            //    case AnnotArgsType.AnnotLink:
-                            //        //viewContentViewModel.IsCreateLink = false;
-                            //        GetLink(e.AnnotItemsList, e);
-                            //        PDFViewer.SetToolParam(annot);
-                            //        break;
-                            //}
-
                             #region //TODO: 修改注释后,会作用到之后添加的注释中。因此先把此逻辑“创建注释后,会自动回到默认值”注释掉
 
                             //注释代码原因:设计已经重新调整逻辑:所有注释创建后,编辑属性,所有属性会作用于下次创建的注释中。
@@ -844,70 +733,231 @@ namespace PDF_Master.ViewModels.Tools
                     else
                     {
                         //框选注释
-                        PropertyPanel.annotlists = e.AnnotItemsList;
-                        ViewContentViewModel.IsMultiSelected = true;
-                        //viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                        BoxAnnotation(e);
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// 框选注释
+        /// </summary>
+        /// <param name="e"></param>
+        private void BoxAnnotation(AnnotAttribEvent e)
+        {
+            PropertyPanel.annotlists = e.AnnotItemsList;
+            ViewContentViewModel.IsMultiSelected = true;
+            //viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
 
-                        // MVP 在对多选注释做处理
-                        bool isDifferentAnnotTyle = AnnotTransfer.IsDifferentTypeAnnots(e.AnnotItemsList);
+            // MVP 在对多选注释做处理
+            bool isDifferentAnnotTyle = AnnotTransfer.IsDifferentTypeAnnots(e.AnnotItemsList);
 
-                        if (ViewContentViewModel.mainViewModel.IsBookMode)
+            if (ViewContentViewModel.mainViewModel.IsBookMode)
+            {
+                ShowPropertyPanel(false);
+            }
+            else
+            {
+                BottomToolContent bottomTool = null;
+                BottomToolContentViewModel bottomToolVM = ViewContentViewModel.GetBottomToolContentVM(ref bottomTool);
+                if (isDifferentAnnotTyle)
+                {
+                    if (bottomToolVM != null)
+                    {
+                        if (bottomToolVM.IsShowViewModular == false)
+                        {
+                            //viewContentViewModel.IsReadModeShow = false;
+                            ViewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                            ShowPropertyPanel(false);
+                        }
+                    }
+                    else
+                    {
+                        //viewContentViewModel.IsReadModeShow = false;
+                        ViewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                        ShowPropertyPanel(false);
+                    }
+                }
+                else
+                {
+                    ViewContentViewModel.IsReadModeShow = false;
+                    if (bottomToolVM != null)
+                    {
+                        bottomToolVM.IsShowViewModular = false;
+                    }
+                    GetSelectedAnnots(e);
+                    if (string.IsNullOrEmpty(StrAnnotToolChecked) == true)
+                    {
+                        var count = e.AnnotItemsList.FindAll(r => r.EventType == AnnotArgsType.AnnotStamp).Count;
+                        if (count > 0)
                         {
                             ShowPropertyPanel(false);
                         }
                         else
                         {
-                            BottomToolContent bottomTool = null;
-                            BottomToolContentViewModel bottomToolVM = ViewContentViewModel.GetBottomToolContentVM(ref bottomTool);
-                            if (isDifferentAnnotTyle)
-                            {
-                                if (bottomToolVM != null)
-                                {
-                                    if (bottomToolVM.IsShowViewModular == false)
-                                    {
-                                        //viewContentViewModel.IsReadModeShow = false;
-                                        ViewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
-                                        ShowPropertyPanel(false);
-                                    }
-                                }
-                                else
-                                {
-                                    //viewContentViewModel.IsReadModeShow = false;
-                                    ViewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
-                                    ShowPropertyPanel(false);
-                                }
-                            }
-                            else
-                            {
-                                ViewContentViewModel.IsReadModeShow = false;
-                                if (bottomToolVM != null)
-                                {
-                                    bottomToolVM.IsShowViewModular = false;
-                                }
-                                GetSelectedAnnots(e);
-                                if (string.IsNullOrEmpty(StrAnnotToolChecked) == true)
-                                {
-                                    var count = e.AnnotItemsList.FindAll(r => r.EventType == AnnotArgsType.AnnotStamp).Count;
-                                    if (count > 0)
-                                    {
-                                        ShowPropertyPanel(false);
-                                    }
-                                    else
-                                    {
-                                        ShowPropertyPanel(true);
-                                    }
-                                }
-                                else
-                                {
-                                    ShowPropertyPanel(true);
-                                }
-                            }
+                            ShowPropertyPanel(true);
                         }
                     }
+                    else
+                    {
+                        ShowPropertyPanel(true);
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// 设置选中注释工具 签名,面板的显示
+        /// </summary>
+        /// <param name="e"></param>
+        /// <param name="annot"></param>
+        private void PropertyPanelShowOrVisibility(AnnotAttribEvent e, AnnotHandlerEventArgs annot)
+        {
+            SelectedSignature(e.AnnotItemsList);
+
+            if (Settings.Default.AppProperties.InitialVIew.AutoExpandProperty
+                && annot.EventType != AnnotArgsType.AnnotStamp && StrAnnotToolChecked != "Signature"
+                && annot.EventType != AnnotArgsType.AnnotLink && ViewContentViewModel.mainViewModel.IsBookMode == false)
+            {
+                var signAnnot = ViewContentViewModel.AnnotSignatures.FirstOrDefault(temp => temp.Item1 == annot.PageIndex && temp.Item2 == annot.AnnotIndex);
+                if (signAnnot == null)
+                {
+                    if (e.IsMouseRightActive)
+                    {
+                        ShowPropertyPanel(isShowPropertyPanel);
+                    }
+                    else
+                    {
+                        ShowPropertyPanel(true);
+                    }
+                }
+            }
+            else if (StrAnnotToolChecked == "Signature")
+            {
+                GetSignature();
+            }
+        }
+
+        /// <summary>
+        /// 设置选中注释工具形状, 点击阅读页空白时候显示内容
+        /// </summary>
+        private void SetSharpsAnnotProperty()
+        {
+            if (StrAnnotToolChecked == "Rect" && PropertyPanel.IsSelectedTextAddShape == false)
+            {
+                //AnnotHandlerEventArgs annotArgs = null;//暂时不知道会不会影响效果,先注释
+                //此处不能用这个方法更新创建注释的属性  会导致死循环
+                //选择文字 点击矩形 会导致死循环
+                // FindAnnotTypeKey(StrAnnotToolChecked, ref annotArgs);
+
+                CleanPropertyPanel();
+                switch (PropertyPanel.SharpsAnnot)
+                {
+                    case "Rect":
+                        GetRect();
+                        break;
+
+                    case "Circle":
+                        GetCircle();
+                        break;
+
+                    case "Arrow":
+                        GetArrowLine("Arrow");
+                        break;
+
+                    case "Line":
+                        GetArrowLine("Line");
+                        break;
                 }
+                //return; //暂时不知道会不会影响效果,先注释
             }
         }
 
+        /// <summary>
+        /// 设置选中注释工具高亮、下划线、删除线, 点击阅读页空白时候显示内容
+        /// </summary>
+        private void SetTextAnnotProperty()
+        {
+            switch (StrAnnotToolChecked)
+            {
+                case "HighLight"://字体高亮
+                    CleanPropertyPanel();
+                    if (selectedAnnotation != null)
+                    {
+                        if (selectedAnnotation.EventType == AnnotArgsType.AnnotHighlight)
+                        {
+                            GetHighLight();
+                        }
+                    }
+                    else
+                    {
+                        GetHighLight();
+                    }
+
+                    break;
+
+                case "UnderLine"://下划线
+                    CleanPropertyPanel();
+                    if (selectedAnnotation != null)
+                    {
+                        if (selectedAnnotation.EventType == AnnotArgsType.AnnotUnderline)
+                        {
+                            GetUnderLine();
+                        }
+                    }
+                    else
+                    {
+                        GetUnderLine();
+                    }
+                    break;
+
+                case "Strikeout"://删除线
+                    CleanPropertyPanel();
+
+                    if (selectedAnnotation != null)
+                    {
+                        if (selectedAnnotation.EventType == AnnotArgsType.AnnotStrikeout)
+                        {
+                            GetStrikeout();
+                        }
+                    }
+                    else
+                    {
+                        GetStrikeout();
+                    }
+                    break;
+            }
+        }
+
+        /// <summary>
+        ///未选注释工具-形状注释,选中形状注释,属性面板不显示(矩形、圆、线、箭头)
+        ///未选注释工具-手绘,选中手绘注释,属性面板不显示橡皮擦
+        /// </summary>
+        /// <param name="annot"></param>
+        private void SetPropertyPanelValue(AnnotHandlerEventArgs annot)
+        {
+            if (StrAnnotToolChecked != "Rect"
+                                && (annot.EventType == AnnotArgsType.AnnotSquare ||
+                                        annot.EventType == AnnotArgsType.AnnotCircle ||
+                                        annot.EventType == AnnotArgsType.AnnotLine))
+            {
+                PropertyPanel.IsSharpAnnotSelected = false;
+            }
+            else
+            {
+                PropertyPanel.IsSharpAnnotSelected = true;
+            }
+            if (StrAnnotToolChecked != "Freehand" && annot.EventType == AnnotArgsType.AnnotFreehand)
+            {
+                PropertyPanel.IsFreeHandSelected = false;
+            }
+            else
+            {
+                PropertyPanel.IsFreeHandSelected = true;
+            }
+            isShowPropertyPanel = ViewContentViewModel.IsPropertyOpen;
+        }
+
         private void CleanPropertyPanel()
         {
             PropertyPanel.annot = null;
@@ -949,19 +999,43 @@ namespace PDF_Master.ViewModels.Tools
             //    }
             //}
             #endregion 之前版本
-            var list = e.GetPageAnnotsIndex();
-            if (list != null && list.Count > 0 && ViewContentViewModel.mainViewModel.AnnotMouseLeftButtonDown == false)
-            {
-                if (list.Keys.Count == 0)
-                {
-                    return;
-                }
-                var pageindex = new List<int>(list.Keys);
-                List<int> annotes = new List<int>();
-                list.TryGetValue(pageindex[0], out annotes);
-                int annoteindex = annotes[0];
 
+            #region v1.3.0 第一版
+            //var list = e.GetPageAnnotsIndex();
+            //if (list != null && list.Count > 0 && ViewContentViewModel.mainViewModel.AnnotMouseLeftButtonDown == false)
+            //{
+            //    if (list.Keys.Count == 0)
+            //    {
+            //        return;
+            //    }
+            //    var pageindex = new List<int>(list.Keys);
+            //    List<int> annotes = new List<int>();
+            //    list.TryGetValue(pageindex[0], out annotes);
+            //    int annoteindex = annotes[0];
+
+            //    bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
+            //    if (ViewContentViewModel.OpenBOTA == false)
+            //    {
+            //        bOTAContentViewModel.OpenBOTA();
+            //    }
+            //    if (bOTAContent.TabItemAnnotation.IsSelected == false)
+            //    {
+            //        bOTAContent.TabItemAnnotation.IsSelected = true;
+            //    }
+
+            //    AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
+
+            //    selectedAnnotation = viewModel.AnnotationListItems.FindFirst(a => a.PageIndex == pageindex[0] && a.AnnotIndex == annoteindex);
+
+            //    viewModel.ScrollToAnnot(pageindex[0], annoteindex, annotation.AnnotationList);
+            //}
+            #endregion v1.3.0 第一版
+            //形状、图章、签名等是添加后选中,如果注释列表数据量过大,会卡顿,影响用户体验
+            if (PDFViewer.GetSelectAnnotCount() > 0 && ViewContentViewModel.mainViewModel.AnnotMouseLeftButtonDown == false && string.IsNullOrEmpty(StrAnnotToolChecked))
+            {
+                List<AnnotHandlerEventArgs> annotationHandlers = PDFViewer.GetSelectionAnnots();
                 bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
+
                 if (ViewContentViewModel.OpenBOTA == false)
                 {
                     bOTAContentViewModel.OpenBOTA();
@@ -970,13 +1044,9 @@ namespace PDF_Master.ViewModels.Tools
                 {
                     bOTAContent.TabItemAnnotation.IsSelected = true;
                 }
-
-                AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
-
-                if (viewModel != null)
+                if (annotationHandlers[0].EventType != AnnotArgsType.AnnotLink)
                 {
-                    //selectedAnnotation = viewModel.AnnotationListItems.FindFirst(a => a.PageIndex == pageindex[0] && a.AnnotIndex == annoteindex);
-                    viewModel.ScrollToAnnot(pageindex[0], annoteindex, annotation.AnnotationList);
+                    events.GetEvent<RefreshAnnotationEvent>().Publish(new RefreshAnnotationArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, IsAll = false, IsSelect = true, Pageindex = annotationHandlers[0].PageIndex, AnnotIndex = annotationHandlers[0].AnnotIndex, IsExpand = false });
                 }
             }
         }
@@ -1090,6 +1160,8 @@ namespace PDF_Master.ViewModels.Tools
                     {
                         if (e.PressOnSelectedText || e.CommandTarget == TargetType.ImageSelection)
                         {
+                            //右键添加注释,形状注释添加之后会选中
+                            ViewContentViewModel.mainViewModel.AnnotMouseLeftButtonDown = true;
                             e.PopupMenu = SelectedTextOrImageContextMenu(sender, e);
                             if (e.PopupMenu != null)
                             {
@@ -1467,10 +1539,10 @@ namespace PDF_Master.ViewModels.Tools
                             {
                                 int pageindex = editEvent.PageIndex;
                                 int annotindex = editEvent.AnnotIndex;
-                                viewModel.UpdateAddedAnnot(pageindex, annotindex);
+                                viewModel.UpdateAddedAnnot(bOTAContent, pageindex, annotindex);
                             }
 
-                            //添加签注释,用于未保存前跟图章手绘注释的区分
+                            //添加签注释,用于未保存前跟图章手绘注释的区分
                             if (StrAnnotToolChecked == "Signature")
                             {
                                 AddAnnotSignature(editEvent.EditAnnotArgs);

+ 2 - 2
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Properties.cs

@@ -228,7 +228,7 @@ namespace PDF_Master.ViewModels.Tools
         public bool IsCreateAnnot = false;
 
         //判断是否选中图片
-        public bool IsSelectImage=false;
+        public bool IsSelectImage = false;
 
         public string PropertyRegionName { get; set; }
         private IEventAggregator events;
@@ -334,7 +334,7 @@ namespace PDF_Master.ViewModels.Tools
         /// <summary>
         /// 注释列表选中注释
         /// </summary>
-        private Model.BOTA.AnnotationHandlerEventArgs selectedAnnotation = null;
+        private AnnotHandlerEventArgs selectedAnnotation = null;
     }
 
     public enum AddAnnotType

+ 3 - 1
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -796,7 +796,7 @@ namespace PDF_Master.ViewModels.Tools
                     ExitAnnotationTool();
                 }
 
-                //ShowPropertyPanel(false);
+                ViewContentViewModel.mainViewModel.AnnotMouseLeftButtonDown = false;
             }
         }
 
@@ -2171,6 +2171,8 @@ namespace PDF_Master.ViewModels.Tools
 
                                     break;
                             }
+
+                            CleanAnnotationSelect();
                         }
                     }
                     else

+ 225 - 122
PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs

@@ -27,30 +27,48 @@ using Prism.Events;
 using System.Windows.Media.Imaging;
 using PDFReader_WPF.Helper;
 using PDF_Master.Properties;
+using PDF_Master.Model.AnnotPanel;
+using System.Diagnostics;
+using ComPDFKit.PDFPage.Edit;
+using ComPDFKit.PDFPage;
+using PDFSettings;
 
 namespace PDF_Master.ViewModels.Tools
 {
-    public class TextEditToolContentViewModel: BindableBase, INavigationAware
+    public class TextEditToolContentViewModel : BindableBase, INavigationAware
     {
         #region 属性与变量
+
+        /// <summary>
+        /// 本地配置中的编辑属性
+        /// </summary>
+        private PDFEditEvent pdfDefaultEditEvent;
+
         public ViewContentViewModel viewContentViewModel;
         private CPDFViewer PDFViewer;
         private IEventAggregator events;
         private IRegionManager regions;
+
         /// <summary>
         /// 用于区分事件的唯一码
         /// </summary>
         private string unicode;
+
         private Dictionary<string, string> btnToProperty = new Dictionary<string, string>();
 
         private bool _isTextEdit = false;
+
         public bool IsTextEdit
         {
             get { return _isTextEdit; }
-            set { SetProperty(ref _isTextEdit, value);
+            set
+            {
+                SetProperty(ref _isTextEdit, value);
             }
         }
+
         private bool _isImgEdit = false;
+
         public bool IsImgEdit
         {
             get { return _isImgEdit; }
@@ -60,7 +78,8 @@ namespace PDF_Master.ViewModels.Tools
             }
         }
 
-        private bool _flg=false;
+        private bool _flg = false;
+
         public bool flg
         {
             get { return _flg; }
@@ -71,6 +90,7 @@ namespace PDF_Master.ViewModels.Tools
         /// 替换图片指令
         /// </summary>
         private bool _ReplaceImgflg = false;
+
         public bool ReplaceImgflg
         {
             get { return _ReplaceImgflg; }
@@ -81,32 +101,39 @@ namespace PDF_Master.ViewModels.Tools
         /// 完成裁剪图片指令
         /// </summary>
         private bool _CropImgflg = false;
+
         public bool CropImgflg
         {
             get { return _CropImgflg; }
             set { SetProperty(ref _CropImgflg, value); }
         }
+
         /// <summary>
         /// 刷新预览图片指令
         /// </summary>
         private bool _REImgflg = false;
+
         public bool REImgflg
         {
             get { return _REImgflg; }
             set { SetProperty(ref _REImgflg, value); }
         }
-        #endregion
+
+        #endregion 属性与变量
 
         #region Command
+
         // 添加文本、图像
         public DelegateCommand<object> AddContentCommand { get; set; }
+
         public DelegateCommand AddTextCommand { get; set; }
         public DelegateCommand AddImgCommand { get; set; }
         public DelegateCommand EditTextModeCommand { get; set; }
 
-        #endregion
+        #endregion Command
 
         #region 初始化
+
         public TextEditToolContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
         {
             events = eventAggregator;
@@ -115,6 +142,7 @@ namespace PDF_Master.ViewModels.Tools
             InitCommand();
             InitBtnToProperty();
         }
+
         private void InitCommand()
         {
             AddContentCommand = new DelegateCommand<object>(AddContent);
@@ -128,10 +156,11 @@ namespace PDF_Master.ViewModels.Tools
             btnToProperty.Add("Text", "TextEditProperty");
             btnToProperty.Add("Image", "ImageEditProperty");
             btnToProperty.Add("TextAndImage", "ImageTextEditProperty");
-            btnToProperty.Add("PropertyPanelContent", "PropertyPanelContent");
+            btnToProperty.Add("PropertyPanelContentEdit", "PropertyPanelContentEdit");
         }
 
-        #endregion
+        #endregion 初始化
+
         #region 右键菜单
 
         //点击空白处时
@@ -154,7 +183,7 @@ namespace PDF_Master.ViewModels.Tools
         {
             var popMenu = App.Current.FindResource("SelectTextMenu") as ContextMenu;
             CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
-         
+
             //复制
             customMenu.SetMenuBinding(0, ApplicationCommands.Copy);
             //剪切
@@ -168,7 +197,7 @@ namespace PDF_Master.ViewModels.Tools
 
             return popMenu;
         }
-       
+
         //选中文字内容
         private ContextMenu SelectTextContent(object sender)
         {
@@ -208,10 +237,11 @@ namespace PDF_Master.ViewModels.Tools
             ////删除
             //customMenu.SetMenuBinding(4, ApplicationCommands.Delete);
 
-
             return popMenu;
         }
-        #endregion
+
+        #endregion 右键菜单
+
         #region 图片右键菜单
 
         //选中图像时
@@ -251,6 +281,7 @@ namespace PDF_Master.ViewModels.Tools
             customMenu.SetMenuBinding(2, new DelegateCommand(RestoreCropImg));
             return popMenu;
         }
+
         //多选图片右键
         private ContextMenu SelectMoreImage(object sender)
         {
@@ -267,11 +298,13 @@ namespace PDF_Master.ViewModels.Tools
             //导出
             customMenu.SetMenuBinding(4, new DelegateCommand(ExportImg));
 
-
             return popMenu;
         }
-        #endregion
+
+        #endregion 图片右键菜单
+
         #region 快捷键
+
         private void ShortCut_KeyDown(object sender, KeyEventArgs e)
         {
             try
@@ -283,35 +316,33 @@ namespace PDF_Master.ViewModels.Tools
                         //缩小esc的操作范围
                         if (PDFViewer.ToolManager != null && PDFViewer.GetPDFEditCreateType() == ComPDFKit.PDFPage.CPDFEditType.EditText)
                         {
-                            if(PDFViewer.GetPDFEditSelectionCount(ComPDFKit.PDFPage.CPDFEditType.EditText) ==0)
-                            {
-                              PDFViewer.RemovePDFEditEmptyText(); 
-                            //只有在有画框的时候才进行
-                            if (PDFViewer.MouseMode == MouseModes.PDFEdit&& PDFViewer.ToolManager.HasTool == true)
+                            if (PDFViewer.GetPDFEditSelectionCount(ComPDFKit.PDFPage.CPDFEditType.EditText) == 0)
                             {
-                                PDFViewer.RemoveTool(false);
-                            }
-                            else if (IsTextEdit == true || IsImgEdit == true)
-                            {
-                                IsImgEdit = false;
-                                IsTextEdit = false;
-                                PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.None);
+                                PDFViewer.RemovePDFEditEmptyText();
+                                //只有在有画框的时候才进行
+                                if (PDFViewer.MouseMode == MouseModes.PDFEdit && PDFViewer.ToolManager.HasTool == true)
+                                {
+                                    PDFViewer.RemoveTool(false);
+                                }
+                                else if (IsTextEdit == true || IsImgEdit == true)
+                                {
+                                    IsImgEdit = false;
+                                    IsTextEdit = false;
+                                    PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.None);
 
-                                //文本和图像都框选
-                                PDFViewer.SetPDFEditType(ComPDFKit.PDFPage.CPDFEditType.EditText | ComPDFKit.PDFPage.CPDFEditType.EditImage);
-                                PDFViewer.SetMouseMode(MouseModes.PDFEdit);                           
-                                PDFViewer.ReloadDocument();
-                                ShowPropertyPanel(false);
-                            }
+                                    //文本和图像都框选
+                                    PDFViewer.SetPDFEditType(ComPDFKit.PDFPage.CPDFEditType.EditText | ComPDFKit.PDFPage.CPDFEditType.EditImage);
+                                    PDFViewer.SetMouseMode(MouseModes.PDFEdit);
+                                    PDFViewer.ReloadDocument();
+                                    ShowPropertyPanel(false);
+                                }
                             }
                             {
                                 PDFViewer.ClearSelectPDFEdit();
                                 PDFViewer.RemovePDFEditEmptyText();
                                 PDFViewer.ReloadDocument();
                             }
-                          
                         }
-
                         else if (PDFViewer.ToolManager != null && PDFViewer.GetPDFEditCreateType() == ComPDFKit.PDFPage.CPDFEditType.EditImage)
                         {
                             if (PDFViewer.GetPDFEditSelectionCount(ComPDFKit.PDFPage.CPDFEditType.EditImage) == 0)
@@ -340,26 +371,21 @@ namespace PDF_Master.ViewModels.Tools
                                 PDFViewer.ReloadDocument();
                             }
                         }
-                        
-
-
-
-
+                        else if (PDFViewer.ToolManager != null)
+                        {
+                            PDFViewer.ClearSelectPDFEdit();
+                            AddToPropertyPanel("PropertyPanelContentEdit", null);
+                            PDFViewer.ReloadDocument();
+                        }
                     }
                 }
-
-
-
             }
             catch
             {
-
             }
-           
-          
-
         }
-        #endregion
+
+        #endregion 快捷键
 
         //模式选择进入
         public void AddContent(object obj)
@@ -371,21 +397,21 @@ namespace PDF_Master.ViewModels.Tools
                 IsImgEdit = false;
                 IsTextEdit = false;
                 PDFViewer.SetPDFEditType(ComPDFKit.PDFPage.CPDFEditType.None);
-                PDFViewer.ReloadDocument();              
+                PDFViewer.ReloadDocument();
                 App.mainWindowViewModel.OpenLogin();
                 return;
             }
             var btn = obj as CustomIconToggleBtn;
             EnterEditMode((bool)btn.IsChecked, btn.Tag.ToString());
         }
+
         //编辑按钮逻辑,暂时保留
         private void EditTextMode()
         {
-
         }
-        
+
         //对应模式的逻辑
-        private void EnterEditMode(bool isCheckMode,string modeType)
+        private void EnterEditMode(bool isCheckMode, string modeType)
         {
             if (isCheckMode)
             {
@@ -404,7 +430,19 @@ namespace PDF_Master.ViewModels.Tools
                     PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                     PDFViewer.ReloadDocument();
                     PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditText);
-                    AddToPropertyPanel("Text", null);
+
+                    pdfDefaultEditEvent = PDFEditHelper.GetPDFEditDefaultProperty(out DefaultEditProperty defaultEdit, PDFViewer);
+
+                    //单击添加文本
+                    PDFViewer.ToolManager.EnableClickCreate = true;
+                    PDFViewer.ToolManager.ClickCreateWidth = 60;
+                    PDFViewer.ToolManager.ClickCreateHeight = 30;
+                    List<PDFEditEvent> pdfEditEvents = new List<PDFEditEvent>();
+                    if (pdfDefaultEditEvent != null)
+                    {
+                        pdfEditEvents.Add(pdfDefaultEditEvent);
+                    }
+                    AddToPropertyPanel("Text", pdfEditEvents);
                     ShowPropertyPanel(true);
                 }
                 else
@@ -422,15 +460,23 @@ namespace PDF_Master.ViewModels.Tools
                     PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
                     PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                     PDFViewer.ReloadDocument();
-                    AddToPropertyPanel("PropertyPanelContent", null);
+                    //未设置,将无法触发Active事件
+                    PDFViewer.ToolManager.EnableClickCreate = true;
+                    PDFViewer.ToolManager.ClickCreateWidth = 60;
+                    PDFViewer.ToolManager.ClickCreateHeight = 30;
+                    AddToPropertyPanel("PropertyPanelContentEdit", null);
                     ShowPropertyPanel(true);
-                    
                 }
             }
             else
             {
                 IsImgEdit = false;
                 IsTextEdit = false;
+
+                //添加按钮取消选中 清除空文本和选中文本框的状态
+                PDFViewer.ClearSelectPDFEdit();
+                PDFViewer.RemovePDFEditEmptyText();
+
                 PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.None);
 
                 //文本和图像都框选
@@ -438,7 +484,6 @@ namespace PDF_Master.ViewModels.Tools
                 PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                 PDFViewer.ReloadDocument();
                 ShowPropertyPanel(false);
-
             }
         }
 
@@ -453,12 +498,12 @@ namespace PDF_Master.ViewModels.Tools
         {
             EnterEditMode(true, "Image");
         }
+
         //进入裁剪模式
         private void CropMode()
         {
             if (TextEditEvent != null)
             {
-              
                 TextEditEvent.ClipImage = true;
                 TextEditEvent.UpdatePDFEditByEventArgs();
                 flg = true;
@@ -485,16 +530,14 @@ namespace PDF_Master.ViewModels.Tools
                 TextEditEvent.RestoreClip();
                 events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
             }
-            
         }
 
         //完成裁剪
         private void CropImg()
         {
-
             CropImgflg = true;
-          
         }
+
         //导出图片
         private void ExportImg()
         {
@@ -523,16 +566,19 @@ namespace PDF_Master.ViewModels.Tools
                 CommonHelper.ShowFileBrowser(strFilePath);
             }
         }
-            //替换图片
-            private void ReplaceImg()
+
+        //替换图片
+        private void ReplaceImg()
         {
             ReplaceImgflg = true;
         }
 
-      
         //选中的图像
         private System.Windows.Media.Imaging.BitmapSource _currentImg;
-        public System.Windows.Media.Imaging.BitmapSource CurrentImg { get { return _currentImg; } set { SetProperty(ref _currentImg, value); } }
+
+        public System.Windows.Media.Imaging.BitmapSource CurrentImg
+        { get { return _currentImg; } set { SetProperty(ref _currentImg, value); } }
+
         private void GetImagePreView()
         {
             try
@@ -557,21 +603,17 @@ namespace PDF_Master.ViewModels.Tools
                         System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
                         CurrentImg = bitmapSource;
                     }
-
                 }
             }
             catch
             {
-
             }
-
         }
-        #endregion
-
 
+        #endregion Command功能
 
         //传参数给属性面板
-        private void AddToPropertyPanel(string type,  List<PDFEditEvent> e)
+        private void AddToPropertyPanel(string type, List<PDFEditEvent> e)
         {
             if (btnToProperty.ContainsKey(type))
             {
@@ -580,15 +622,15 @@ namespace PDF_Master.ViewModels.Tools
                 parameters.Add(ParameterNames.AnnotEvent, e);
                 parameters.Add(ParameterNames.TextEditToolContentViewModel, this);
                 System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
-                {
-                    regions.RequestNavigate(RegionNames.PropertyRegionName, btnToProperty[type], parameters);
-                }));
+                                                        {
+                                                            regions.RequestNavigate(RegionNames.PropertyRegionName, btnToProperty[type], parameters);
+                                                        }));
 
-                if(e!=null)
+                if (e != null)
                 {
                     ShowPropertyPanel(true);
                 }
-                else if(e==null&&IsImgEdit==false&&IsTextEdit==false)
+                else if (e == null && IsImgEdit == false && IsTextEdit == false)
                 {
                     ShowPropertyPanel(false);
                 }
@@ -613,18 +655,17 @@ namespace PDF_Master.ViewModels.Tools
                     PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                     PDFViewer.ReloadDocument();
                     PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.None);
-                    AddToPropertyPanel("PropertyPanelContent", null);
+                    AddToPropertyPanel("PropertyPanelContentEdit", null);
                     ShowPropertyPanel(false);
                 }
                 else
                 {
-
                     PDFViewer.SetPDFEditType(ComPDFKit.PDFPage.CPDFEditType.None);
                     PDFViewer.ReloadDocument();
-
                 }
             }
         }
+
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
@@ -641,7 +682,6 @@ namespace PDF_Master.ViewModels.Tools
                 PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
                 PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
 
-
                 //图片添加
                 PDFViewer.CustomNotifyHandler -= PDFViewer_CustomNotifyHandler;
                 PDFViewer.CustomNotifyHandler += PDFViewer_CustomNotifyHandler;
@@ -652,18 +692,57 @@ namespace PDF_Master.ViewModels.Tools
 
                 KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
                 KeyEventsHelper.KeyDown += ShortCut_KeyDown;
+
+                pdfDefaultEditEvent = PDFEditHelper.GetPDFEditDefaultProperty(out DefaultEditProperty defaultEdit, PDFViewer);
             }
         }
 
-        private void PDFViewer_PDFEditHandler(object sender, List<PDFEditSelectionData> e)
+        private async void PDFViewer_PDFEditHandler(object sender, List<PDFEditSelectionData> e)
         {
-            PDFViewer.SelectPDFEdit(e,true);
+            #region 后续 Undo 操作
+
+            //if (e != null && e.Count > 0)
+            //{
+            //    foreach (var item in e)
+            //    {
+            //        if (item is PDFEditSelectionData editSelectionData)
+            //        {
+            //            switch (editSelectionData.Action)
+            //            {
+            //                case ActionType.Add:
+            //                    PDFViewer.ClearSelectPDFEdit();
+            //                    PDFViewer.SelectPDFEdit(e, true);
+            //                    break;
+
+            //                case ActionType.Modify:
+
+            //                    break;
+            //            }
+            //        }
+            //    }
+            //}
+
+            #endregion 后续 Undo 操作
+
+            PDFViewer.ClearSelectPDFEdit();
+            if (e != null)
+            {
+                //需要区分 图片和文本,不然框选添加 文本,会出现光标消失
+                if (e[0].EditType == CPDFEditType.EditImage)
+                {
+                    //延时 =》添加图片,弹出系统文件弹窗,双击选中图片后添加到页面上,需要选中图片
+                    await Task.Delay(50);
+                }
+            }
+            PDFViewer.SelectPDFEdit(e, true);
         }
 
         protected PDFEditEvent TextEditEvent;
+
         //左键激活逻辑
         private void PDFViewer_PDFEditActiveHandler(object sender, List<PDFEditEvent> e)
         {
+            PDFViewer.ToolManager.IgnoreMoveDistance = 5;
             //判断是否已退出登录,限制编辑操作
             if (!App.IsLogin)
             {
@@ -674,14 +753,15 @@ namespace PDF_Master.ViewModels.Tools
                 App.mainWindowViewModel.OpenLogin();
                 return;
             }
+            //从配置文件拿样式
+            pdfDefaultEditEvent = PDFEditHelper.GetPDFEditDefaultProperty(out DefaultEditProperty defaultEdit, PDFViewer);
             if (e != null && e.Count > 0)
             {
-                TextEditEvent=e[0];
+                TextEditEvent = e[0];
                 bool isText = false;
                 bool isImg = false;
                 foreach (var item in e)
                 {
-
                     if (item.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
                     {
                         isImg = true;
@@ -691,40 +771,75 @@ namespace PDF_Master.ViewModels.Tools
                     {
                         isText = true;
                     }
-
                 }
 
-
                 if (isText == true && isImg == false)
                 {
+                    if (e.Count == 1 && string.IsNullOrEmpty(e[0].FontName))
+                    {
+                        e = SynchronizeToPropertyPanel(e, defaultEdit);
+                    }
                     AddToPropertyPanel("Text", e);
-                  
                 }
                 if (isText == false && isImg == true)
                 {
                     AddToPropertyPanel("Image", e);
-                 
                 }
                 if (isText == true && isImg == true)
                 {
                     AddToPropertyPanel("TextAndImage", e);
-                   
                 }
             }
-
-            else if(IsTextEdit==true)
-            {
-                AddToPropertyPanel("PropertyPanelContent", null);
-                AddToPropertyPanel("Text", null);
-            }
+            ///未事先设置 if里面的内容,单击添加文本会失败
+            //else if(IsTextEdit==true)
+            //{
+            //    //单击添加文本
+            //    PDFViewer.ToolManager.EnableClickCreate = true;
+            //    PDFViewer.ToolManager.ClickCreateWidth = 60;
+            //    PDFViewer.ToolManager.ClickCreateHeight = 30;
+            //    AddToPropertyPanel("Text", null);
+            //}
             else
             {
-
-                AddToPropertyPanel("PropertyPanelContent", null);
+                Trace.WriteLine("PropertyPanelContentEdit");
+                AddToPropertyPanel("PropertyPanelContentEdit", null);
             }
 
             events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
+        }
 
+        /// <summary>
+        /// 拿配置文件的属性,刷新属性面板
+        /// </summary>
+        /// <param name="e"></param>
+        /// <param name="defaultEdit"></param>
+        /// <returns></returns>
+        private List<PDFEditEvent> SynchronizeToPropertyPanel(List<PDFEditEvent> e, DefaultEditProperty defaultEdit)
+        {
+            List<PDFEditEvent> editEvents = new List<PDFEditEvent>();
+            PDFEditEvent editEvent = e[0];
+
+            if (defaultEdit != null)
+            {
+                editEvent.FontName = defaultEdit.FontName;
+                editEvent.FontSize = defaultEdit.FontSize;
+                editEvent.TextAlign = defaultEdit.TextAlign;
+                editEvent.AutoBlock = false;
+                //editEvent.ClipImage = defaultEdit.ClipImage;
+                //editEvent.EditType = defaultEdit.EditType;
+                editEvent.FontColor = defaultEdit.FontColor;
+                //editEvent.HorizontalMirror = defaultEdit.HorizontalMirror;
+                //editEvent.VerticalMirror = defaultEdit.VerticalMirror;
+                editEvent.IsBold = defaultEdit.IsBold;
+                editEvent.IsItalic = defaultEdit.IsItalic;
+                //editEvent.ReplaceImagePath = defaultEdit.ReplaceImagePath;
+                //editEvent.Rotate = defaultEdit.Rotate;
+                //editEvent.Transparency = defaultEdit.Transparency;
+                //PDFViewer.SetPDFEditParam(editEvent);
+                e[0] = editEvent;
+                editEvents = e;
+            }
+            return editEvents;
         }
 
         //右键点击逻辑
@@ -740,34 +855,28 @@ namespace PDF_Master.ViewModels.Tools
                     if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.None)//点击空白区域
                     {
                         e.PopupMenu = EmptyStateMenu(sender);
-
                     }
                     else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
                     {
-
-                         
                         //文字编辑
                         if (e.PressOnBorder == true)
                         {
                             e.PopupMenu = SelectTextBorder(sender);
                         }
-
-                         else if(e.PressOnSelectedText == true)
+                        else if (e.PressOnSelectedText == true)
                         {
                             e.PopupMenu = SelectTextContent(sender);
                         }
-
-                        else if(e.SelectText=="")
+                        else if (e.SelectText == "")
                         {
-                            e.PopupMenu= EditTextContent(sender);
+                            e.PopupMenu = EditTextContent(sender);
                         }
                         else
                         {
                             e.PopupMenu = SelectTextContent(sender);
                         }
-
                     }
-                   else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
+                    else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
                     {
                         if (e.IsClipState == true)
                         {
@@ -777,15 +886,13 @@ namespace PDF_Master.ViewModels.Tools
                         {
                             e.PopupMenu = SelectImgPDFEdit(sender);
                         }
-
                     }
-                  
-                        break;
+
+                    break;
 
                 default:
                     e.DoCommand();
                     break;
-
             }
             if (e.PopupMenu != null)
             {
@@ -794,23 +901,22 @@ namespace PDF_Master.ViewModels.Tools
             flg = e.IsClipState;
         }
 
-
         //图片添加逻辑
         private void PDFViewer_CustomNotifyHandler(object sender, CustomNotityData e)
         {
             //图片创建
             if (e.NotifyType == CustomNotifyType.PDFEditImageCreate)
+            {
+                OpenFileDialog openFileDialog = new OpenFileDialog();
+                openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
+                if (openFileDialog.ShowDialog() == true)
                 {
-                    OpenFileDialog openFileDialog = new OpenFileDialog();
-                    openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
-                    if (openFileDialog.ShowDialog() == true)
-                    {                 
-                    PDFViewer.AddPDFEditImage(CompressImage(openFileDialog.FileName, 800), 500,500);
+                    PDFViewer.AddPDFEditImage(CompressImage(openFileDialog.FileName, 800), 500, 500);
                     events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
                 }
-                }
+            }
             //图片调整大小
-            else if(e.NotifyType == CustomNotifyType.PDFEditImageResize)
+            else if (e.NotifyType == CustomNotifyType.PDFEditImageResize)
             {
                 REImgflg = true;
                 events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
@@ -872,7 +978,6 @@ namespace PDF_Master.ViewModels.Tools
             }
         }
 
-
         /// <summary>
         ///  根据图片数据判断图片类型
         /// </summary>
@@ -896,7 +1001,6 @@ namespace PDF_Master.ViewModels.Tools
                 }
                 catch
                 {
-
                     extension = FileExtension.VALIDFILE;
                 }
                 return extension;
@@ -919,18 +1023,17 @@ namespace PDF_Master.ViewModels.Tools
         {
             return true;
         }
-       
+
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             IsImgEdit = false;
             IsTextEdit = false;
             PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
             PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
-             PDFViewer.CustomNotifyHandler -= PDFViewer_CustomNotifyHandler;
+            PDFViewer.CustomNotifyHandler -= PDFViewer_CustomNotifyHandler;
             PDFViewer.PDFEditHandler -= PDFViewer_PDFEditHandler;
             KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
             ShowPropertyPanel(false);
         }
-
     }
-}
+}

+ 103 - 34
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -226,6 +226,11 @@ namespace PDF_Master.ViewModels
 
         #region 属性、变量
 
+        /// <summary>
+        /// 用于退出页面编辑 设置bota搜索框
+        /// </summary>
+        private SearchContent searchContent = null;
+
         /// <summary>
         /// 显示 隐藏注释
         /// </summary>
@@ -703,6 +708,7 @@ namespace PDF_Master.ViewModels
                 //关闭BOTA的逻辑在xaml.cs代码里控制,无法绑定后台
             }
         }
+
         /// <summary>
         /// 防止自动保存异步导致弹窗出现两次
         /// </summary>
@@ -736,6 +742,12 @@ namespace PDF_Master.ViewModels
         /// </summary>
         private double[] zoomLevel = { 1.00f, 10, 25, 50, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000, 2000, 4000, 10000 };
 
+        /// <summary>
+        /// 鼠标滚轮缩放的缩放值
+        /// 为了提高滚轮缩放 丝滑度
+        /// </summary>
+        private double[] zoomLevel2 = { 1.00f, 10, 15, 20, 25, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 135, 145, 150, 160, 170, 180, 190, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1400, 1600, 2000, 3000, 4000, 6000, 10000 };
+
         /// <summary>
         /// 注释-链接,提示语
         /// </summary>
@@ -883,7 +895,9 @@ namespace PDF_Master.ViewModels
 
         public DelegateCommand ZoomOutCommand { get; set; }
 
-        //是否显示视图面板
+        /// <summary>
+        /// 是否显示视图面板
+        /// </summary>
         public bool IsReadModeShow { get; internal set; } = false;
 
         #endregion 命令
@@ -1712,11 +1726,11 @@ namespace PDF_Master.ViewModels
 
         private async void share()
         {
-            if (IsPopupInProgress) 
+            if (IsPopupInProgress)
             {
                 return;
             }
-            IsPopupInProgress=true;
+            IsPopupInProgress = true;
             try
             {
                 DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Share");
@@ -1954,7 +1968,7 @@ namespace PDF_Master.ViewModels
         }
 
         public void ShowPrintDialog()
-        { 
+        {
             //保存并继续,使用了高级功能则弹窗权益弹窗
             if (!saveFile(true))
             {
@@ -2186,28 +2200,87 @@ namespace PDF_Master.ViewModels
                 var item = args.AddedItems[0] as TabItem;
                 CurrentBar = item.Name;
                 TabControlSelectonDataTracking(item.Name);
+
                 if (previousBar != CurrentBar)
                 {
                     if (CurrentBar == "TabItemPageEdit")//如果是页面编辑则进入页面编辑模式
                     {
                         EnterPageEdit();
+                        searchContent = CleanSearch();
                     }
                     else//其余情况直接导航至对应的工具栏即可,不需要清空之前的content,region里是单例模式
                     {
                         EnterSelectedBar(CurrentBar);
                         isInPageEdit = false;
+                        SearchTextFocus(searchContent);
                     }
                     previousBar = CurrentBar;
                 }
             }
         }
+
+        public void SearchTextFocus(SearchContent searchContent)
+        {
+            if (searchContent != null && searchContent.SearchText != null && string.IsNullOrEmpty(searchContent.SearchText.Text) == false)
+            {
+                searchContent.SearchText.Dispatcher.BeginInvoke(new Action(() =>
+                {
+                    searchContent.SearchText.Focus();
+                    searchContent.SearchText.SelectAll();
+                }));
+            }
+        }
+
+        private SearchContent CleanSearch()
+        {
+            SearchContent searchContent = null;
+            if (this.OpenBOTA)
+            {
+                bool isTabItemSearch = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemSearch");
+                if (bOTAContent.TabItemSearch.IsSelected)
+                {
+                    SearchContentViewModel viewModel = GetSearchContentVM(bOTAContentViewModel, out searchContent);
+                    if (viewModel.SearchItemList.Count > 0)
+                    {
+                        PDFViewer.ClearPageSelectText();
+                        viewModel.SearchItemList.Clear();
+                    }
+                }
+            }
+            return searchContent;
+        }
+
+        private SearchContentViewModel GetSearchContentVM(BOTAContentViewModel bOTAContentViewModel, out SearchContent searchContent)
+        {
+            SearchContentViewModel viewModel = null;
+            searchContent = null;
+            if (bOTAContentViewModel != null)
+            {
+                if (region.Regions.ContainsRegionWithName(bOTAContentViewModel.BOTAContentRegionName))
+                {
+                    var views = region.Regions[bOTAContentViewModel.BOTAContentRegionName].Views;
+                    foreach (var item in views)
+                    {
+                        if (item is SearchContent search)
+                        {
+                            searchContent = search;
+                            viewModel = search.DataContext as SearchContentViewModel;
+                            break;
+                        }
+                    }
+                }
+            }
+            return viewModel;
+        }
+
         /// <summary>
         /// 选项卡切换事件埋点
         /// </summary>
         /// <param name="e"></param>
         private void TabControlSelectonDataTracking(string currentBar)
         {
-            switch (currentBar) {
+            switch (currentBar)
+            {
                 case "TabItemAnnotation":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Annotation");
                     break;
@@ -2215,24 +2288,26 @@ namespace PDF_Master.ViewModels
                 case "TabItemEdit":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_EditPDF");
                     break;
+
                 case "TabItemPageEdit":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_PageEdit");
                     break;
+
                 case "TabItemConvert":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Converter");
                     break;
+
                 case "TabItemTool":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Tools");
                     break;
             }
-        
         }
 
-            /// <summary>
-            /// 进入页面编辑模式
-            /// </summary>
-            //工具栏添加功能应注意自处
-            public void EnterPageEdit()
+        /// <summary>
+        /// 进入页面编辑模式
+        /// </summary>
+        //工具栏添加功能应注意自处
+        public void EnterPageEdit()
         {
             if (TabSelectedIndex != 2)
             {
@@ -2464,16 +2539,16 @@ namespace PDF_Master.ViewModels
             }
 
             zoom *= 100;
-            for (int i = 0; i < zoomLevel.Length - 1; i++)
+            for (int i = 0; i < zoomLevel2.Length - 1; i++)
             {
-                if (zoom > zoomLevel[i] && zoom <= zoomLevel[i + 1] && IsGrowth)
+                if (zoom > zoomLevel2[i] && zoom <= zoomLevel2[i + 1] && IsGrowth)
                 {
-                    standardZoom = zoomLevel[i + 1];
+                    standardZoom = zoomLevel2[i + 1];
                     break;
                 }
-                if (zoom >= zoomLevel[i] && zoom < zoomLevel[i + 1] && !IsGrowth)
+                if (zoom >= zoomLevel2[i] && zoom < zoomLevel2[i + 1] && !IsGrowth)
                 {
-                    standardZoom = zoomLevel[i];
+                    standardZoom = zoomLevel2[i];
                     break;
                 }
             }
@@ -2600,6 +2675,7 @@ namespace PDF_Master.ViewModels
                 events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
             }
         }
+
         private void Redo()
         {
             PDFViewer.UndoManager.Redo();
@@ -2824,7 +2900,7 @@ namespace PDF_Master.ViewModels
                 //是否取消了水印保存步骤
                 bool flg = false;
                 //删掉Settings.Default.UserDate.isInFreeUseTime == false,没有试用期策略了
-                if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) && (App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).IsUsedVIP == true)
+                if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) && ((App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).IsUsedVIP == true || PDFViewer.UndoManager.PDFEditChanged == true))
                 {
                     DialogParameters value = new DialogParameters();
                     value.Add(ParameterNames.ViewContentViewModel, this);
@@ -2912,7 +2988,7 @@ namespace PDF_Master.ViewModels
                     {
                         string currentPath = PDFViewer.Document.FilePath;
                         string tempPath = PDFViewer.Document.FilePath + ".temp.pdf";
-                        if (PDFViewer.Document.Descrypt(tempPath))
+                        if (PDFViewer.Document.Decrypt(tempPath))
                         {
                             PDFViewer.CloseDocument();
                             PDFViewer.InitDocument(tempPath);
@@ -2975,7 +3051,7 @@ namespace PDF_Master.ViewModels
                     {
                         string currentPath = PDFViewer.Document.FilePath;
                         string tempPath = PDFViewer.Document.FilePath + ".temp.pdf";
-                        PDFViewer.Document.Descrypt(tempPath);
+                        PDFViewer.Document.Decrypt(tempPath);
                         PDFViewer.CloseDocument();
                         PDFViewer.InitDocument(tempPath);
                         PDFViewer.Document.WriteToFilePath(currentPath);
@@ -3187,7 +3263,7 @@ namespace PDF_Master.ViewModels
                             DoAfterSaveAs(dlg.FileName);
                         }
                         else
-                        {   //提示文件被其他软件占用 无法保存          
+                        {   //提示文件被其他软件占用 无法保存
                             AlertsMessage alertsMessage = new AlertsMessage();
                             alertsMessage.ShowDialog(App.MainPageLoader.GetString("Main_SaveFailed"), App.MainPageLoader.GetString("Main_TheFileOccupiedWarning"), App.ServiceLoader.GetString("Text_cancel"), App.ServiceLoader.GetString("Text_ok"));
                         }
@@ -3201,7 +3277,7 @@ namespace PDF_Master.ViewModels
             {
                 bool flg = false;
                 //删掉Settings.Default.UserDate.isInFreeUseTime == false,没有试用期策略了
-                if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) && (App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).IsUsedVIP == true)
+                if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) && ((App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).IsUsedVIP == true || PDFViewer.UndoManager.PDFEditChanged == true))
                 {
                     DialogParameters value = new DialogParameters();
                     value.Add(ParameterNames.ViewContentViewModel, this);
@@ -3332,15 +3408,14 @@ namespace PDF_Master.ViewModels
         /// <summary>
         /// 转档、压缩、合并、分享前自动保存
         /// </summary>
-        public async Task<bool> SaveBeforeOption(bool NoIAP=false)
+        public async Task<bool> SaveBeforeOption(bool NoIAP = false)
         {
-            if(NoIAP == false)
+            if (NoIAP == false)
             {            //添加付费拦截锁
                 if (!ServiceHelper.IAPBeforeFunction())
                 {
                     return false;
                 }
-
             }
             bool result = true;
             //因配合权益弹窗弹出,暂时移除可保存条件判断
@@ -3370,7 +3445,8 @@ namespace PDF_Master.ViewModels
             }
             bool flg = false;
             //权益弹窗
-            if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) && (App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).IsUsedVIP == true)
+            //PDFViewer.UndoManager.PDFEditChanged为是否在编辑中对文档进行了改动
+            if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) && ((App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).IsUsedVIP == true || PDFViewer.UndoManager.PDFEditChanged == true))
             {
                 DialogParameters value = new DialogParameters();
                 value.Add(ParameterNames.ViewContentViewModel, this);
@@ -3388,7 +3464,7 @@ namespace PDF_Master.ViewModels
 
                 if (flg == false)
                 {
-                    return ;
+                    return;
                 }
             }
             var dlg = new SaveFileDialog();
@@ -3560,14 +3636,6 @@ namespace PDF_Master.ViewModels
 
         private void EnterSelectedBar(string currentBar)
         {
-            if (currentBar == "TabItemEdit")
-            {
-                if (!ServiceHelper.IAPBeforeFunction())
-                {          
-                    isInPageEdit = false;
-                    return;
-                }
-            }
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, PDFViewer);
             param.Add(ParameterNames.ViewContentViewModel, this);
@@ -3600,6 +3668,7 @@ namespace PDF_Master.ViewModels
         {
             ServiceHelper.GetUser();
         }
+
         #endregion 方法
 
         #region Navigate

+ 1 - 0
PDF Office/Views/BOTA/AnnotationContent.xaml

@@ -59,6 +59,7 @@
                 HorizontalContentAlignment="Stretch"
                 Background="{StaticResource color.sys.layout.mg}"
                 BorderThickness="0"
+                FocusVisualStyle="{x:Null}"
                 ItemTemplate="{StaticResource AnnotationListItemTemplate}"
                 ItemsSource="{Binding AnnotationListItems}"
                 MouseDown="ListBox_MouseDown"

+ 103 - 73
PDF Office/Views/BOTA/AnnotationContent.xaml.cs

@@ -44,7 +44,7 @@ namespace PDF_Master.Views.BOTA
     /// </summary>
     public partial class AnnotationContent : UserControl
     {
-        private AnnotationContentViewModel viewModel;
+        public AnnotationContentViewModel viewModel;
 
         private string unicode;
 
@@ -62,105 +62,140 @@ namespace PDF_Master.Views.BOTA
             eventAggregator.GetEvent<RefreshAnnotationEvent>().Subscribe(ExpandGroupHeader, e => e.Unicode == unicode);
         }
 
-        private async void ExpandGroupHeader(RefreshAnnotationArgs obj)
+        public async void ExpandGroupHeader(RefreshAnnotationArgs obj)
         {
             if (obj.IsAll)
             {
-                try
+                ExpandAllGroupHeader(obj);
+            }
+            else
+            {
+                //需要时间加载完 listbox所有的控件模板
+                await Task.Delay(200);
+                ExpandOneGroupHeader(obj);
+            }
+        }
+
+        private async void ExpandAllGroupHeader(RefreshAnnotationArgs obj)
+        {
+            try
+            {
+                foreach (var item in AnnotationList.Items)
                 {
-                    foreach (var item in AnnotationList.Items)
+                    var groups = AnnotationList.Items.Groups;
+
+                    for (int i = 0; i < groups.Count; i++)
                     {
-                        var groups = AnnotationList.Items.Groups;
-                        for (int i = 0; i < groups.Count; i++)
+                        if (groups[i] is CollectionViewGroup group)
                         {
-                            var group = groups[i] as CollectionViewGroup;
                             if (group.Items.Contains(item))
                             {
-                                await Task.Delay(2);
                                 var scroller = GetScrollHost(AnnotationList);
                                 var stackpanel = CommonHelper.FindVisualChild<StackPanel>(scroller);
-                                var groupItem = VisualTreeHelper.GetChild(stackpanel, i) as GroupItem;
-                                var g = CommonHelper.FindVisualChild<Expander>(groupItem);
-                                if (g != null)
+                                if (stackpanel == null)
                                 {
-                                    g.IsExpanded = true;
+                                    await Task.Delay(1);
                                 }
                                 else
                                 {
-                                    await Task.Delay(5);
-                                    g = CommonHelper.FindVisualChild<Expander>(groupItem);
-                                    if (g != null)
-                                    {
-                                        g.IsExpanded = true;
-                                    }
+                                    GroupItemExpanded(stackpanel, i);
                                 }
                             }
                         }
                     }
                 }
-                catch { }
             }
-            else
+            catch (Exception ex) { }
+        }
+
+        public async void ExpandOneGroupHeader(RefreshAnnotationArgs obj)
+        {
+            if (obj.annotHandlerArgs == null)
+            {
+                if (obj.Pageindex != -1 && obj.AnnotIndex != -1)
+                {
+                    List<AnnotationHandlerEventArgs> annotations = AnnotationList.Items.Cast<AnnotationHandlerEventArgs>().ToList();
+                    obj.annotHandlerArgs = annotations.FirstOrDefault(x => x.PageIndex == obj.Pageindex && x.AnnotIndex == obj.AnnotIndex);
+                }
+            }
+
+            if (obj.annotHandlerArgs != null)
             {
-                if (obj.annotHandlerArgs != null)
+                try
                 {
-                    try
+                    var groups = AnnotationList.Items.Groups;
+                    if (groups != null && groups.Count > 0)
                     {
-                        var groups = AnnotationList.Items.Groups;
-                        if (groups != null && groups.Count > 0)
+                        for (int i = 0; i < groups.Count; i++)
                         {
-                            for (int i = 0; i < groups.Count; i++)
+                            if (groups[i] is CollectionViewGroup group)
                             {
-                                var l = groups[i] as CollectionViewGroup;
-                                if (l.Items.Contains(obj.annotHandlerArgs))
+                                if (group.Items.Contains(obj.annotHandlerArgs))
                                 {
-                                    await Task.Delay(5);
                                     var scroller = GetScrollHost(AnnotationList);
                                     var stackpanel = CommonHelper.FindVisualChild<StackPanel>(scroller);
-                                    var groupItem = VisualTreeHelper.GetChild(stackpanel, i) as GroupItem;
-                                    if (groupItem != null)
+                                    if (stackpanel != null)
                                     {
-                                        var g = CommonHelper.FindVisualChild<Expander>(groupItem);
-                                        if (g != null)
-                                        {
-                                            g.IsExpanded = true;
-                                        }
-                                        else
+                                        GroupItemExpanded(stackpanel, i);
+                                    }
+                                    else
+                                    {
+                                        ItemsPresenter itemsPresenter = CommonHelper.FindVisualChild<ItemsPresenter>(scroller);
+                                        if (itemsPresenter != null)
                                         {
-                                            await Task.Delay(5);
-                                            g = CommonHelper.FindVisualChild<Expander>(groupItem);
-                                            if (g != null)
-                                            {
-                                                g.IsExpanded = true;
-                                            }
+                                            var tt = VisualTreeHelper.GetChild(itemsPresenter, i);
+                                            int count = VisualTreeHelper.GetChildrenCount(tt);
                                         }
                                     }
                                 }
-                                else
-                                {
-                                }
                             }
                         }
+                    }
 
-                        if (obj.IsSelect && obj.annotHandlerArgs != null)
-                        {
-                            if (viewModel.ViewContentViewModel.IsMultiSelected == false)
-                            {
-                                if (AnnotationList.SelectedItems.IndexOf(obj.annotHandlerArgs) == -1)
-                                {
-                                    viewModel.IsModified = false;
-                                    AnnotationList.SelectedItem = obj.annotHandlerArgs;
-                                }
-                            }
-                        }
-                        if (obj.IsDel)
+                    if (obj.IsDel)
+                    {
+                        viewModel.IsModified = true;
+                    }
+                    await Task.Delay(10);//不加延时 会有不滚动的现象
+                    SelectedItems(obj);
+                }
+                catch (Exception ex) { }
+            }
+        }
+
+        private void GroupItemExpanded(StackPanel stackpanel, int i)
+        {
+            int count = VisualTreeHelper.GetChildrenCount(stackpanel);
+            if (count > 0)
+            {
+                if (VisualTreeHelper.GetChild(stackpanel, i) is GroupItem groupItem)
+                {
+                    var expander = CommonHelper.FindVisualChild<Expander>(groupItem);
+                    if (expander != null)
+                    {
+                        if (expander.IsExpanded == false)
                         {
-                            viewModel.IsModified = true;
+                            expander.IsExpanded = true;
                         }
-                        await Task.Delay(2);//不加延时 会有不滚动的现象
-                        AnnotationList.ScrollIntoView(obj.annotHandlerArgs);
                     }
-                    catch { }
+                }
+            }
+        }
+
+        private async void SelectedItems(RefreshAnnotationArgs obj)
+        {
+            if (obj.IsSelect && obj.annotHandlerArgs != null)
+            {
+                if (viewModel.ViewContentViewModel.IsMultiSelected == false)
+                {
+                    if (AnnotationList.SelectedItems.IndexOf(obj.annotHandlerArgs) == -1)
+                    {
+                        viewModel.IsModified = false;
+                        AnnotationList.SelectedItem = obj.annotHandlerArgs;
+                        AnnotationList.SelectedIndex = AnnotationList.Items.IndexOf(obj.annotHandlerArgs);
+                    }
+                    await Task.Delay(10);//不加延时 会有不滚动的现象
+                    AnnotationList.ScrollIntoView(AnnotationList.SelectedItem);
                 }
             }
         }
@@ -466,28 +501,22 @@ namespace PDF_Master.Views.BOTA
 
         private void AnnotationList_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            //var a = AnnotationList.SelectedItems.Count;
-            var a1 = (sender as ListBox).SelectedItems.Count;
-            //var a2 = (e.OriginalSource as ListBox).SelectedItems.Count;
-            //var a3 = (e.Source as ListBox).SelectedItems.Count;
-            //Trace.WriteLine("a:" + a + "   a1:" + a1 + "  a2:" + a2 + "  a3:" + a3);
-            //AnnotationList.ScrollIntoView(AnnotationList.Items[0]);
-            if (a1 == 1)
+            var selectedItems = (sender as ListBox).SelectedItems.Cast<AnnotationHandlerEventArgs>().ToList();
+            if (selectedItems.Count == 1)
             {
-                //if(viewModel.ViewContentViewModel.IsPropertyOpen==false)
                 if (viewModel.IsModified)
                 {
-                    viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute((sender as ListBox).SelectedItems[0]);
+                    viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute(selectedItems[0]);
                 }
                 viewModel.IsModified = true;
             }
-            else if (a1 > 1)
+            else if (selectedItems.Count > 1)
             {
                 #region 阅读视图 多选
 
                 Dictionary<int, List<int>> selectedItemDics = new Dictionary<int, List<int>>();
                 List<AnnotationHandlerEventArgs> eventArgs = new List<AnnotationHandlerEventArgs>();
-                foreach (var item in (sender as ListBox).SelectedItems)
+                foreach (var item in selectedItems)
                 {
                     if (item is AnnotationHandlerEventArgs annotation)
                     {
@@ -521,7 +550,8 @@ namespace PDF_Master.Views.BOTA
             }
             if (e.Key == Key.Escape)
             {
-                AnnotationList.SelectedItems.Clear();
+                //Windows:BOTA列表,移除Esc取消选中逻辑
+                //AnnotationList.SelectedItems.Clear();
             }
         }
 

+ 6 - 1
PDF Office/Views/BOTA/BookmarkContent.xaml

@@ -17,6 +17,7 @@
     d:DesignHeight="450"
     d:DesignWidth="300"
     prism:ViewModelLocator.AutoWireViewModel="True"
+    KeyDown="UserControl_KeyDown"
     mc:Ignorable="d">
     <UserControl.Resources>
         <ResourceDictionary>
@@ -138,6 +139,7 @@
                 HorizontalContentAlignment="Stretch"
                 Background="{StaticResource color.sys.layout.mg}"
                 BorderThickness="0"
+                FocusVisualStyle="{x:Null}"
                 ItemTemplate="{StaticResource myDataTemplate}"
                 ItemsSource="{Binding Bookmarklist}"
                 PreviewMouseDown="BookMarkListView_PreviewMouseDown"
@@ -145,7 +147,10 @@
                 SelectionChanged="BookMarkListView_SelectionChanged"
                 SelectionMode="Extended">
                 <ListBox.ContextMenu>
-                    <ContextMenu x:Name="ContextMenuBook" FontSize="14" Visibility="Collapsed">
+                    <ContextMenu
+                        x:Name="ContextMenuBook"
+                        FontSize="14"
+                        Visibility="Collapsed">
                         <MenuItem Click="MenuItemRename_Click" Header="{x:Static mainPageLoader:MainPage.Bookmark_Rename}" />
                         <MenuItem Click="MenuChangeItem_Click" Header="{x:Static mainPageLoader:MainPage.Bookmark_Change}" />
                         <MenuItem Click="MenuItemDeleteCommand_Click" Header="{x:Static mainPageLoader:MainPage.Bookmark_Delete}" />

+ 20 - 2
PDF Office/Views/BOTA/BookmarkContent.xaml.cs

@@ -48,7 +48,8 @@ namespace PDF_Master.Views.BOTA
             InitializeComponent();
             viewModel = this.DataContext as BookmarkContentViewModel;
             unicode = App.mainWindowViewModel.SelectedItem.Unicode;
-            eventAggregator.GetEvent<CleanSelectAllEvent>().Subscribe(CleanSelectAll, e => e.Unicode == unicode);
+            //Windows:BOTA列表,移除点击阅读页取消选中逻辑
+            //eventAggregator.GetEvent<CleanSelectAllEvent>().Subscribe(CleanSelectAll, e => e.Unicode == unicode);
         }
 
         private void CleanSelectAll(CleanSelectAllArgs obj)
@@ -403,7 +404,8 @@ namespace PDF_Master.Views.BOTA
             }
             if (e.Key == Key.Escape)
             {
-                BookMarkListView.SelectedItems.Clear();
+                //Windows:BOTA列表,移除Esc取消选中逻辑
+                //BookMarkListView.SelectedItems.Clear();
             }
             //if (e.Key == Key.Delete)
             //{
@@ -468,5 +470,21 @@ namespace PDF_Master.Views.BOTA
                 }
             }
         }
+
+        private void UserControl_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Delete)
+            {
+                if (BookMarkListView.SelectedItems.Count != 0)
+                {
+                    MenuItemDeleteCommand_Click(sender, e);
+
+                    TxtTitle.Dispatcher.BeginInvoke(new Action(() =>
+                    {
+                        TxtTitle.Focus();
+                    }));
+                }
+            }
+        }
     }
 }

+ 22 - 11
PDF Office/Views/BOTA/OutLineControl.xaml.cs

@@ -81,7 +81,8 @@ namespace PDF_Master.Views.BOTA
 
         public OutLineControl(IEventAggregator eventAggregator) : this()
         {
-            eventAggregator.GetEvent<CleanSelectAllEvent>().Subscribe(CleanSelectAll, e => e.Unicode == unicode);
+            //Windows:BOTA列表,移除点击阅读页取消选中逻辑
+            //eventAggregator.GetEvent<CleanSelectAllEvent>().Subscribe(CleanSelectAll, e => e.Unicode == unicode);
         }
 
         private void CleanSelectAll(CleanSelectAllArgs obj)
@@ -141,7 +142,7 @@ namespace PDF_Master.Views.BOTA
                 return;
             }
 
-              (DataContext as OutLineControlViewModel).IsOnDrop = true;
+        (DataContext as OutLineControlViewModel).IsOnDrop = true;
             TreeViewItem sourceitem = e.Data.GetData(typeof(TreeViewItem)) as TreeViewItem;
             if (sourceitem == null)
             {
@@ -161,7 +162,7 @@ namespace PDF_Master.Views.BOTA
                         {
                             Treeviewitem = treeviewitem;
                         }
-                        (DataContext as OutLineControlViewModel).IsInsertHead = true;
+                       (DataContext as OutLineControlViewModel).IsInsertHead = true;
                         (Treeviewitem.DataContext as OutlineNode).IsInsertCurrentLayer = false;
                         (Treeviewitem.DataContext as OutlineNode).IsInsertNextLayer = false;
                     }
@@ -234,7 +235,6 @@ namespace PDF_Master.Views.BOTA
 
         private void OutlineView_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
         {
-
             (DataContext as OutLineControlViewModel).IsInsertHead = false;
             if (Treeviewitem != null)
             {
@@ -278,7 +278,7 @@ namespace PDF_Master.Views.BOTA
                 HiddenaAllLine();
                 return;
             }
-           (DataContext as OutLineControlViewModel).MoveOutLine(targetoutlineNode, soureoutlineNode);
+          (DataContext as OutLineControlViewModel).MoveOutLine(targetoutlineNode, soureoutlineNode);
 
             HiddenaAllLine();
             (DataContext as OutLineControlViewModel).Updata(true);
@@ -344,9 +344,9 @@ namespace PDF_Master.Views.BOTA
                         IsReName = false;
                         return;
                     }
-                    (DataContext as OutLineControlViewModel).SetTitle(result, newtitle);
+                (DataContext as OutLineControlViewModel).SetTitle(result, newtitle);
                 }
-                (DataContext as OutLineControlViewModel).Updata(false);
+            (DataContext as OutLineControlViewModel).Updata(false);
             }
             IsReName = false;
         }
@@ -534,11 +534,22 @@ namespace PDF_Master.Views.BOTA
         {
             if (e.Key == Key.Escape)
             {
-                OutlineNode outlineNode = OutlineView.SelectedItem as OutlineNode;
-                if (outlineNode != null)
+                //Windows:BOTA列表,移除Esc取消选中逻辑
+                //OutlineNode outlineNode = OutlineView.SelectedItem as OutlineNode;
+                //if (outlineNode != null)
+                //{
+                //    outlineNode.IsSelected = false;
+                //    e.Handled = true;
+                //}
+            }
+            if (e.Key == Key.Delete)
+            {
+                if (OutlineView.SelectedItem != null)
                 {
-                    outlineNode.IsSelected = false;
-                    e.Handled = true;
+                    if (OutlineView.SelectedItem is OutlineNode outlineNode)
+                    {
+                        (DataContext as OutLineControlViewModel).RemoveOutline(outlineNode);
+                    }
                 }
             }
         }

+ 14 - 8
PDF Office/Views/BOTA/SearchContent.xaml.cs

@@ -25,19 +25,22 @@ namespace PDF_Master.Views.BOTA
 {
     /// <summary>
     /// SearchContent.xaml 的交互逻辑
-    /// </summary> 
+    /// </summary>
     public partial class SearchContent : UserControl
     {
-        bool Updata = false;
+        private bool Updata = false;
         private string unicode = "";
+
         public SearchContent()
         {
             InitializeComponent();
             unicode = App.mainWindowViewModel.SelectedItem.Unicode;
         }
+
         public SearchContent(IEventAggregator eventAggregator) : this()
         {
-            eventAggregator.GetEvent<CleanSelectAllEvent>().Subscribe(CleanSelectAll, e => e.Unicode == unicode);
+            //Windows: BOTA列表,移除点击阅读页取消选中逻辑
+            //eventAggregator.GetEvent<CleanSelectAllEvent>().Subscribe(CleanSelectAll, e => e.Unicode == unicode);
         }
 
         private void CleanSelectAll(CleanSelectAllArgs obj)
@@ -60,8 +63,9 @@ namespace PDF_Master.Views.BOTA
             }
         }
 
-        List<string> HistorySearchText = new List<string>();
-        const int MaxHistoryCount = 10;
+        private List<string> HistorySearchText = new List<string>();
+        private const int MaxHistoryCount = 10;
+
         private void TextBox_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.Key == Key.Enter)
@@ -141,6 +145,7 @@ namespace PDF_Master.Views.BOTA
             ContextSearchText.IsOpen = true;
             UpDataItem();
         }
+
         private void UpDataItem()
         {
             foreach (var item in ContextSearchText.Items)
@@ -201,8 +206,9 @@ namespace PDF_Master.Views.BOTA
         {
             if (e.Key == Key.Escape)
             {
-                SearchResultList.SelectedIndex = -1;
-                e.Handled = true;
+                //Windows:BOTA列表,移除Esc取消选中逻辑
+                //SearchResultList.SelectedIndex = -1;
+                //e.Handled = true;
             }
         }
 
@@ -247,4 +253,4 @@ namespace PDF_Master.Views.BOTA
             Updata = true;
         }
     }
-}
+}

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

@@ -102,6 +102,7 @@
                                     Name="OCRCheckBox"
                                     Margin="0,10,0,0"
                                     Padding="8,0,0,0"
+                                    Command="{Binding OpenOCRCommand}"
                                     IsChecked="{Binding OCRCheckBoxIsCheckBox}">
                                     <TextBlock Text="Recognize text if needed" />
                                 </CheckBox>

+ 1 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterHTMLDialog.xaml

@@ -40,6 +40,7 @@
                                 Name="OCRCheckBox"
                                 Margin="0,8,0,0"
                                 Padding="8,0,0,0"
+                                Command="{Binding OpenOCRCommand}"
                                 IsChecked="{Binding OCRCheckBoxIsCheckBox}">
                                 <TextBlock Text="Recognize text if needed" />
                             </CheckBox>

+ 1 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterPPTDialog.xaml

@@ -40,6 +40,7 @@
                                 Name="OCRCheckBox"
                                 Margin="0,10,0,0"
                                 Padding="8,0,0,0"
+                                Command="{Binding OpenOCRCommand}"
                                 IsChecked="{Binding OCRCheckBoxIsCheckBox}">
                                 <TextBlock Text="Recognize text if needed" />
                             </CheckBox>

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

@@ -30,7 +30,7 @@
                     <StackPanel Orientation="Vertical"  Margin="0,2,0,0">
                         <StackPanel Orientation="Vertical" Visibility="Visible">
                             <TextBlock Text="RTF Recognition Settings" HorizontalAlignment="Left"  Style="{StaticResource PropertyHeaderLv2}" Height="20"/>
-                            <CheckBox Name="OCRCheckBox"  Margin="0,10,0,0" IsChecked="{Binding OCRCheckBoxIsCheckBox}" Padding="8,0,0,0">
+                            <CheckBox Name="OCRCheckBox"  Margin="0,10,0,0" Command="{Binding OpenOCRCommand}" IsChecked="{Binding OCRCheckBoxIsCheckBox}" Padding="8,0,0,0">
                                 <TextBlock Text="Recognize text if needed"/>
                             </CheckBox>
                             <ComboBox IsEnabled="{Binding ElementName=OCRCheckBox,Path=IsChecked}" Margin="0,8,0,8" Width="208" Height="32" HorizontalAlignment="Left" SelectedIndex="{Binding LanguageSelectedIndex}">

+ 1 - 0
PDF Office/Views/Dialog/ConverterDialogs/ConverterTextDialog.xaml

@@ -40,6 +40,7 @@
                                 Name="OCRCheckBox"
                                 Margin="0,10,0,0"
                                 Padding="8,0,0,0"
+                                Command="{Binding OpenOCRCommand}"
                                 IsChecked="{Binding OCRCheckBoxIsCheckBox}">
                                 <TextBlock Text="Recognize text if needed" />
                             </CheckBox>

+ 7 - 5
PDF Office/Views/Dialog/ConverterDialogs/ConverterWordDialog.xaml

@@ -42,6 +42,7 @@
                                     Padding="8,0,0,0"
                                     Command="{Binding RadioButtonCommand}"
                                     CommandParameter="{Binding ElementName=FlowingTextRadioBtn, Path=Name}"
+                                    IsChecked="True"
                                     Style="{StaticResource RadioButtonStyleText}">
                                     <TextBlock Text="Retain Flowing Text" />
                                 </RadioButton>
@@ -51,7 +52,7 @@
                                     Padding="8,0,0,0"
                                     Command="{Binding RadioButtonCommand}"
                                     CommandParameter="{Binding ElementName=PageLayoutRadioBtn, Path=Name}"
-                                    IsChecked="True"
+                                    IsChecked="False"
                                     Style="{StaticResource RadioButtonStyleText}">
                                     <TextBlock Text="Retain Page Layout" />
                                 </RadioButton>
@@ -68,6 +69,7 @@
                                     Name="OCRCheckBox"
                                     Margin="0,8,0,0"
                                     Padding="8,0,0,0"
+                                    Command="{Binding OpenOCRCommand}"
                                     IsChecked="{Binding OCRCheckBoxIsCheckBox}">
                                     <TextBlock Text="Recognize text if needed" />
                                 </CheckBox>
@@ -157,15 +159,15 @@
                             <TextBlock Text="{Binding TextUpgrade}" />
                         </Underline>
                     </TextBlock>
-                </StackPanel>            
+                </StackPanel>
             </Grid>
         </cus:DialogContent.Content>
         <cus:DialogContent.BottmBar>
             <Grid>
                 <!--<Button Background="WhiteSmoke" Width="98" Height="32" Margin="0,0,350,0" Command="{Binding BatchConverterCommand}" Style="{StaticResource btn.sec}">
-                    <Border>
-                        <TextBlock Text="批量处理" ></TextBlock>
-                    </Border>
+                <Border>
+                <TextBlock Text="批量处理" ></TextBlock>
+                </Border>
                 </Button>-->
                 <Button
                     Width="98"

+ 127 - 66
PDF Office/Views/Dialog/ConverterDialogs/OCRDownloadProgress.xaml

@@ -1,95 +1,156 @@
-<UserControl x:Class="PDF_Master.Views.Dialog.ConverterDialogs.OCRDownloadProgress"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-        mc:Ignorable="d"
-        Background="Transparent" Width="374"
-                Height="120" >
+<UserControl
+    x:Class="PDF_Master.Views.Dialog.ConverterDialogs.OCRDownloadProgress"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Master.CustomControl"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:pageeditdialogs="clr-namespace:PDF_Master.ViewModels.Dialog.PageEditDialogs"
+    xmlns:prism="http://prismlibrary.com/"
+    Width="374"
+    Height="120"
+    d:DesignHeight="120"
+    d:DesignWidth="374"
+    prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    Background="Transparent"
+    Loaded="UserControl_Loaded"
+    mc:Ignorable="d">
     <Grid>
         <Border
-              Name="ProgressVisible"  Panel.ZIndex="1" Background="Transparent" Visibility="Visible">
-            <Border 
+            Name="ProgressVisible"
+            Panel.ZIndex="1"
+            Background="Transparent"
+            Visibility="Visible">
+            <Border
                 Width="374"
                 Height="120"
                 Background="#FFFFFF"
                 BorderBrush="Gray"
                 BorderThickness="1"
-                CornerRadius="4"
-                >
+                CornerRadius="4">
                 <Grid>
-                    <Grid Margin="16,18,16,0" 
-                Height="54" Background="Transparent" VerticalAlignment="Top">
+                    <Grid
+                        Height="54"
+                        Margin="16,18,16,0"
+                        VerticalAlignment="Top"
+                        Background="Transparent">
                         <StackPanel Orientation="Horizontal">
-                            <TextBlock Name="ProgressBarName" Foreground="#000000" Text="{Binding T_ProgressBarName}" />
                             <TextBlock
-                            Margin="16,0,0,0"
-                            Text="("
-                            Foreground="#000000"
-                            Visibility="Visible" />
+                                Name="ProgressBarName"
+                                Foreground="#000000"
+                                Text="{Binding T_ProgressBarName}" />
+                            <TextBlock
+                                Margin="16,0,0,0"
+                                Foreground="#000000"
+                                Text="("
+                                Visibility="Visible" />
                             <TextBlock
-                            Name="ProgressBarCurrentSize"
-                            Foreground="#000000"
-                            Visibility="Visible" Text="{Binding ProgressBarCurrentSizeValue}" />
+                                Name="ProgressBarCurrentSize"
+                                Foreground="#000000"
+                                Text="{Binding ProgressBarCurrentSizeValue}"
+                                Visibility="Visible" />
                             <TextBlock
-                            Text="/"
-                            Foreground="#000000"
-                            Visibility="Visible" />
+                                Foreground="#000000"
+                                Text="/"
+                                Visibility="Visible" />
                             <TextBlock
-                            Name="ProgressBarSize"
-                            Foreground="#000000"
-                            Visibility="Visible" Text="{Binding ProgressBarFileSize}"/>
+                                Name="ProgressBarSize"
+                                Foreground="#000000"
+                                Text="{Binding ProgressBarFileSize}"
+                                Visibility="Visible" />
                             <TextBlock
-                            Text=")"
-                            Foreground="#000000"
-                            Visibility="Visible" />
+                                Foreground="#000000"
+                                Text=")"
+                                Visibility="Visible" />
                         </StackPanel>
                         <Button
-                        Width="12"
-                        Height="12"
-                        Padding="0,0,1,1"
-                        Margin="0,0,0,0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Top"
-                        BorderThickness="0"
-                        Background="Transparent"
-                        Command="{Binding CancelCommand}"
-                        Visibility="Visible">
+                            Width="12"
+                            Height="12"
+                            Margin="0,0,0,0"
+                            Padding="0,0,1,1"
+                            HorizontalAlignment="Right"
+                            VerticalAlignment="Top"
+                            Background="Transparent"
+                            BorderThickness="0"
+                            Command="{Binding CancelCommand}"
+                            Visibility="Collapsed">
                             <Path Data="M6.00006 7.06072L9.46973 10.5304L10.5304 9.46973L7.06072 6.00006L10.5304 2.53039L9.46973 1.46973L6.00006 4.9394L2.53039 1.46973L1.46973 2.53039L4.9394 6.00006L1.46973 9.46973L2.53039 10.5304L6.00006 7.06072Z" Fill="#CED0D4" />
                         </Button>
-                        <StackPanel Orientation="Horizontal" 
-                        Margin="0,0,0,0"
-                        VerticalAlignment="Bottom" Background="Transparent">
+                        <StackPanel
+                            Margin="0,0,0,0"
+                            VerticalAlignment="Bottom"
+                            Background="Transparent"
+                            Orientation="Horizontal">
                             <ProgressBar
-                        Margin="0,0,18,0"
-                        Name="ProgressBar"
-                        Height="5"
-                        Width="280"
-                        BorderThickness="0"
-                        Foreground="Green"
-                        Maximum="100"
-                        Value="{Binding ProgressBarCurrentValue}" />
+                                Name="ProgressBar"
+                                Width="280"
+                                Height="5"
+                                Margin="0,0,18,0"
+                                BorderThickness="0"
+                                Foreground="Green"
+                                Maximum="100"
+                                Value="{Binding ProgressBarCurrentValue}" />
                             <TextBlock
-                            FontSize="12"
-                            Foreground="#666666"
-                            Text="{Binding ElementName=ProgressBar,Path=Value, StringFormat={}{0}%}"
-                             />
+                                FontSize="12"
+                                Foreground="#666666"
+                                Text="{Binding ElementName=ProgressBar, Path=Value, StringFormat={}{0}%}" />
                         </StackPanel>
-
                     </Grid>
-                    <StackPanel Name="errorStackPanel" Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="{Binding ErrorStackPanelVisible}"  Margin="16,18">
-                        <Grid Width="14" Height="14" Margin="4,0,8,0" VerticalAlignment="Center">
-                            <Ellipse Width="12" Height="12" Fill="#F3465B"></Ellipse>
-                            <Path  Data="M7.25 4V9H8.75V4H7.25ZM7.25 10.5V12H8.75L8.75 10.5H7.25Z" Fill="white" Margin="-1,-1,1,1" />
+                    <StackPanel
+                        Name="errorStackPanel"
+                        Margin="16,18"
+                        VerticalAlignment="Bottom"
+                        Orientation="Horizontal"
+                        Visibility="{Binding ErrorStackPanelVisible}">
+                        <Grid
+                            Width="14"
+                            Height="14"
+                            Margin="4,0,8,0"
+                            VerticalAlignment="Center">
+                            <Ellipse
+                                Width="12"
+                                Height="12"
+                                Fill="#F3465B" />
+                            <Path
+                                Margin="-1,-1,1,1"
+                                Data="M7.25 4V9H8.75V4H7.25ZM7.25 10.5V12H8.75L8.75 10.5H7.25Z"
+                                Fill="white" />
                         </Grid>
-                        <TextBlock Name="ErrorTextBlock" Text="{Binding T_ErrorTextBlock}" Foreground="#F3465B"  FontSize="11" VerticalAlignment="Center"></TextBlock>
+                        <TextBlock
+                            Name="ErrorTextBlock"
+                            VerticalAlignment="Center"
+                            FontSize="11"
+                            Foreground="#F3465B"
+                            Text="{Binding T_ErrorTextBlock}" />
                     </StackPanel>
-                    <StackPanel  Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="Visible" HorizontalAlignment="Right" Margin="16,13">
-                        <Button Name="tryAgainBtn" Width="60" Height="24" Margin="0,0,8,0" Content="{Binding T_TryAgainBtn}"  Style="{StaticResource Btn.cta}"  Command="{Binding TryAgainCommnad}"   Visibility="{Binding tryAgainBtnVisible}"></Button>
-                        <Button Name="CancelBtn" Width="60" Height="24" Content="{Binding T_CancelBtn}" Style="{StaticResource btn.sec}"  Command="{Binding CancelCommand}"  BorderThickness="1" ></Button>
+                    <StackPanel
+                        Margin="16,13"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Bottom"
+                        Orientation="Horizontal"
+                        Visibility="Visible">
+                        <Button
+                            Name="tryAgainBtn"
+                            Width="80"
+                            Height="30"
+                            Margin="0,0,8,0"
+                            Command="{Binding TryAgainCommnad}"
+                            Content="{Binding T_TryAgainBtn}"
+                            Style="{StaticResource Btn.cta}"
+                            Visibility="{Binding TryAgainBtnVisible}" />
+                        <Button
+                            Name="CancelBtn"
+                            Width="60"
+                            Height="24"
+                            BorderThickness="1"
+                            Command="{Binding CancelCommand}"
+                            Content="{Binding T_CancelBtn}"
+                            Style="{StaticResource btn.sec}" />
                     </StackPanel>
                 </Grid>
             </Border>
         </Border>
     </Grid>
-</UserControl>
+</UserControl>

+ 5 - 0
PDF Office/Views/Dialog/ConverterDialogs/OCRDownloadProgress.xaml.cs

@@ -11,5 +11,10 @@ namespace PDF_Master.Views.Dialog.ConverterDialogs
         {
             InitializeComponent();
         }
+
+        private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
+        {
+
+        }
     }
 }

+ 42 - 36
PDF Office/Views/Dialog/ServiceDialog/LoginoffDialog.xaml

@@ -36,49 +36,55 @@
                 <TextBlock
                     Width="360"
                     Margin="0,16,0,0"
-                    VerticalAlignment="Center"
                     HorizontalAlignment="Center"
+                    VerticalAlignment="Center"
                     FontFamily="Segoe UI"
                     FontSize="14"
                     TextWrapping="Wrap">
                     <Run Text="{Binding TextYouraccount}" />
-                    <Hyperlink  Command="{Binding GoCodeCommand}">
-                          <Hyperlink.Style>
-                        <Style BasedOn="{StaticResource {x:Type Hyperlink}}" TargetType="Hyperlink">
-                            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
-                            <Setter Property="TextBlock.TextDecorations" Value="{x:Null}" />
-                            <Style.Triggers>
-                                <Trigger Property="IsMouseOver" Value="True">
-                                    <Setter Property="TextBlock.TextDecorations" Value="None" />
-                                </Trigger>
-                            </Style.Triggers>
-                        </Style>
-                    </Hyperlink.Style>
-                        <TextBlock Margin="0,16,0,0" Text="{Binding TextChange}" />
-                    </Hyperlink>
                 </TextBlock>
-                <StackPanel Margin="200,32,0,0" Orientation="Horizontal" >
-                    <Button
-                        HorizontalAlignment="Right"
-                        Width="80"
-                        Height="32"
-                        IsDefault="True"
-                        Margin="0,0,20,0"
-                        Command="{Binding GoLoginCommand}"
-                        Content="{Binding TextLogin}"
-                        Style="{StaticResource Btn.cta}" />
-
-                    <Button
-                        HorizontalAlignment="Right"
-                        Width="80"
-                        Height="32"
-                        Margin="0,0,20,0"
-                        Content="{Binding TextCancel}"
-                        IsCancel="True"
-                        Style="{StaticResource btn.sec}" />
-                </StackPanel>
+                <DockPanel Margin="0,50">
+                    <TextBlock Margin="20,0" DockPanel.Dock="Left">
+                        <Hyperlink Command="{Binding GoCodeCommand}">
+                            <Hyperlink.Style>
+                                <Style BasedOn="{StaticResource {x:Type Hyperlink}}" TargetType="Hyperlink">
+                                    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
+                                    <Setter Property="TextBlock.TextDecorations" Value="{x:Null}" />
+                                    <Style.Triggers>
+                                        <Trigger Property="IsMouseOver" Value="True">
+                                            <Setter Property="TextBlock.TextDecorations" Value="None" />
+                                        </Trigger>
+                                    </Style.Triggers>
+                                </Style>
+                            </Hyperlink.Style>
+                            <TextBlock Margin="0,8,0,0" Text="{Binding TextChange}" />
+                        </Hyperlink>
+                    </TextBlock>
+                    <StackPanel
+                        Margin="30,0,0,0"
+                        DockPanel.Dock="Right"
+                        Orientation="Horizontal">
+                        <Button
+                            Width="80"
+                            Height="32"
+                            Margin="0,0,20,0"
+                            HorizontalAlignment="Right"
+                            Command="{Binding GoLoginCommand}"
+                            Content="{Binding TextLogin}"
+                            IsDefault="True"
+                            Style="{StaticResource Btn.cta}" />
 
+                        <Button
+                            Width="80"
+                            Height="32"
+                            Margin="0,0,20,0"
+                            HorizontalAlignment="Right"
+                            Content="{Binding TextCancel}"
+                            IsCancel="True"
+                            Style="{StaticResource btn.sec}" />
+                    </StackPanel>
+                </DockPanel>
             </StackPanel>
         </Grid>
     </Grid>
-</UserControl>
+</UserControl>

+ 11 - 11
PDF Office/Views/Dialog/ServiceDialog/UserOutCodeRegion.xaml

@@ -7,8 +7,8 @@
     xmlns:local="clr-namespace:PDF_Master.Views.Dialog.ServiceDialog"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
-    Width="310"
-    Height="368"
+    Width="440"
+    Height="486"
     prism:ViewModelLocator.AutoWireViewModel="True"
     mc:Ignorable="d">
     <Grid Background="White">
@@ -29,7 +29,7 @@
                 Fill="Black" />
         </Button>
         <Grid
-            Margin="0,40,0,0"
+            Margin="0,60,0,0"
             HorizontalAlignment="Center"
             VerticalAlignment="Top">
             <StackPanel>
@@ -48,8 +48,8 @@
                     FontStyle="Normal"
                     LineHeight="22"
                     Text="{Binding Text_vcode}" />
-                <WrapPanel Margin="0,8,0,0" HorizontalAlignment="Left">
-                    <Grid>
+                <WrapPanel Margin="0,18,0,0" HorizontalAlignment="Center">
+                    <Grid >
                         <TextBox
                             x:Name="text_Code1"
                             Width="36"
@@ -201,7 +201,7 @@
                     </Grid>
 
                 </WrapPanel>
-                <WrapPanel Margin="0,10,0,0">
+                <WrapPanel Margin="0,12,0,0" HorizontalAlignment="Center">
                     <TextBlock
                         Width="190"
                         Height="20"
@@ -236,9 +236,9 @@
                 </WrapPanel>
                 <Button
                     x:Name="Btn_RegisterNext"
-                    Width="200"
+                    Width="304"
                     Height="32"
-                    Margin="0,34,0,0"
+                    Margin="0,60,0,0"
                     HorizontalAlignment="Center"
                     VerticalAlignment="Top"
                     Command="{Binding UserOutCommand}"
@@ -247,9 +247,9 @@
                     IsEnabled="{Binding EnableNextStep, Mode=TwoWay}"
                       Style="{StaticResource Btn.cta}" />
                 <Button
-                    Width="200"
+                    Width="304"
                     Height="32"
-                    Margin="0,8,0,0"
+                    Margin="0,20,0,0"
                     HorizontalAlignment="Center"
                     VerticalAlignment="Top"
                     Content="{Binding BtText_cancel}"
@@ -266,7 +266,7 @@
 
         <Grid
             x:Name="Grid_UserCodemsgVis"
-            Width="310"
+            Width="440"
             Height="48"
             HorizontalAlignment="Center"
             VerticalAlignment="Bottom"

+ 5 - 5
PDF Office/Views/HomePanel/HomeGuidContent.xaml

@@ -12,13 +12,14 @@
     d:DesignWidth="800"
     prism:ViewModelLocator.AutoWireViewModel="True"
     Background="{StaticResource color.sys.layout.anti}"
+    PreviewMouseDown="UserControl_MouseDown"
     mc:Ignorable="d">
     <Grid>
         <ScrollViewer
-            PreviewMouseWheel="ScrollViewer_PreviewMouseWheel"
-            PanningMode="VerticalFirst"
             x:Name="scrollView"
             VerticalAlignment="Stretch"
+            PanningMode="VerticalFirst"
+            PreviewMouseWheel="ScrollViewer_PreviewMouseWheel"
             VerticalScrollBarVisibility="Visible">
             <Grid>
                 <Grid.RowDefinitions>
@@ -27,8 +28,7 @@
                 </Grid.RowDefinitions>
                 <!--快捷工具
                 <pDFTools:QuickToolsContent x:Name="hometool" Margin="32" />-->
-                <ContentControl
-            prism:RegionManager.RegionName="{Binding HomeToolRegionName}" Margin="24"/>
+                <ContentControl Margin="24" prism:RegionManager.RegionName="{Binding HomeToolRegionName}" />
                 <recentFiles:RecentFilesContent
                     x:Name="Recentlist"
                     Grid.Row="1"
@@ -36,4 +36,4 @@
             </Grid>
         </ScrollViewer>
     </Grid>
-</UserControl>
+</UserControl>

+ 48 - 3
PDF Office/Views/HomePanel/HomeGuidContent.xaml.cs

@@ -1,4 +1,6 @@
-using System.Windows;
+using PDF_Master.Helper;
+using PDF_Master.Views.HomePanel.RecentFiles;
+using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
@@ -45,6 +47,49 @@ namespace PDF_Master.Views.HomePanel
                 if (foundChild != null) break;
             }
             return foundChild;
-        }
+        }
+
+        private void Recentlist_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            //Windows:最近文件列表补充点击空白处取消选中;移除Esc取消选中逻辑
+            // 文件列表,需要点击其他空白区域取消文件选中
+            if (e.ClickCount == 1 && e.LeftButton == MouseButtonState.Pressed && Recentlist.GridRecentFilesList.Visibility == Visibility.Visible && Recentlist.GridRecentFilesList.SelectedItems.Count > 0)
+            {
+                HitTestResult hitTestResult = VisualTreeHelper.HitTest(Recentlist.GridRecentFilesList, e.GetPosition(Recentlist.GridRecentFilesList));
+                if (hitTestResult == null)
+                {
+                    Recentlist.GridRecentFilesList.SelectedItems.Clear();
+                }
+                else if (hitTestResult.VisualHit == Recentlist.GridRecentFilesList)
+                {
+                    Recentlist.GridRecentFilesList.SelectedItems.Clear();
+                }
+                else if (hitTestResult.VisualHit is ScrollViewer scrollViewer)
+                {
+                    Recentlist.GridRecentFilesList.SelectedItems.Clear();
+                }
+            }
+            else if (e.ClickCount == 1 && e.LeftButton == MouseButtonState.Pressed && Recentlist.RecentFilesList.Visibility == Visibility.Visible && Recentlist.RecentFilesList.SelectedItems.Count > 0)
+            {
+                HitTestResult hitTestResult = VisualTreeHelper.HitTest(Recentlist.RecentFilesList, e.GetPosition(Recentlist.RecentFilesList));
+                if (hitTestResult == null)
+                {
+                    Recentlist.RecentFilesList.SelectedItems.Clear();
+                }
+                else if (hitTestResult.VisualHit == Recentlist.RecentFilesList)
+                {
+                    Recentlist.RecentFilesList.SelectedItems.Clear();
+                }
+                else if (hitTestResult.VisualHit is ScrollViewer scrollViewer)
+                {
+                    Recentlist.RecentFilesList.SelectedItems.Clear();
+                }
+            }
+        }
+
+        private void UserControl_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            Recentlist_MouseDown(sender, e);
+        }
     }
-}
+}

+ 26 - 27
PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml.cs

@@ -23,12 +23,14 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
     public partial class RecentFilesContent : UserControl
     {
         private RecentFilesContentViewModel ViewModel => DataContext as RecentFilesContentViewModel;
+
         public RecentFilesContent()
         {
             InitializeComponent();
         }
 
         #region 初始化
+
         private void UserControl_Loaded(object sender, RoutedEventArgs e)
         {
             InitVariables();
@@ -43,14 +45,17 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
             if (GridRecentFilesList.SelectedItems != null)
                 GridRecentFilesList.SelectedItems.Clear();
         }
+
         private void InitEvents()
         {
             ViewModel.RecentFilesSelectionHandler -= ViewModel_RecentFilesSelection;
             ViewModel.RecentFilesSelectionHandler += ViewModel_RecentFilesSelection;
         }
-        #endregion
+
+        #endregion 初始化
 
         #region UI操作
+
         private void ViewModel_RecentFilesSelection(object sender, bool e)
         {
             //if (e)
@@ -111,7 +116,7 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
                         if (menuitem.Name == "FilePathMenuItem")
                             menuitem.Visibility = Visibility.Collapsed;
 
-                        if(menuitem.Name == "MenuOpenFile")
+                        if (menuitem.Name == "MenuOpenFile")
                         {
                             menuitem.Visibility = Visibility.Visible;
                         }
@@ -128,8 +133,6 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
                         }
                     }
                 }
-
-     
             }
             catch { }
         }
@@ -143,12 +146,10 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
             e.Handled = true;
         }
 
-        #endregion
-
+        #endregion UI操作
 
         #region Events
 
-
         /// <summary>
         /// 右键菜单:删除文件记录
         /// </summary>
@@ -160,7 +161,6 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
             else
                 listView = GridRecentFilesList;
 
-
             if (listView.SelectedItems == null || listView.SelectedItems.Count == 0)
             {
                 var item = (sender as MenuItem).DataContext as OpenFileInfo;
@@ -173,7 +173,6 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
             {
                 ViewModel?.RemoveFilesFromContainerCommand.Execute(listView.SelectedItems);
             }
-
         }
 
         /// <summary>
@@ -200,12 +199,11 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
             if (item != null && (item.DataContext as OpenFileInfo) != null)
             {
                 var fileInfo = item.DataContext as OpenFileInfo;
-                if(fileInfo != null)
+                if (fileInfo != null)
                 {
                     ViewModel?.OpenRecentFilesCommand.Execute(fileInfo);
                 }
             }
-
         }
 
         /// <summary>
@@ -232,22 +230,23 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
             }
         }
 
-        #endregion
+        #endregion Events
 
         private void UserControl_KeyDown(object sender, KeyEventArgs e)
         {
-            if (e.Key == Key.Escape)
-            {
-                //点击ESC取消选中
-                if (GridRecentFilesList.Visibility == Visibility.Visible)
-                {
-                    GridRecentFilesList.SelectedIndex = -1;
-                }
-                else
-                {
-                    RecentFilesList.SelectedIndex = -1;
-                }
-            }
+            //Windows:最近文件列表补充点击空白处取消选中;移除Esc取消选中逻辑
+            //if (e.Key == Key.Escape)
+            //{
+            //点击ESC取消选中
+            //if (GridRecentFilesList.Visibility == Visibility.Visible)
+            //{
+            //    GridRecentFilesList.SelectedIndex = -1;
+            //}
+            //else
+            //{
+            //    RecentFilesList.SelectedIndex = -1;
+            //}
+            //}
         }
 
         private void MenuOpenFile_Click(object sender, RoutedEventArgs e)
@@ -258,7 +257,7 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
             else
                 listView = GridRecentFilesList;
 
-            if (listView.SelectedItems.Count >=2)
+            if (listView.SelectedItems.Count >= 2)
             {
                 List<string> files = new List<string>();
                 foreach (OpenFileInfo item in listView.SelectedItems)
@@ -280,10 +279,10 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
         private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
         {
             //已经加载后,切换页签时,确认是否要刷新数据源
-            if(IsLoaded&&(bool)e.NewValue)
+            if (IsLoaded && (bool)e.NewValue)
             {
                 ViewModel.UpdateItemSoucre();
             }
         }
     }
-}
+}

+ 106 - 106
PDF Office/Views/MainWindow.xaml

@@ -16,7 +16,6 @@
     Height="800"
     MinWidth="640"
     MinHeight="460"
-    Loaded="Window_Loaded"
     d:DataContext="{d:DesignInstance Type=viewmodels:MainWindowViewModel}"
     prism:ViewModelLocator.AutoWireViewModel="True"
     Activated="Window_Activated"
@@ -24,6 +23,7 @@
     BorderThickness="2"
     Closed="Window_Closed"
     Closing="Window_Closing"
+    Loaded="Window_Loaded"
     PreviewMouseLeftButtonDown="Window_PreviewMouseLeftButtonDown"
     SizeChanged="Window_SizeChanged"
     SnapsToDevicePixels="True"
@@ -183,7 +183,7 @@
                                     </MultiDataTrigger.Conditions>
                                     <Setter TargetName="Title" Property="Background" Value="#0D000000" />
                                     <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
-                                    <!--<Setter TargetName="btnPath" Property="Path.Fill" Value="Black"/>-->
+                                    <!--<Setter TargetName="btnPath" Property="Path.Fill" Value="Black" />-->
                                 </MultiDataTrigger>
                             </ControlTemplate.Triggers>
                         </ControlTemplate>
@@ -243,9 +243,8 @@
         <!--  标题栏右侧栏,关闭按钮,会员,试用等  -->
         <DockPanel HorizontalAlignment="Right">
             <Grid
-                DockPanel.Dock="Left"
                 x:Name="Grid_Openhight"
-                IsVisibleChanged="Grid_Openhight_IsVisibleChanged"
+                DockPanel.Dock="Left"
                 Visibility="Collapsed">
 
                 <WrapPanel VerticalAlignment="Center">
@@ -257,12 +256,9 @@
                         VerticalAlignment="Center"
                         Background=" #FFCF52"
                         CornerRadius="4" />
-
-
                     <Border VerticalAlignment="Center">
                         <Path Data="M0 4C0 1.79086 1.79086 0 4 0H132C134.209 0 136 1.79086 136 4V10.323C136 10.7319 136.249 11.0996 136.629 11.2514L141.179 13.0715C142.017 13.4068 142.017 14.5932 141.179 14.9285L136.629 16.7486C136.249 16.9004 136 17.2681 136 17.677V24C136 26.2091 134.209 28 132 28H4C1.79086 28 0 26.2091 0 24V4Z" Fill="#FFCF52" />
                     </Border>
-
                 </WrapPanel>
                 <TextBlock
                     HorizontalAlignment="Center"
@@ -273,127 +269,132 @@
                     Text="{Binding Msgtologin}" />
             </Grid>
             <StackPanel
-            Name="StkPnlRight"
-            HorizontalAlignment="Right"
-            Orientation="Horizontal"
-            WindowChrome.IsHitTestVisibleInChrome="True">
+                Name="StkPnlRight"
+                HorizontalAlignment="Right"
+                Orientation="Horizontal"
+                WindowChrome.IsHitTestVisibleInChrome="True">
 
-                <Border Width="87" Height="24"  Visibility="{Binding UpgradeVis}">
+                <Border
+                    Name="BorderUpgrade"
+                    Width="87"
+                    Height="24"
+                    IsVisibleChanged="Grid_Openhight_IsVisibleChanged"
+                    Visibility="{Binding UpgradeVis}">
                     <Border.InputBindings>
-                        <MouseBinding MouseAction="LeftClick" Command="{Binding  UpgradelinkCommand}" />
+                        <MouseBinding Command="{Binding UpgradelinkCommand}" MouseAction="LeftClick" />
                     </Border.InputBindings>
                     <Image Source="pack://application:,,,/PDF Master;component/Resources/Service/Upgrade.png" />
-                    </Border>
+                </Border>
 
-               
                 <Button
-                x:Name="Btn_Register"
-                Width="40"
-                Height="40"
-                Background="Transparent"
-                Command="{Binding OpenRegisterCommand}"
-                Style="{StaticResource subToolBar}"
-                Visibility="{Binding RegisterVis, Mode=TwoWay}">
+                    x:Name="Btn_Register"
+                    Width="40"
+                    Height="40"
+                    Background="Transparent"
+                    Command="{Binding OpenRegisterCommand}"
+                    Style="{StaticResource subToolBar}"
+                    Visibility="{Binding RegisterVis, Mode=TwoWay}">
                     <Grid>
                         <Border
-                        x:Name="myBorder1"
-                        Width="24"
-                        Height="24"
-                        Background="White"
-                        CornerRadius="12" />
+                            x:Name="myBorder1"
+                            Width="24"
+                            Height="24"
+                            Background="White"
+                            CornerRadius="12" />
                         <Border
-                        Width="24"
-                        Height="24"
-                        Background="{StaticResource color.icon.base.neutral.norm.lv1}"
-                        BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
+                            Width="24"
+                            Height="24"
+                            Background="{StaticResource color.icon.base.neutral.norm.lv1}"
+                            BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
                             <Path Data="M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 31C17.5228 31 22 27.4183 22 23C22 18.5817 17.5228 15 12 15C6.47715 15 2 18.5817 2 23C2 27.4183 6.47715 31 12 31Z" Fill="White" />
                             <Border.OpacityMask>
                                 <VisualBrush Visual="{Binding ElementName=myBorder1}" />
                             </Border.OpacityMask>
                         </Border>
                         <Border
-                        Width="24"
-                        Height="24"
-                        BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
-                        BorderThickness="2"
-                        CornerRadius="100" />
+                            Width="24"
+                            Height="24"
+                            BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
+                            BorderThickness="2"
+                            CornerRadius="100" />
                     </Grid>
-
                 </Button>
 
                 <Button
-                x:Name="Btn_Login"
-                Width="40"
-                Height="40"
-                Background="Transparent"
-                Command="{Binding OpenLoginCommand}"
-                Style="{StaticResource subToolBar}"
-                Visibility="{Binding LoginVis, Mode=TwoWay}">
+                    x:Name="Btn_Login"
+                    Width="40"
+                    Height="40"
+                    Background="Transparent"
+                    Command="{Binding OpenLoginCommand}"
+                    Style="{StaticResource subToolBar}"
+                    Visibility="{Binding LoginVis, Mode=TwoWay}">
                     <Grid>
                         <Border
-                        x:Name="myBorder2"
-                        Width="24"
-                        Height="24"
-                        Background="White"
-                        CornerRadius="12" />
+                            x:Name="myBorder2"
+                            Width="24"
+                            Height="24"
+                            Background="White"
+                            CornerRadius="12" />
                         <Border
-                        Width="24"
-                        Height="24"
-                        Background="{StaticResource color.icon.base.neutral.norm.lv1}"
-                        BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
+                            Width="24"
+                            Height="24"
+                            Background="{StaticResource color.icon.base.neutral.norm.lv1}"
+                            BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
                             <Path Data="M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 31C17.5228 31 22 27.4183 22 23C22 18.5817 17.5228 15 12 15C6.47715 15 2 18.5817 2 23C2 27.4183 6.47715 31 12 31Z" Fill="White" />
                             <Border.OpacityMask>
                                 <VisualBrush Visual="{Binding ElementName=myBorder2}" />
                             </Border.OpacityMask>
                         </Border>
                         <Border
-                        Width="24"
-                        Height="24"
-                        BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
-                        BorderThickness="2"
-                        CornerRadius="100" />
+                            Width="24"
+                            Height="24"
+                            BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
+                            BorderThickness="2"
+                            CornerRadius="100" />
                     </Grid>
                 </Button>
                 <Button
-                x:Name="Btn_User"
-                Width="40"
-                Height="40"
-                Background="Transparent"
-                Command="{Binding OpenUserCommand}"
-                Style="{StaticResource subToolBar}"
-                Visibility="{Binding UserVis, Mode=TwoWay}">
+                    x:Name="Btn_User"
+                    Width="40"
+                    Height="40"
+                    Background="Transparent"
+                    Command="{Binding OpenUserCommand}"
+                    Style="{StaticResource subToolBar}"
+                    Visibility="{Binding UserVis, Mode=TwoWay}">
                     <Grid>
                         <Border
-                        Width="24"
-                        Height="24"
-                        Background="#1770F4"
-                        BorderBrush="#1770F4"
-                        CornerRadius="100">
+                            Width="24"
+                            Height="24"
+                            Background="#1770F4"
+                            BorderBrush="#1770F4"
+                            CornerRadius="100">
                             <TextBlock
-                            HorizontalAlignment="Center"
-                            VerticalAlignment="Center"
-                            FontFamily="SF Pro Text"
-                            FontSize="14"
-                            FontWeight="SemiBold"
-                            Foreground="White"
-                          Text="{Binding Useremailchar,Mode=TwoWay}" />
+                                HorizontalAlignment="Center"
+                                VerticalAlignment="Center"
+                                FontFamily="SF Pro Text"
+                                FontSize="14"
+                                FontWeight="SemiBold"
+                                Foreground="White"
+                                Text="{Binding Useremailchar, Mode=TwoWay}" />
                         </Border>
-
                     </Grid>
                 </Button>
-                <Separator Background="{StaticResource color.sys.layout.divider}" Width="16" Height="1">
+                <Separator
+                    Width="16"
+                    Height="1"
+                    Background="{StaticResource color.sys.layout.divider}">
                     <Separator.LayoutTransform>
                         <RotateTransform Angle="90" />
                     </Separator.LayoutTransform>
                 </Separator>
                 <Button
-                Name="BtnMiniSize"
-                Width="46"
-                Height="40"
-                Background="Transparent"
-                BorderThickness="0"
-                Click="BtnMiniSize_Click"
-                Style="{StaticResource TitleBarBtn}">
+                    Name="BtnMiniSize"
+                    Width="46"
+                    Height="40"
+                    Background="Transparent"
+                    BorderThickness="0"
+                    Click="BtnMiniSize_Click"
+                    Style="{StaticResource TitleBarBtn}">
                     <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 7 14 8 2 8 2 7">
                         <Polygon.RenderTransform>
                             <TransformGroup>
@@ -403,19 +404,19 @@
                     </Polygon>
                 </Button>
                 <Button
-                Name="BtnReStore"
-                Width="46"
-                Height="40"
-                Background="Transparent"
-                BorderThickness="0"
-                Click="BtnReStore_Click"
-                Style="{StaticResource TitleBarBtn}">
+                    Name="BtnReStore"
+                    Width="46"
+                    Height="40"
+                    Background="Transparent"
+                    BorderThickness="0"
+                    Click="BtnReStore_Click"
+                    Style="{StaticResource TitleBarBtn}">
                     <Grid>
                         <Path
-                        x:Name="ico_max"
-                        Data="M14,2 L14,14 L2,14 L2,2 L14,2 Z M13,3 L3,3 L3,13 L13,13 L13,3 Z"
-                        Fill="{StaticResource color.btn.sec.text.def}"
-                        Visibility="Collapsed" />
+                            x:Name="ico_max"
+                            Data="M14,2 L14,14 L2,14 L2,2 L14,2 Z M13,3 L3,3 L3,13 L13,13 L13,3 Z"
+                            Fill="{StaticResource color.btn.sec.text.def}"
+                            Visibility="Collapsed" />
                         <Grid x:Name="ico_mini" Visibility="{Binding ElementName=ico_max, Path=Visibility, Converter={StaticResource UnvisibleConvert}}">
                             <Path Data="M11,5 L11,14 L2,14 L2,5 L11,5 Z M10,6 L3,6 L3,13 L10,13 L10,6 Z" Fill="{StaticResource color.btn.sec.text.def}" />
                             <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 2 14 11 11 11 11 10 13 10 13 3 6 3 6 5 5 5 5 2" />
@@ -423,18 +424,17 @@
                     </Grid>
                 </Button>
                 <Button
-                Name="BtnClose"
-                Width="46"
-                Height="40"
-                Background="Transparent"
-                BorderThickness="0"
-                Click="BtnClose_Click"
-                Style="{StaticResource CloseBtn}">
+                    Name="BtnClose"
+                    Width="46"
+                    Height="40"
+                    Background="Transparent"
+                    BorderThickness="0"
+                    Click="BtnClose_Click"
+                    Style="{StaticResource CloseBtn}">
                     <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="11.2919922 12 12 11.2919922 6.70800781 6 12 0.708007813 11.2919922 0 6 5.29199219 0.708007812 9.76996262e-15 -2.27456942e-13 0.708007813 5.29199219 6 0 11.2919922 0.708007812 12 6 6.70800781" />
                 </Button>
             </StackPanel>
         </DockPanel>
-       
 
         <!--  OCR Progress Control  -->
         <Grid Grid.RowSpan="2" Visibility="{Binding IsProcessVisible}">
@@ -480,4 +480,4 @@
             </Border>
         </Grid>
     </Grid>
-</Window>
+</Window>

+ 49 - 19
PDF Office/Views/MainWindow.xaml.cs

@@ -26,6 +26,7 @@ using PDF_Master.Properties;
 using System.Windows.Interop;
 using System.Runtime.InteropServices;
 using System.Security.Cryptography;
+using System.Diagnostics;
 
 namespace PDF_Master.Views
 {
@@ -38,6 +39,11 @@ namespace PDF_Master.Views
 
         public IRegionManager region;
 
+        /// <summary>
+        /// 窗口大小是否改变
+        /// </summary>
+        private bool sizeChange = false;
+
         public MainWindow()
         {
             InitializeComponent();
@@ -85,7 +91,6 @@ namespace PDF_Master.Views
                     }
                     if (File.Exists(filePath))
                     {
-
                         //打开传过来的文件路径
                         if (App.OpenedFileList.Contains(filePath))
                         {
@@ -105,18 +110,15 @@ namespace PDF_Master.Views
                 }
                 catch
                 {
-
                 }
                 handled = true;
                 return (IntPtr)(1);
             }
-            if (msg == App.WakeId|| msg == App.WebopenexpiredId)
+            if (msg == App.WakeId || msg == App.WebopenexpiredId)
             {
-              
                 //将现有窗口激活 并前置
                 try
                 {
-                   
                     Activate();
                     //最小化后激活
                     if (this.WindowState == WindowState.Minimized)
@@ -127,14 +129,14 @@ namespace PDF_Master.Views
                     Topmost = true;
                     Topmost = false;
                     ServiceHelper.GetUser();
-                    if(msg==App.WebopenexpiredId)
+                    if (msg == App.WebopenexpiredId)
                     {
-                        if (App.IsLogin == true&&App.UserOpen==false)
+                        if (App.IsLogin == true && App.UserOpen == false)
                         {
                             App.mainWindowViewModel.OpenUser();
                             App.WebOpencase = "";
                         }
-                        else if(App.IsLogin == false&&App.LoginOpen == false)
+                        else if (App.IsLogin == false && App.LoginOpen == false)
                         {
                             App.mainWindowViewModel.OpenLogin();
                             App.WebOpencase = "";
@@ -144,7 +146,6 @@ namespace PDF_Master.Views
                 }
                 catch
                 {
-
                 }
 
                 return (IntPtr)(1);
@@ -157,7 +158,7 @@ namespace PDF_Master.Views
         /// </summary>
         /// <param name="eventAggregator"></param>
 
-        public MainWindow(IEventAggregator eventAggregator, IContainerProvider container) :this()
+        public MainWindow(IEventAggregator eventAggregator, IContainerProvider container) : this()
         {
             aggregator = eventAggregator;
             eventAggregator?.GetEvent<DragablzWindowEvent>().Publish(new DragablzWindowEventArgs() { TabControl = TabablzControl, Type = DragablzWindowEventType.Opened });
@@ -192,8 +193,8 @@ namespace PDF_Master.Views
             aggregator?.GetEvent<DragablzWindowEvent>().Publish(new DragablzWindowEventArgs() { TabControl = TabablzControl, Type = DragablzWindowEventType.Activated });
             //只需要第一次激活时获取一次信息
 
-            if(App.IsFirstOpen)
-            {            
+            if (App.IsFirstOpen)
+            {
                 //判断本地有没有token,没有显示登录,有再判断登录状态
                 if (Settings.Default.AppProperties.LoginToken != "")
                 {
@@ -247,7 +248,7 @@ namespace PDF_Master.Views
             //设为默认浏览器后,外部点击文档打开
             if (App.NeedOpenFilePathList.Count != 0)
             {
-                for(int i=0;i<App.NeedOpenFilePathList.Count;i++)
+                for (int i = 0; i < App.NeedOpenFilePathList.Count; i++)
                 {
                     (this.DataContext as MainWindowViewModel).AddTabItem(App.NeedOpenFilePathList[i]);
                     await Task.Delay(50);
@@ -298,7 +299,6 @@ namespace PDF_Master.Views
 
         private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
         {
-            UpdateTitleMargin();
             if (this.WindowState == WindowState.Maximized)
             {
                 ico_max.Visibility = Visibility.Collapsed;
@@ -307,6 +307,12 @@ namespace PDF_Master.Views
             {
                 ico_max.Visibility = Visibility.Visible;
             }
+
+            UpdateTitleMargin();
+            if (this.ActualWidth != 1280)
+            {
+                sizeChange = true;
+            }
         }
 
         /// <summary>
@@ -315,13 +321,37 @@ namespace PDF_Master.Views
         private void UpdateTitleMargin()
         {
             var width = StkPnlRight.ActualWidth;
-            BtnAdd.Margin = new Thickness(8, 13, width, 7);
+
+            if (BorderUpgrade.Visibility == Visibility.Collapsed)
+            {
+                BtnAdd.Margin = new Thickness(8, 13, width, 7);
+            }
+            else
+            {
+                if (this.WindowState == WindowState.Maximized)
+                {
+                    BtnAdd.Margin = new Thickness(8, 13, width, 7);
+                }
+                else
+                {
+                    if (sizeChange)
+                    {
+                        BtnAdd.Margin = new Thickness(8, 13, width, 7);
+                    }
+                    else
+                    {
+                        sizeChange = false;
+                        BtnAdd.Margin = new Thickness(8, 13, width + 50, 7);
+                    }
+                }
+            }
+
             TabablzControl.UpdateLayout();
         }
 
         private void TxtRename_PreviewKeyDown(object sender, KeyEventArgs e)
         {
-            if(e.Key == Key.Enter)
+            if (e.Key == Key.Enter)
             {
                 TabablzControl.Focus();
             }
@@ -364,10 +394,10 @@ namespace PDF_Master.Views
                 //放在主窗体的显示事件里,避免因网络请求问题导致启动缓慢
                 await Task.Run(() =>
                 {
-                //上传启动信息至服务端
-                ServiceHelper.CreateDeviceLog();
+                    //上传启动信息至服务端
+                    ServiceHelper.CreateDeviceLog();
                 });
             }
         }
     }
-}
+}

+ 17 - 3
PDF Office/Views/PageEdit/PageEditContent.xaml.cs

@@ -668,11 +668,17 @@ namespace PDF_Master.Views.PageEdit
                 startChoose = true;
                 if (ListPageEdit.SelectedItems.Count > 0)
                 {
-                    ListPageEdit.SelectedItems.Clear();
+                    // 缩略图 点击空白取消选中
+                    if (GridBOTAHeader.Visibility != Visibility.Visible)
+                    {
+                        ListPageEdit.SelectedItems.Clear();
+                    }
                 }
                 starPosition = e.GetPosition(ListPageEdit);
                 starPosition = new Point(starPosition.X, starPosition.Y + GetWrapPanel(ListPageEdit).VerticalOffset);
                 Mouse.Capture(ListPageEdit);
+                //点击空白处时 获取焦点;方便跨文件复制粘贴
+                ListPageEdit.Focus();
                 return;
             }
             //选中了item 时,不能框选
@@ -745,6 +751,9 @@ namespace PDF_Master.Views.PageEdit
             RectChoose.Height = rec.Height;
             RectChoose.Visibility = Visibility.Visible;
 
+            Trace.WriteLine(rec.Width);
+            Trace.WriteLine(rec.Height);
+
             //检测遍历所有项,筛选在矩形框中的Item
             for (int i = 0; i < ListPageEdit.Items.Count; i++)
             {
@@ -752,8 +761,9 @@ namespace PDF_Master.Views.PageEdit
                 //通过这一步来避免重复误选中
                 var parent = CommonHelper.FindVisualParent<VirtualizingWrapPanel>(_item);
                 if (parent == null)
+                {
                     continue;
-
+                }
                 var v = VisualTreeHelper.GetOffset(_item);
                 if (rec.IntersectsWith(new Rect(v.X, v.Y, _item.ActualWidth, _item.ActualHeight)))
                 {
@@ -761,7 +771,11 @@ namespace PDF_Master.Views.PageEdit
                 }
                 else
                 {
-                    ListPageEdit.SelectedItems.Remove(ListPageEdit.Items[i]);
+                    // 缩略图 点击空白取消选中
+                    if (GridBOTAHeader.Visibility != Visibility.Visible)
+                    {
+                        ListPageEdit.SelectedItems.Remove(ListPageEdit.Items[i]);
+                    }
                 }
             }
             return;

+ 1 - 1
PDF Office/Views/PropertyPanel/PDFEdit/TextEditProperty.xaml

@@ -77,7 +77,7 @@
                                 Name="SampleText"
                                 HorizontalAlignment="Center"
                                 VerticalAlignment="Center"
-                                FontFamily="{Binding CurrentFontFamily.ValueStr}"
+                                FontFamily="{Binding CurrentFontFamily.Content}"
                                 FontSize="{Binding CurrentFontSize.Value}"
                                 FontStyle="{Binding FontStyleItem}"
                                 FontWeight="{Binding FontWeightItem}"

+ 45 - 0
PDF Office/Views/PropertyPanel/PropertyPanelContentEdit.xaml

@@ -0,0 +1,45 @@
+<UserControl
+    x:Class="PDF_Master.Views.PropertyPanel.PropertyPanelContentEdit"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:Convert="clr-namespace:PDF_Master.DataConvert"
+    xmlns:PropertyPanel="clr-namespace:PDF_Master.ViewModels.PropertyPanel"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:local="clr-namespace:PDF_Master.Views.PropertyPanel"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    d:DataContext="{d:DesignInstance Type=PropertyPanel:PropertyPanelContentEditViewModel}"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    Background="{StaticResource color.sys.layout.mg}"
+    mc:Ignorable="d">
+    <Grid VerticalAlignment="Stretch">
+
+        <Grid>
+            <StackPanel x:Name="NoStampStackPanel" VerticalAlignment="Center">
+                <Image
+                    Width="128"
+                    Height="128"
+                    Source="pack://application:,,,/PDF Master;component/Resources/PropertyPanel/addimage.png" />
+                <TextBlock
+                    HorizontalAlignment="Center"
+                    FontFamily="Segoe UI"
+                    FontSize="12"
+                    FontWeight="SemiBold"
+                    Foreground="#616469"
+                    Text="Add Image" />
+                <TextBlock
+                    Width="168"
+                    Margin="0,2,0,0"
+                    HorizontalAlignment="Center"
+                    FontFamily="Segoe UI"
+                    FontSize="12"
+                    Foreground="#94989C"
+                    Text="Select an area on the page to insert the image."
+                    TextAlignment="Center"
+                    TextWrapping="Wrap" />
+            </StackPanel>
+        </Grid>
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/PropertyPanel/PropertyPanelContentEdit.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_Master.Views.PropertyPanel
+{
+    /// <summary>
+    /// PropertyPanelContentEdit.xaml 的交互逻辑
+    /// </summary>
+    public partial class PropertyPanelContentEdit : UserControl
+    {
+        public PropertyPanelContentEdit()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 7 - 3
PDF Office/Views/Tools/TextEditToolContent.xaml

@@ -7,7 +7,9 @@
     xmlns:local="clr-namespace:PDF_Master.Views.Tools"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
+    xmlns:viewmodels="clr-namespace:PDF_Master.ViewModels.Tools"
     Height="40"
+    d:DataContext="{d:DesignInstance Type=viewmodels:TextEditToolContentViewModel}"
     d:DesignHeight="450"
     d:DesignWidth="800"
     prism:ViewModelLocator.AutoWireViewModel="True"
@@ -15,7 +17,7 @@
     <Grid>
         <Border BorderBrush="{StaticResource color.sys.layout.divider}" BorderThickness="0,1,0,1">
             <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
-                <customControl:CustomIconToggleBtn IsChecked="{Binding IsTextEdit}"
+                <customControl:CustomIconToggleBtn
                     x:Name="BtnAddText"
                     Height="28"
                     Padding="4,0"
@@ -23,6 +25,7 @@
                     CommandParameter="{Binding ElementName=BtnAddText}"
                     ContentStringFormat="156"
                     Foreground="Black"
+                    IsChecked="{Binding IsTextEdit}"
                     Style="{StaticResource SubToolbarTgb}"
                     Tag="Text">
                     <StackPanel Orientation="Horizontal">
@@ -40,7 +43,7 @@
                             Text="Add Text" />
                     </StackPanel>
                 </customControl:CustomIconToggleBtn>
-                <customControl:CustomIconToggleBtn IsChecked="{Binding IsImgEdit}"
+                <customControl:CustomIconToggleBtn
                     x:Name="BtnAddImage"
                     Height="28"
                     Margin="8,0"
@@ -49,6 +52,7 @@
                     CommandParameter="{Binding ElementName=BtnAddImage}"
                     ContentStringFormat="156"
                     Foreground="{StaticResource color.icon.base.brand}"
+                    IsChecked="{Binding IsImgEdit}"
                     Style="{StaticResource SubToolbarTgb}"
                     Tag="Image">
                     <StackPanel Orientation="Horizontal">
@@ -58,9 +62,9 @@
                         </Grid>
                         <TextBlock
                             Margin="4,0,0,0"
+                            VerticalAlignment="Center"
                             FontFamily="Segoe UI"
                             FontSize="12"
-                            VerticalAlignment="Center"
                             Text="Add Image" />
                     </StackPanel>
                 </customControl:CustomIconToggleBtn>

BIN
PDF Office/x64/CPDFConverterNative.dll


BIN
PDF Office/x64/ComDocumentAINative.dll


BIN
PDF Office/x64/ComPDFKit.dll


BIN
PDF Office/x64/DocumentAI.dll


BIN
PDF Office/x64/paddle2onnx.dll


BIN
PDF Office/x86/CPDFConverterNative.dll


BIN
PDF Office/x86/ComPDFKit.dll


+ 68 - 0
PDFSettings/DefaultEditProperty.cs

@@ -0,0 +1,68 @@
+using ComPDFKit.PDFPage.Edit;
+using ComPDFKit.PDFPage;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+using ComPDFKitViewer.AnnotEvent;
+
+namespace PDFSettings
+{
+    public class DefaultEditProperty
+    {
+        public bool IsItalic { get; set; }
+        public bool ClipImage { get; set; }
+        public bool HorizontalMirror { get; set; }
+        public bool VerticalMirror { get; set; }
+        public List<string> SystemFontNameList { get; set; }
+        public int Transparency { get; set; }
+        public bool IsBold { get; set; }
+        public string ReplaceImagePath { get; set; }
+        public string FontName { get; set; }
+        public TextAlignType TextAlign { get; set; }
+        public Color FontColor { get; set; }
+        public bool AutoBlock { get; set; }
+        public double FontSize { get; set; }
+        public CPDFEditType EditType { get; set; }
+        public int Rotate { get; set; } = 0;
+        public string SaveKey;
+
+        public DefaultEditProperty()
+        {
+            EditType = CPDFEditType.None;
+        }
+    }
+
+    public class DefaultEditProperties : List<DefaultEditProperty>
+    {
+        public DefaultEditProperty GetEditProperty(CPDFEditType editType)
+        {
+            return this.AsEnumerable().Where(x => x.EditType == editType).FirstOrDefault();
+        }
+
+        public DefaultEditProperty GetEditProperty(CPDFEditType editType, string saveKey)
+        {
+            return this.AsEnumerable().Where(x => x.EditType == editType && x.SaveKey == saveKey).FirstOrDefault();
+        }
+
+        public void SetEditProperty(DefaultEditProperty editType)
+        {
+            DefaultEditProperty[] deleteArray = new DefaultEditProperty[0];
+            if (editType.SaveKey != null && editType.SaveKey != string.Empty)
+            {
+                deleteArray = this.AsEnumerable().Where(x => x.EditType == editType.EditType && x.SaveKey == editType.SaveKey).ToArray();
+            }
+            else
+            {
+                deleteArray = this.AsEnumerable().Where(x => x.EditType == editType.EditType).ToArray();
+            }
+            foreach (DefaultEditProperty deleteProperty in deleteArray)
+            {
+                this.Remove(deleteProperty);
+            }
+            this.Add(editType);
+        }
+    }
+}

+ 2 - 0
PDFSettings/PDFSettings.csproj

@@ -94,11 +94,13 @@
     <Compile Include="ColorSelectorList.cs" />
     <Compile Include="CustomStampList.cs" />
     <Compile Include="DefaultAnnotProperty.cs" />
+    <Compile Include="DefaultEditProperty.cs" />
     <Compile Include="DialogCounter.cs" />
     <Compile Include="DpiHelpers.cs" />
     <Compile Include="BackgroundTemplateList.cs" />
     <Compile Include="PDFEditList.cs" />
     <Compile Include="PDFToolsList.cs" />
+    <Compile Include="PresetEditFontList.cs" />
     <Compile Include="PresetFontList.cs" />
     <Compile Include="ProductActiveInfo.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />

+ 16 - 0
PDFSettings/PresetEditFontList.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDFSettings
+{
+    public class PresetEditFontList : List<PresetFontItem>
+    {
+    }
+
+    public class PreinstallEditFontList : List<PreinstallItem>
+    {
+    }
+}

+ 18 - 17
UpdateXML/pdfmaster_win_en_Us.xml

@@ -1,27 +1,28 @@
 <?xml version="1.0" encoding="utf-8"?>
 <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"  xmlns:dc="http://purl.org/dc/elements/1.1/">
-  <channel>
-    <title>PDF Master's Changelog</title>
-    <link> https://www.pdfreaderpro.com/downloads/pdfmaster_win_en_Us.xml</link>
-    <description>Most recent changes with links to updates.</description>
-    <language>en</language>
-      <item>
-        <title>Version 1.2.0</title>
-        <description>
-            <![CDATA[
+	<channel>
+		<title>PDF Master's Changelog</title>
+		<link> https://www.pdfreaderpro.com/downloads/pdfmaster_win_en_Us.xml</link>
+		<description>Most recent changes with links to updates.</description>
+		<language>en</language>
+		<item>
+			<title>Version 1.3.0.0</title>
+			<description>
+				<![CDATA[
           <ul>
-            <head>PDF Master New Release: Edit PDF page for a more organized document!</head>
+            <head>PDF Master New Release: </head>
             <br></br>
-            <li> <b>Organize Pages: </b>Easily delete, insert, rotate, split pages, or rearrange pages by dragging and dropping;</li>
-            <li><b>AI Technology:</b>AI robot helps you to translate, rewrite, or correct errors in a PDF file, improving productivity significantly;</li>
             <li>Tiny bug fixes and performance improvements for user experience.</li>
             <br></br>
             <head>We are constantly improving our software, if you have any questions or feedback, feel free to contact us at support@pdfreaderpro.com</head>
             </ul>
             ]]>
-        </description>
-       <pubDate>Thur, 20 Dec 2022 00:00:00 +0000</pubDate>
-        <enclosure url="https://www.pdfreaderpro.com/downloads/PDFMaster.exe" sparkle:version="1.2.0.0" />
-      </item>
-  </channel>
+			</description>
+			<pubDate>Thur, 20 Dec 2022 00:00:00 +0000</pubDate>
+			<enclosure url="https://www.pdfreaderpro.com/downloads/PDFMaster.exe" sparkle:version="1.3.0.0" />
+			<ocrenclosure>
+				<ocrenclosure0 ocrurl="https://www.pdfreaderpro.com/downloads/OCREngine.zip" ocrmd5="65d21a699138c194f06a8640dd40a901" sparkle:startversion="1.3.0.0" sparkle:endversion="1.3.0.0" />
+			</ocrenclosure>
+		</item>
+	</channel>
 </rss>

+ 22 - 20
UpdateXML/pdfmaster_win_zh_Hans.xml

@@ -1,26 +1,28 @@
 <?xml version="1.0" encoding="utf-8"?>
 <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"  xmlns:dc="http://purl.org/dc/elements/1.1/">
-  <channel>
-    <title>PDF Reader Pro's Changelog</title>
-    <link> https://www.pdfreaderpro.com/downloads/pdfreaderprocast_win.xml</link>
-    <description>Most recent changes with links to updates.</description>
-    <language>en</language>
-           <item>
-        <title>Version 1.2.0.0</title>
-        <description>
-            <![CDATA[
-           <ul>
-            <head>PDF Reader Pro 新版本发布!利用升级的转档工具快速将PDF转换成Office文档!</head>
+	<channel>
+		<title>PDF Master's Changelog</title>
+		<link> https://www.pdfreaderpro.com/downloads/pdfmaster_win_zh_Hans.xml</link>
+		<description>Most recent changes with links to updates.</description>
+		<language>en</language>
+		<item>
+			<title>Version 1.3.0.0</title>
+			<description>
+				<![CDATA[
+          <ul>
+            <head>PDF Master New Release: </head>
             <br></br>
-              <li>优化PDF转档器:快速将您的PDF文件转换为Microsoft Word (.docx)、Excel (.xlsx)、PowerPoint (.pptx)、图片和文本等;</li>
-                <li>已知问题修复,性能优化,提高用户体验。</li>
+            <li>Tiny bug fixes and performance improvements for user experience.</li>
             <br></br>
-            <head>有任何反馈,意见或是建议,请随时与我们联系:support@pdfreaderpro.com</head>
+            <head>We are constantly improving our software, if you have any questions or feedback, feel free to contact us at support@pdfreaderpro.com</head>
             </ul>
             ]]>
-        </description>
-       <pubDate>Thur, 20 Dec 2022 00:00:00 +0000</pubDate>
-     <enclosure url="http://test-pdf-pro.kdan.cn:3021/downloads/PDFMaster.exe" sparkle:version="1.2.0.0" />
-      </item>
-  </channel>
-</rss>
+			</description>
+			<pubDate>Thur, 20 Dec 2022 00:00:00 +0000</pubDate>
+			<enclosure url="https://www.pdfreaderpro.com/downloads/PDFMaster.exe" sparkle:version="1.3.0.0" />
+			<ocrenclosure>
+				<ocrenclosure0 ocrurl="https://www.pdfreaderpro.com/downloads/OCREngine.zip" ocrmd5="65d21a699138c194f06a8640dd40a901" sparkle:startversion="1.3.0.0" sparkle:endversion="1.3.0.0" />
+			</ocrenclosure>
+		</item>
+	</channel>
+</rss>

+ 0 - 0
UpdateXML/pdfmaster_win_zh_Hant.xml


Some files were not shown because too many files changed in this diff