Browse Source

综合-注释 优化UX;优化代码;BOTA列表,移除点击阅读页取消选中逻辑;BOTA列表,移除Esc取消选中逻辑

OYXH\oyxh 1 year ago
parent
commit
295359f693

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

+ 32 - 13
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);
+                            //}
+
+                            #endregion 失败率比较高 当数据多的时候
 
-                            await Task.Delay(5);
-                            AnnotationList.ScrollIntoView(item);
-                            //events.GetEvent<RefreshAnnotationEvent>().Publish(new RefreshAnnotationArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, IsAll = false, IsSelect = true, annotHandlerArgs = item });
+                            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
@@ -1176,8 +1195,7 @@ namespace PDF_Master.ViewModels.BOTA
                         if (ViewContentViewModel.OpenBOTA && bOTAContent.TabItemAnnotation.IsSelected)
                         {
                             events.GetEvent<RefreshAnnotationEvent>().Publish(new RefreshAnnotationArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, IsAll = false, annotHandlerArgs = args });
-                        }
-                        
+                        }
                     }
                 }
             }
@@ -1492,7 +1510,8 @@ namespace PDF_Master.ViewModels.BOTA
                     {
                         return;
                     }
-                    listBox.SelectedItems.Clear();
+                    //Windows:BOTA列表,移除Esc取消选中逻辑
+                    //listBox.SelectedItems.Clear();
                 }
             }
             if (KeyEventsHelper.IsSingleKey(System.Windows.Input.Key.Delete))

+ 61 - 19
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -30,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;
@@ -247,11 +248,30 @@ namespace PDF_Master.ViewModels.Tools
                 {
                     //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)
@@ -529,6 +549,9 @@ namespace PDF_Master.ViewModels.Tools
             }
             if (e == null)
             {
+                //注释列表取消选中
+                //不能写在这里 容易造成死循环
+
                 ViewContentViewModel.mainViewModel.AnnotMouseLeftButtonDown = false;
                 if (ViewContentViewModel.IsRightMenuSelectedTextAddLink || ViewContentViewModel.IsRightMenuCreateLink)
                 {
@@ -976,18 +999,41 @@ 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)
+            {
+                List<AnnotHandlerEventArgs> annotationHandlers = PDFViewer.GetSelectionAnnots();
                 bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
                 if (ViewContentViewModel.OpenBOTA == false)
                 {
@@ -997,13 +1043,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 });
                 }
             }
         }

+ 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

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

@@ -2171,6 +2171,8 @@ namespace PDF_Master.ViewModels.Tools
 
                                     break;
                             }
+
+                            CleanAnnotationSelect();
                         }
                     }
                     else

+ 104 - 76
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,138 @@ 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(500);
+                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);
+                                await Task.Delay(5);
                                 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)
-                                {
-                                    g.IsExpanded = true;
-                                }
-                                else
+                                if (stackpanel != null)
                                 {
-                                    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.annotHandlerArgs != null)
+                if (obj.Pageindex != -1 && obj.AnnotIndex != -1)
                 {
-                    try
+                    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)
+            {
+                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 +499,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 +548,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 - 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;
         }
     }
-}
+}