瀏覽代碼

Merge branch 'dev' into beta

ZhouJieSheng 1 年之前
父節點
當前提交
3d8daf4ecd
共有 52 個文件被更改,包括 1667 次插入920 次删除
  1. 9 3
      PDF Office/App.xaml.cs
  2. 二進制
      PDF Office/ComPDFKit.Desk.dll
  3. 二進制
      PDF Office/ComPDFKit.Viewer.dll
  4. 6 5
      PDF Office/EventAggregators/RefreshAnnotationEvent.cs
  5. 127 0
      PDF Office/Helper/EditHelper.cs
  6. 15 5
      PDF Office/Helper/FileComparisonHelper.cs
  7. 212 303
      PDF Office/Helper/ServiceHelper.cs
  8. 46 44
      PDF Office/Model/AnnotPanel/FontBoard.cs
  9. 9 8
      PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs
  10. 41 15
      PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs
  11. 10 0
      PDF Office/PDF Master.csproj
  12. 2 2
      PDF Office/Properties/AssemblyInfo.cs
  13. 二進制
      PDF Office/Resources/PropertyPanel/addimage.png
  14. 4 5
      PDF Office/Styles/OutLineItemStyle.xaml
  15. 46 31
      PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs
  16. 16 0
      PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs
  17. 2 1
      PDF Office/ViewModels/BOTA/SearchContentViewModel.cs
  18. 49 3
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterExcelDialogViewModel.cs
  19. 47 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterHTMLDialogViewModel.cs
  20. 47 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterPPTDialogViewModel.cs
  21. 47 0
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterRTFDialogViewModel.cs
  22. 52 3
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterTextDialogViewModel.cs
  23. 53 6
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterWordDialogViewModel.cs
  24. 25 63
      PDF Office/ViewModels/Dialog/ConverterDialogs/OCRDownloadProgressViewModel.cs
  25. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageRemoveDialogViewModel.cs
  26. 11 13
      PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs
  27. 70 0
      PDF Office/ViewModels/PropertyPanel/PropertyPanelContentEditViewModel.cs
  28. 289 217
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs
  29. 2 2
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Properties.cs
  30. 3 1
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs
  31. 21 9
      PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs
  32. 92 29
      PDF Office/ViewModels/ViewContentViewModel.cs
  33. 103 73
      PDF Office/Views/BOTA/AnnotationContent.xaml.cs
  34. 4 2
      PDF Office/Views/BOTA/BookmarkContent.xaml.cs
  35. 14 13
      PDF Office/Views/BOTA/OutLineControl.xaml.cs
  36. 14 8
      PDF Office/Views/BOTA/SearchContent.xaml.cs
  37. 1 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterExcelDialog.xaml
  38. 1 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterHTMLDialog.xaml
  39. 1 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterPPTDialog.xaml
  40. 1 1
      PDF Office/Views/Dialog/ConverterDialogs/ConverterRTFDialog.xaml
  41. 1 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterTextDialog.xaml
  42. 1 0
      PDF Office/Views/Dialog/ConverterDialogs/ConverterWordDialog.xaml
  43. 15 7
      PDF Office/Views/Dialog/ConverterDialogs/OCRDownloadProgress.xaml
  44. 5 0
      PDF Office/Views/Dialog/ConverterDialogs/OCRDownloadProgress.xaml.cs
  45. 11 11
      PDF Office/Views/Dialog/ServiceDialog/UserOutCodeRegion.xaml
  46. 6 6
      PDF Office/Views/HomePanel/HomeGuidContent.xaml
  47. 36 3
      PDF Office/Views/HomePanel/HomeGuidContent.xaml.cs
  48. 26 27
      PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml.cs
  49. 45 0
      PDF Office/Views/PropertyPanel/PropertyPanelContentEdit.xaml
  50. 28 0
      PDF Office/Views/PropertyPanel/PropertyPanelContentEdit.xaml.cs
  51. 二進制
      PDF Office/x64/ComPDFKit.dll
  52. 二進制
      PDF Office/x86/ComPDFKit.dll

+ 9 - 3
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;
@@ -548,6 +553,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>();

二進制
PDF Office/ComPDFKit.Desk.dll


二進制
PDF Office/ComPDFKit.Viewer.dll


+ 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; }
     }
 }

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

@@ -0,0 +1,127 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Master.Helper
+{
+    public static class EditHelper
+    {
+        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",
+    "等线",
+    "仿宋",
+    "黑体",
+    "楷体",
+    "宋体",
+    "微软雅黑"
+};
+    }
+}

+ 15 - 5
PDF Office/Helper/FileComparisonHelper.cs

@@ -69,16 +69,26 @@ 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))
             {
+                Settings.Default.AppProperties.OCRmodelMD5 = "65d21a699138c194f06a8640dd40a901";
+                Settings.Default.AppProperties.OCRFile_Url = "http://test-pdf-pro.kdan.cn:3021/downloads/OCREngine.zip";
                 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 +110,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);
@@ -173,7 +183,7 @@ namespace PDF_Master.Helper
                             return true;
                         }
                     }
-                    //return true;
+                    return false;
                 }
                 catch { return false; }
             }

+ 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("软件启动信息上传成功");
+                        }
                     }
                 }
             }

+ 46 - 44
PDF Office/Model/AnnotPanel/FontBoard.cs

@@ -6,6 +6,7 @@ using PDFSettings;
 using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -33,13 +34,24 @@ 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; }
 
         public List<PresetFontItem> PresetFontList = new List<PresetFontItem>();
 
+
         #endregion 变量
 
         #region 初始化下拉框或列表默认的数据
@@ -71,9 +83,9 @@ namespace PDF_Master.Model.AnnotPanel
         }
 
         //字体
-        private void InitBase_FontFamilys()
-        {
-            FontFamilyItems = TextFont.GetFamily();
+        public void InitBase_FontFamilys()
+        { 
+            FontFamilyItems = TextFont.GetFamilyEdit();
         }
 
         //字重
@@ -164,7 +176,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,40 +187,18 @@ 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;
-                    }
+                    FontFamilySelectedIndex=FontFamilyItems.IndexOf(value);
                 }
                 else
                 {
@@ -543,18 +533,16 @@ 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")
+            //WPF的UI字体不包含Helvetica
+            if (fontFamily == "Helvetica")
             {
-                uiStr = "Courier New";
+                fontFamily = "Arial";
+                uiStr = "Arial";
             }
             CurrentFontFamily = new ComboDataItem(fontFamily, uiStr);
         }
@@ -690,7 +678,7 @@ namespace PDF_Master.Model.AnnotPanel
         #region 字体样式
 
         //下拉框列表
-        private ComboDataItem _currentFontFamily = new ComboDataItem("Helvetica", "Helvetica");
+        private ComboDataItem _currentFontFamily = new ComboDataItem("Arial", "Arial");
 
         public ComboDataItem CurrentFontFamily
         {
@@ -704,7 +692,6 @@ namespace PDF_Master.Model.AnnotPanel
                         FontFamilySelectedIndex = 0;
                         break;
 
-                    case "Helvetica":
                     case "Arial":
                         FontFamilySelectedIndex = 1;
                         break;
@@ -712,6 +699,9 @@ namespace PDF_Master.Model.AnnotPanel
                     case "Times New Roman":
                         FontFamilySelectedIndex = 2;
                         break;
+                    case "Adobe Devanagari":
+                        FontFamilySelectedIndex = 3;
+                        break;
                 }
             }
         }
@@ -992,10 +982,22 @@ namespace PDF_Master.Model.AnnotPanel
 
         public void GetCurrentFontFamily(string fontFamily, string uiStr)
         {
-            if (fontFamily == "Arial")
+            if (fontFamily == "Helvetica")
+            {
+                fontFamily = "Arial";
+                uiStr = "Arial";
+            }
+            if (fontFamily == "Times-Roman")
+            {
+                uiStr = "Times New Roman";
+            }
+            if (fontFamily == "CourierNew")
+            {
+                uiStr = "Courier New";
+            }
+            if (fontFamily == "AdobeDevanagari")
             {
-                fontFamily = "Helvetica";
-                uiStr = "Helvetica";
+                uiStr = "Adobe Devanagari";
             }
             CurrentFontFamily = new ComboDataItem(fontFamily, uiStr);
         }
@@ -1012,7 +1014,7 @@ namespace PDF_Master.Model.AnnotPanel
             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")
+                    && (annot.FontName == item.mFontFamily.Source || annot.FontName == "Arial" && item.mFontFamily.Source == "Arial")
                     )
                 {
                     if (item.mTag != "Custom")

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

@@ -179,8 +179,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 +196,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 +210,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 +224,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 +238,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 +253,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 +267,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 +281,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;

+ 41 - 15
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -1,4 +1,6 @@
 using PDF_Master.CustomControl.CompositeControl;
+using PDF_Master.Helper;
+using PDF_Master.Model.AnnotPanel;
 using PDF_Master.Properties;
 using PDFSettings;
 using System;
@@ -211,7 +213,7 @@ 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;
 
@@ -220,7 +222,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             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;
 
@@ -229,7 +231,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             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 +240,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 +249,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 +258,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 +267,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;
 
@@ -332,18 +334,42 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             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");
-            FontFamilyItems.Add(item);
-            item = new ComboDataItem(/*"Times-Roman"*/"Times", "Times New Roman");
+        {
+            var FontFamilyItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Courier", "Courier New");
+            FontFamilyItems.Add(item);
+            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.FontFamily)
+            {
+                item = new ComboDataItem(DeleteCharacters(itemFam),itemFam);
+                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()

+ 10 - 0
PDF Office/PDF Master.csproj

@@ -398,6 +398,7 @@
     <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" />
@@ -638,6 +639,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 +1263,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 +2166,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 +2415,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>

+ 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")]

二進制
PDF Office/Resources/PropertyPanel/addimage.png


+ 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;
         }

+ 49 - 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("想用OCR,就去下载吧!", "", "取消", "确定");
+                    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:

+ 47 - 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("想用OCR,就去下载吧!", "", "取消", "确定");
+                    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")

+ 47 - 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("想用OCR,就去下载吧!", "", "取消", "确定");
+                    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"])

+ 47 - 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("想用OCR,就去下载吧!", "", "取消", "确定");
+                    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")

+ 52 - 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("想用OCR,就去下载吧!", "", "取消", "确定");
+                    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,7 +517,7 @@ 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;

+ 53 - 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;
@@ -125,9 +126,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 +199,8 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
 
         public DelegateCommand UnlockMouseDownCommand { get; set; }
 
+        public DelegateCommand OpenOCRCommand { get; set; }
+
         #endregion
 
         public ConverterWordDialogViewModel(IDialogService dialogService)
@@ -214,11 +214,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("想用OCR,就去下载吧!", "", "取消", "确定");
+                    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 +357,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
             {

+ 25 - 63
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,11 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
 
         public OCRDownloadProgressViewModel()
         {
-            CancelCommand= new DelegateCommand(cancel);
-            TryAgainCommnad= new DelegateCommand(tryAgain);
+            CancelCommand = new DelegateCommand(cancel);
+            TryAgainCommnad = new DelegateCommand(tryAgain);
         }
 
-        private async void  tryAgain()
+        private async void tryAgain()
         {
             try
             {
@@ -187,6 +184,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 +204,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 +254,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);
             }
@@ -303,39 +307,20 @@ 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);
@@ -397,30 +382,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 +391,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

+ 11 - 13
PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs

@@ -351,7 +351,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             item.mFontSize = (int)CurrentFontSize.Value;
 
             CurrentPresetFont = new ComboDataItem(item.mTag, item.mTagContent);
-            SelectedPresetFont();
+            //SelectedPresetFont();
             //更改后 保存到本地缓存
             TextFont.SavePresetFontList(PresetFontList);
 
@@ -816,10 +816,15 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
         //获取文本参数
         private void GetPDFEdit()
         {
+            if (!App.IsGetTextFamily)
+            {
 
+                EditHelper.FontFamily = TextEditEvent.SystemFontNameList;
+                InitBase_FontFamilys();
+                App.IsGetTextFamily = true;
+            }
             SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
             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;
@@ -831,20 +836,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             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")
-                {
-                    itemmFontFamily = "Courier New";
-                }
                 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")
@@ -865,7 +863,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 
                 if (TextEditEvent.FontName == ""|| TextEditEvent.FontName == null)
                 {
-                    GetCurrentFontFamily("Helvetica", "Helvetica");
+                    GetCurrentFontFamily("Arial", "Arial");
                 }
                 else
                 {

+ 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

+ 21 - 9
PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs

@@ -27,6 +27,7 @@ using Prism.Events;
 using System.Windows.Media.Imaging;
 using PDFReader_WPF.Helper;
 using PDF_Master.Properties;
+using PDF_Master.Model.AnnotPanel;
 
 namespace PDF_Master.ViewModels.Tools
 {
@@ -128,7 +129,7 @@ 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
@@ -341,7 +342,13 @@ namespace PDF_Master.ViewModels.Tools
                             }
                         }
                         
+                        else if (PDFViewer.ToolManager != null)
+                        {
+                            PDFViewer.ClearSelectPDFEdit();
+                            AddToPropertyPanel("PropertyPanelContentEdit", null);
+                            PDFViewer.ReloadDocument();
 
+                        }
 
 
 
@@ -422,7 +429,7 @@ namespace PDF_Master.ViewModels.Tools
                     PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
                     PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                     PDFViewer.ReloadDocument();
-                    AddToPropertyPanel("PropertyPanelContent", null);
+                    AddToPropertyPanel("PropertyPanelContentEdit", null);
                     ShowPropertyPanel(true);
                     
                 }
@@ -613,7 +620,7 @@ 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
@@ -657,6 +664,7 @@ namespace PDF_Master.ViewModels.Tools
 
         private void PDFViewer_PDFEditHandler(object sender, List<PDFEditSelectionData> e)
         {
+            PDFViewer.ClearSelectPDFEdit();
             PDFViewer.SelectPDFEdit(e,true);
         }
 
@@ -664,6 +672,7 @@ namespace PDF_Master.ViewModels.Tools
         //左键激活逻辑
         private void PDFViewer_PDFEditActiveHandler(object sender, List<PDFEditEvent> e)
         {
+            PDFViewer.ToolManager.IgnoreMoveDistance =5;
             //判断是否已退出登录,限制编辑操作
             if (!App.IsLogin)
             {
@@ -691,9 +700,9 @@ namespace PDF_Master.ViewModels.Tools
                     {
                         isText = true;
                     }
-
                 }
-
+               
+              
 
                 if (isText == true && isImg == false)
                 {
@@ -714,13 +723,16 @@ namespace PDF_Master.ViewModels.Tools
 
             else if(IsTextEdit==true)
             {
-                AddToPropertyPanel("PropertyPanelContent", null);
+                //单击添加文本
+                PDFViewer.ToolManager.EnableClickCreate = true;
+                PDFViewer.ToolManager.ClickCreateWidth = 60;
+                PDFViewer.ToolManager.ClickCreateHeight = 30;
                 AddToPropertyPanel("Text", null);
             }
             else
             {
 
-                AddToPropertyPanel("PropertyPanelContent", null);
+                AddToPropertyPanel("PropertyPanelContentEdit", null);
             }
 
             events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
@@ -800,8 +812,8 @@ namespace PDF_Master.ViewModels.Tools
         {
             //图片创建
             if (e.NotifyType == CustomNotifyType.PDFEditImageCreate)
-                {
-                    OpenFileDialog openFileDialog = new OpenFileDialog();
+            {
+                OpenFileDialog openFileDialog = new OpenFileDialog();
                     openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
                     if (openFileDialog.ShowDialog() == true)
                     {                 

+ 92 - 29
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>
@@ -883,7 +889,9 @@ namespace PDF_Master.ViewModels
 
         public DelegateCommand ZoomOutCommand { get; set; }
 
-        //是否显示视图面板
+        /// <summary>
+        /// 是否显示视图面板
+        /// </summary>
         public bool IsReadModeShow { get; internal set; } = false;
 
         #endregion 命令
@@ -1712,11 +1720,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 +1962,7 @@ namespace PDF_Master.ViewModels
         }
 
         public void ShowPrintDialog()
-        { 
+        {
             //保存并继续,使用了高级功能则弹窗权益弹窗
             if (!saveFile(true))
             {
@@ -2186,28 +2194,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 +2282,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)
             {
@@ -2600,6 +2669,7 @@ namespace PDF_Master.ViewModels
                 events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
             }
         }
+
         private void Redo()
         {
             PDFViewer.UndoManager.Redo();
@@ -2824,7 +2894,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 +2982,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 +3045,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 +3257,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 +3271,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 +3402,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 +3439,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 +3458,7 @@ namespace PDF_Master.ViewModels
 
                 if (flg == false)
                 {
-                    return ;
+                    return;
                 }
             }
             var dlg = new SaveFileDialog();
@@ -3560,14 +3630,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 +3662,7 @@ namespace PDF_Master.ViewModels
         {
             ServiceHelper.GetUser();
         }
+
         #endregion 方法
 
         #region Navigate

+ 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();
             }
         }
 

+ 4 - 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)
             //{

+ 14 - 13
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,12 +534,13 @@ namespace PDF_Master.Views.BOTA
         {
             if (e.Key == Key.Escape)
             {
-                OutlineNode outlineNode = OutlineView.SelectedItem as OutlineNode;
-                if (outlineNode != null)
-                {
-                    outlineNode.IsSelected = false;
-                    e.Handled = true;
-                }
+                //Windows:BOTA列表,移除Esc取消选中逻辑
+                //OutlineNode outlineNode = OutlineView.SelectedItem as OutlineNode;
+                //if (outlineNode != null)
+                //{
+                //    outlineNode.IsSelected = false;
+                //    e.Handled = true;
+                //}
             }
         }
 

+ 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>

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

@@ -68,6 +68,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>

+ 15 - 7
PDF Office/Views/Dialog/ConverterDialogs/OCRDownloadProgress.xaml

@@ -1,11 +1,19 @@
 <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"
+    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/"
         Background="Transparent" Width="374"
-                Height="120" >
+                Height="120" d:DesignHeight="120"
+    d:DesignWidth="374"
+    prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
+             Loaded="UserControl_Loaded"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    mc:Ignorable="d">
     <Grid>
         <Border
               Name="ProgressVisible"  Panel.ZIndex="1" Background="Transparent" Visibility="Visible">
@@ -54,7 +62,7 @@
                         BorderThickness="0"
                         Background="Transparent"
                         Command="{Binding CancelCommand}"
-                        Visibility="Visible">
+                        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" 
@@ -85,7 +93,7 @@
                         <TextBlock Name="ErrorTextBlock" Text="{Binding T_ErrorTextBlock}" Foreground="#F3465B"  FontSize="11" VerticalAlignment="Center"></TextBlock>
                     </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="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>
                 </Grid>

+ 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)
+        {
+
+        }
     }
 }

+ 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"

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

@@ -15,10 +15,10 @@
     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,13 +27,13 @@
                 </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"
-                    Margin="24,0" />
+                    Margin="24,0"
+                    MouseDown="Recentlist_MouseDown" />
             </Grid>
         </ScrollViewer>
     </Grid>
-</UserControl>
+</UserControl>

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

@@ -1,4 +1,5 @@
-using System.Windows;
+using PDF_Master.Views.HomePanel.RecentFiles;
+using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
@@ -45,6 +46,38 @@ namespace PDF_Master.Views.HomePanel
                 if (foundChild != null) break;
             }
             return foundChild;
-        }
+        }
+
+        private void Recentlist_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            //Windows:最近文件列表补充点击空白处取消选中;移除Esc取消选中逻辑
+            if (sender is RecentFilesContent recentFilesContent)
+            {
+                if (recentFilesContent.GridRecentFilesList.Visibility == Visibility.Visible)
+                {
+                    var point = e.GetPosition(recentFilesContent.GridRecentFilesList);
+                    var result = VisualTreeHelper.HitTest(recentFilesContent.GridRecentFilesList, point);
+                    if (result != null)
+                    {
+                        if (recentFilesContent.GridRecentFilesList.SelectedIndex != -1)
+                        {
+                            recentFilesContent.GridRecentFilesList.SelectedIndex = -1;
+                        }
+                    }
+                }
+                else if (recentFilesContent.RecentFilesList.Visibility == Visibility.Visible)
+                {
+                    var point = e.GetPosition(recentFilesContent.RecentFilesList);
+                    var result = VisualTreeHelper.HitTest(recentFilesContent.RecentFilesList, point);
+                    if (result != null)
+                    {
+                        if (recentFilesContent.RecentFilesList.SelectedIndex != -1)
+                        {
+                            recentFilesContent.RecentFilesList.SelectedIndex = -1;
+                        }
+                    }
+                }
+            }
+        }
     }
-}
+}

+ 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();
             }
         }
     }
-}
+}

+ 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();
+        }
+    }
+}

二進制
PDF Office/x64/ComPDFKit.dll


二進制
PDF Office/x86/ComPDFKit.dll