Browse Source

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

lvle 1 year ago
parent
commit
dfb9e11bfe

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

@@ -68,6 +68,7 @@ using Microsoft.AppCenter.Crashes;
 using System.Runtime.InteropServices;
 using System.Security.Cryptography;
 using System.Text;
+using Prism.Services.Dialogs;
 
 namespace PDF_Master
 {
@@ -549,6 +550,8 @@ namespace PDF_Master
             containerRegistry.RegisterDialog<NoviceGuidDialog>(DialogNames.GuidDialog);
             containerRegistry.RegisterDialog<IAPCompareDialog>(DialogNames.IAPCompareDialog);
 
+            containerRegistry.Register<IDialogWindow, CustomControl.DialogWindow>();
+
             #endregion 注册弹窗
         }
 

+ 27 - 0
PDF Office/CustomControl/DialogWindow.cs

@@ -0,0 +1,27 @@
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PDF_Master.CustomControl
+{
+    /// <summary>
+    /// 为解决 拖拽打开加密文档时,解密弹窗偶现不属于主窗体的问题,重写Prism dialog
+    /// </summary>
+    public class DialogWindow : Window, IDialogWindow
+    {
+        public IDialogResult Result { get; set; }
+
+        public DialogWindow()
+        {
+            if(Owner==null)
+            {
+                Owner = Application.Current.MainWindow;
+            }
+        }
+
+    }
+}

+ 6 - 0
PDF Office/EventAggregators/PageEditNotifyEvent.cs

@@ -25,6 +25,12 @@ namespace PDF_Master.EventAggregators
             Type = NotifyType.RefreshPage;
         }
 
+        public PageEditNotifyEventArgs(string unicode, NotifyType type)
+        {
+            Unicode = unicode;
+            Type = type;
+        }
+
         public PageEditNotifyEventArgs(string unicode,NotifyType type,List<int> pages)
         {
             Unicode = unicode;

+ 1 - 0
PDF Office/PDF Master.csproj

@@ -299,6 +299,7 @@
     <Compile Include="CustomControl\CustomIconToggleBtn.cs" />
     <Compile Include="CustomControl\CustomImageControl.cs" />
     <Compile Include="CustomControl\DialogContent.cs" />
+    <Compile Include="CustomControl\DialogWindow.cs" />
     <Compile Include="CustomControl\Form\FormFieldCombox.xaml.cs">
       <DependentUpon>FormFieldCombox.xaml</DependentUpon>
     </Compile>

+ 33 - 23
PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs

@@ -243,6 +243,7 @@ namespace PDF_Master.ViewModels.BOTA
             region = regionManager;
             dialogs = dialogService;
             events = eventAggregator;
+            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             LoadedCommand = new DelegateCommand<object>(Loaded);
             ListBoxItemPreviewMouseLeftButtonDown = new DelegateCommand<object>(ListBoxItem_PreviewMouseLeftButtonDown);
             AddNotesCommand = new DelegateCommand<object>(AddNotesEvent);
@@ -255,12 +256,21 @@ namespace PDF_Master.ViewModels.BOTA
             TimeAscendingCommand = new DelegateCommand(TimeAscendingEvent);
             TimeDescendingCommand = new DelegateCommand(TimeDescendingEvent);
             InitString();
+
+
+            events.GetEvent<RefreshAnnotEvent>().Subscribe(RefreshData, e => e.Unicode == Unicode);
+            events.GetEvent<PageEditNotifyEvent>().Subscribe(OnNotifyEvent,e=>e.Unicode == Unicode&&e.Type== NotifyType.PageCountChanged);
+        }
+
+        private void OnNotifyEvent(PageEditNotifyEventArgs obj)
+        {
+            RefreshAnnotationListItems();
         }
 
         public void HiddenAnnot()
         {
             AnnotationListItems.Clear();
-            CurrentAnnotationLists = GetDocumentAnnotionList(out ObservableCollection<AnnotationHandlerEventArgs> HideAnnots);
+            CurrentAnnotationLists = GetDocumentAnnotionList(out HideAnnots);
             AnnotationListItems.AddRange(CurrentAnnotationLists);
             if (AnnotationListItems.Count <= 0)
             {
@@ -274,7 +284,7 @@ namespace PDF_Master.ViewModels.BOTA
         {
             AnnotationListItems.Clear();
             //AnnotationListItems = GetDocumentAnnotionList(out ObservableCollection<AnnotationHandlerEventArgs> HideAnnots);
-            CurrentAnnotationLists = GetDocumentAnnotionList(out ObservableCollection<AnnotationHandlerEventArgs> HideAnnots);
+            CurrentAnnotationLists = GetDocumentAnnotionList(out HideAnnots);
             AnnotationListItems.AddRange(CurrentAnnotationLists);
             RefreshAnnotationListItems();
         }
@@ -304,7 +314,7 @@ namespace PDF_Master.ViewModels.BOTA
                     }
                     PdfViewer.ReloadVisibleAnnots();
                     //提取出来的注释文件 时间为空  则显示未系统当前时间
-                    CurrentAnnotationLists = GetDocumentAnnotionList(out ObservableCollection<AnnotationHandlerEventArgs> HideAnnots);
+                    CurrentAnnotationLists = GetDocumentAnnotionList(out HideAnnots);
                     //BOTA,注释列表,添加在页面上的注释要默认按照页面上的位置排序,从上往下,从左往右排列
                     //CurrentAnnotationLists = new ObservableCollection<AnnotationHandlerEventArgs>(CurrentAnnotationLists.OrderBy(item => item.ClientRect.X).ThenBy(item => item.ClientRect.Y));
                     AnnotationListItems.Clear();
@@ -894,17 +904,17 @@ namespace PDF_Master.ViewModels.BOTA
                         DialogParameters value = new DialogParameters();
                         value.Add(ParameterNames.Annotation, args);
                         dialogs.ShowDialog(DialogNames.AddAnnotationDialog, value, e =>
-                                                                                                                                                                                          {
-                                                                                                                                                                                              if (e.Result == ButtonResult.OK && e.Parameters != null)
-                                                                                                                                                                                              {
-                                                                                                                                                                                                  PdfViewer.UndoManager.CanSave = true;
-                                                                                                                                                                                                  if (e.Parameters.ContainsKey(ParameterNames.Annotation) && e.Parameters.ContainsKey(ParameterNames.AnnotEvent))
-                                                                                                                                                                                                  {
-                                                                                                                                                                                                      AnnotationHandlerEventArgs annotation = e.Parameters.GetValue<AnnotationHandlerEventArgs>(ParameterNames.Annotation);
-                                                                                                                                                                                                      RefreshOneListItem(annotation.AnnotHandlerEventArgs);
-                                                                                                                                                                                                  }
-                                                                                                                                                                                              }
-                                                                                                                                                                                          });
+                        {
+                            if (e.Result == ButtonResult.OK && e.Parameters != null)
+                            {
+                                PdfViewer.UndoManager.CanSave = true;
+                                if (e.Parameters.ContainsKey(ParameterNames.Annotation) && e.Parameters.ContainsKey(ParameterNames.AnnotEvent))
+                                {
+                                    AnnotationHandlerEventArgs annotation = e.Parameters.GetValue<AnnotationHandlerEventArgs>(ParameterNames.Annotation);
+                                    RefreshOneListItem(annotation.AnnotHandlerEventArgs);
+                                }
+                            }
+                        });
                     }
                     //else if (args.EventType == AnnotArgsType.AnnotFreeText)
                     //{
@@ -1162,6 +1172,8 @@ namespace PDF_Master.ViewModels.BOTA
             KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
         }
 
+        private ObservableCollection<AnnotationHandlerEventArgs> HideAnnots;
+
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             var pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
@@ -1171,12 +1183,17 @@ namespace PDF_Master.ViewModels.BOTA
                 ViewContentViewModel = viewContentViewModel;
                 PdfViewer = pdfview;
             }
+            CurrentAnnotationLists = GetDocumentAnnotionList(out HideAnnots);
+
+            AnnotationListItems = new ObservableCollection<AnnotationHandlerEventArgs>();
+
+            AnnotationListItems.AddRange(CurrentAnnotationLists);
+
+            AnnotationListItems.CollectionChanged += AnnotationListItems_CollectionChanged;
             SetGroupHeader(listBox);
             //RefreshAnnotationListItems();
             KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
             KeyEventsHelper.KeyDown += ShortCut_KeyDown;
-            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
-            events.GetEvent<RefreshAnnotEvent>().Subscribe(RefreshData, e => e.Unicode == Unicode);
         }
 
         private void RefreshData(RefreshAnnotArgs obj)
@@ -1252,13 +1269,6 @@ namespace PDF_Master.ViewModels.BOTA
 
             #endregion BOTA,注释列表,添加在页面上的注释要默认按照页面上的位置排序,从上往下,从左往右排列
 
-            CurrentAnnotationLists = GetDocumentAnnotionList(out ObservableCollection<AnnotationHandlerEventArgs> HideAnnots);
-
-            AnnotationListItems = new ObservableCollection<AnnotationHandlerEventArgs>();
-
-            AnnotationListItems.AddRange(CurrentAnnotationLists);
-
-            AnnotationListItems.CollectionChanged += AnnotationListItems_CollectionChanged;
             //按照PageIndex,分组 排序
             ICollectionView iCollectionView = CollectionViewSource.GetDefaultView(AnnotationListItems);
             iCollectionView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(AnnotationHandlerEventArgs.PageIndex)));

+ 29 - 5
PDF Office/ViewModels/BOTA/BookmarkContentViewModel.cs

@@ -83,6 +83,7 @@ namespace PDF_Master.ViewModels.BOTA
         private IDialogService dialogs;
         public CPDFViewer PDFViewer;
         public IEventAggregator events;
+        private string unicode;
 
         /// <summary>
         /// 书签ItemSouce
@@ -145,6 +146,7 @@ namespace PDF_Master.ViewModels.BOTA
             region = regionManager;
             dialogs = dialogService;
             events = eventAggregator;
+            unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             Bookmarklist = new ObservableCollection<CPDFBookmark>();
 
             LostFocusCommand = new DelegateCommand<object>(LostFocusEvent);
@@ -156,6 +158,18 @@ namespace PDF_Master.ViewModels.BOTA
             EditPageIndexCommand = new DelegateCommand<object>(EditPageIndexEvent);
             KeyDownCommand = new DelegateCommand<object>(KeyDownEvent);
             InitString();
+
+            events.GetEvent<PageEditNotifyEvent>().Subscribe(OnNotifyEvent,e=>e.Unicode==unicode&&e.Type== NotifyType.PageCountChanged);
+        }
+
+        /// <summary>
+        /// 页面编辑页数发生变化后触发的事件
+        /// 更新BOTA数据源
+        /// </summary>
+        /// <param name="obj"></param>
+        private void OnNotifyEvent(PageEditNotifyEventArgs obj)
+        {
+            InitBookMarkSource();
         }
 
         /// <summary>
@@ -456,6 +470,20 @@ namespace PDF_Master.ViewModels.BOTA
             return isExistBookmark;
         }
 
+        /// <summary>
+        /// 刷新书签列表数据源
+        /// </summary>
+        private void InitBookMarkSource()
+        {
+            if (PDFViewer.Document.GetBookmarkList().Count > 0)
+            {
+                Bookmarklist = new ObservableCollection<CPDFBookmark>(PDFViewer.Document.GetBookmarkList().OrderBy(d => d.PageIndex));
+            }
+            //避免重复绑定
+            bookmarklist.CollectionChanged -= Bookmarklist_CollectionChanged;
+            Bookmarklist.CollectionChanged += Bookmarklist_CollectionChanged;
+        }
+
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
@@ -467,11 +495,7 @@ namespace PDF_Master.ViewModels.BOTA
                 IsEmptyPanelVisibility = Visibility.Visible;
                 return;
             }
-            if (PDFViewer.Document.GetBookmarkList().Count > 0)
-            {
-                Bookmarklist = new ObservableCollection<CPDFBookmark>(PDFViewer.Document.GetBookmarkList().OrderBy(d => d.PageIndex));
-            }
-            Bookmarklist.CollectionChanged += Bookmarklist_CollectionChanged;
+            InitBookMarkSource();
             if (Bookmarklist.Count < 1)
             {
                 IsEmptyPanelVisibility = Visibility.Visible;

+ 22 - 1
PDF Office/ViewModels/BOTA/OutLineControlViewModel.cs

@@ -3,9 +3,11 @@ using ComPDFKit.PDFDocument.Action;
 using ComPDFKit.PDFPage;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Master.CustomControl;
+using PDF_Master.EventAggregators;
 using PDF_Master.Model;
 using PDF_Master.Model.BOTA;
 using Prism.Commands;
+using Prism.Events;
 using Prism.Mvvm;
 using Prism.Regions;
 using System;
@@ -87,6 +89,10 @@ namespace PDF_Master.ViewModels.BOTA
 
         private CPDFViewer PDFViewer;
 
+        private IEventAggregator events;
+
+        private string unicode;
+
         public ObservableCollection<OutlineNode> Outlinelist { get; set; }
 
         private bool isInsertHead = false;
@@ -115,15 +121,20 @@ namespace PDF_Master.ViewModels.BOTA
         public DelegateCommand DeleteAllCommand { get; set; }
         public DelegateCommand<OutlineNode> DowngradeCommand { get; set; }
 
-        public OutLineControlViewModel()
+        public OutLineControlViewModel(IEventAggregator eventAggregator)
         {
+            events = eventAggregator;
+            unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             Outlinelist = new ObservableCollection<OutlineNode>();
             DeleteAllCommand = new DelegateCommand(DeleteAll);
             CollapseAllCommand = new DelegateCommand<ObservableCollection<OutlineNode>>(CollapseAll);
             ExpandAllCommand = new DelegateCommand<ObservableCollection<OutlineNode>>(ExpandAll);
             InitString();
+
+            events.GetEvent<PageEditNotifyEvent>().Subscribe(OneNotifyEvent, e =>e.Unicode == unicode&&e.Type == NotifyType.PageCountChanged);
         }
 
+
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;
@@ -160,6 +171,16 @@ namespace PDF_Master.ViewModels.BOTA
             PDFViewer.GetCreateOutLineInfo();
         }
 
+        /// <summary>
+        /// 缩略图或页面编辑的页面数量变化时 刷新大纲列表
+        /// </summary>
+        /// <param name="obj"></param>
+        private void OneNotifyEvent(PageEditNotifyEventArgs obj)
+        {
+            Updata(false);
+        }
+
+
         /// <summary>
         /// 更新大纲数据,并保存状态设置为true
         /// </summary>

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

@@ -2182,9 +2182,14 @@ namespace PDF_Master.ViewModels.PageEdit
         /// <param name="endIndex"></param>
         private async void RefreshItemImage(int startIndex, int endIndex)
         {
+            if(PDFViewer==null||PDFViewer.Document==null)
+            {
+                return;
+            }
+
             for (int i = startIndex; i <= endIndex; i++)
             {
-                if (i <= PageEditItems.Count - 1 && i >= 0 && PageEditItems.Count > 0)
+                if (i <= PageEditItems.Count - 1 && i >= 0 && PageEditItems.Count > 0&&PDFViewer.Document!=null)
                 {
                     //先更新一次每个页面的尺寸 确保图的方向正确
                     PageEditItems[i].Size = PDFViewer.Document.GetPageSize(i);

+ 69 - 65
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -362,13 +362,47 @@ namespace PDF_Master.ViewModels.Tools
         //选中和非选中注释
         private void PDFViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
         {
+            if (e == null)
+            {
+                if (viewContentViewModel.CurrentBar != "TabItemAnnotation")
+                {
+                    //viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                    return;
+                }
+
+                if (!string.IsNullOrWhiteSpace(StrAnnotToolChecked))
+                {
+                    PropertyPanel.annot = null;
+                    PropertyPanel.AnnotEvents = null;
+                    PropertyPanel.AnnotEvent = null;
+                    PropertyPanel.annotlists = null;
+                    if (StrAnnotToolChecked != "Stamp" && StrAnnotToolChecked != "Freetext")
+                    {
+                        AnnotHandlerEventArgs annotArgs = null;
+                        //propertyPanel.SaveLastAnnot();
+                        FindAnnotTypeKey(StrAnnotToolChecked, ref annotArgs);
+
+                        return;
+                    }
+                }
+                else
+                {
+                    PropertyPanel.annot = null;
+                    PropertyPanel.AnnotEvents = null;
+                    PropertyPanel.AnnotEvent = null;
+                    PropertyPanel.annotlists = null;
+                    viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                    return;
+                }
+            }
+
             if (e != null)
-            {
-                if (e.IsMouseRightActive)
-                {
-                    ShowPropertyPanel(false);
-                    return;
-                }
+            {
+                if (e.IsMouseRightActive)
+                {
+                    ShowPropertyPanel(false);
+                    return;
+                }
                 CurrentSelectedAnnot = null;
                 var annot = e.AnnotItemsList[0];
                 if (annot != null)
@@ -525,58 +559,23 @@ namespace PDF_Master.ViewModels.Tools
                     }
                 }
             }
-            else
-            {
-                if (viewContentViewModel.CurrentBar != "TabItemAnnotation")
-                {
-                    //viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
-                    return;
-                }
-
-                if (!string.IsNullOrWhiteSpace(StrAnnotToolChecked))
-                {
-                    PropertyPanel.annot = null;
-                    PropertyPanel.AnnotEvents = null;
-                    PropertyPanel.AnnotEvent = null;
-                    PropertyPanel.annotlists = null;
-                    if (StrAnnotToolChecked != "Stamp" && StrAnnotToolChecked != "Freetext")
-                    {
-                        AnnotHandlerEventArgs annotArgs = null;
-                        //propertyPanel.SaveLastAnnot();
-                        FindAnnotTypeKey(StrAnnotToolChecked, ref annotArgs);
-                        //if (annotArgs != null)
-                        //{
-                        //    //设置点击页面会创建对应选中注释工具的注释
-                        //    annotArgs.Author = Settings.Default.AppProperties.Description.Author;
-                        //    PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
-                        //    PDFViewer.SetToolParam(annotArgs);
-                        //}
-                    }
-                }
-                else
-                {
-                    PropertyPanel.annot = null;
-                    PropertyPanel.AnnotEvents = null;
-                    PropertyPanel.AnnotEvent = null;
-                    PropertyPanel.annotlists = null;
-                    viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
-                }
-
-                //if (StrAnnotToolChecked == "Link")
-                //{
-                //    if (PDFViewer.MouseMode != MouseModes.AnnotCreate)
-                //    {
-                //        if (PDFViewer.MouseMode == MouseModes.PanTool && propertyPanel.IsAddLink == false && propertyPanel.IsLocationLink == false)
-                //        {
-                //            viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
-                //        }
-                //    }
-                //}
-                //if (string.IsNullOrWhiteSpace(StrAnnotToolChecked))
-                //{
-                //    viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
-                //}
-            }
+            //else
+            //{
+            //if (StrAnnotToolChecked == "Link")
+            //{
+            //    if (PDFViewer.MouseMode != MouseModes.AnnotCreate)
+            //    {
+            //        if (PDFViewer.MouseMode == MouseModes.PanTool && propertyPanel.IsAddLink == false && propertyPanel.IsLocationLink == false)
+            //        {
+            //            viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+            //        }
+            //    }
+            //}
+            //if (string.IsNullOrWhiteSpace(StrAnnotToolChecked))
+            //{
+            //    viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+            //}
+            //}
         }
 
         //在注释工具的状态下,右键菜单
@@ -926,6 +925,8 @@ namespace PDF_Master.ViewModels.Tools
 
         private void PDFViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
         {
+            bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
+
             if (e != null && e.Count > 0)
             {
                 MultipleSelectionAnnot(e);
@@ -937,7 +938,11 @@ namespace PDF_Master.ViewModels.Tools
                     switch (editEvent.EditAction)
                     {
                         case ActionType.Add:
-
+                            //if (viewContentViewModel.OpenBOTA == false || isTabItemAnnotation == false || bOTAContent.TabItemAnnotation.IsSelected == false)
+                            //{
+                            //    viewContentViewModel.OpenBOTA = true;
+                            //    bOTAContent.TabItemAnnotation.IsSelected = true;
+                            //}
                             //if (editEvent.EditAnnotArgs is StickyAnnotArgs stickyAnnotArgs)
                             //{
                             //    PDFViewer.SelectAnnotation(stickyAnnotArgs.PageIndex, stickyAnnotArgs.AnnotIndex);
@@ -947,9 +952,8 @@ namespace PDF_Master.ViewModels.Tools
                             //    PDFViewer.SelectAnnotation(freeTextAnnotArgs.PageIndex, freeTextAnnotArgs.AnnotIndex);
                             //}
                             //BOTA
-                            bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
 
-                            if (viewContentViewModel.OpenBOTA == true && isTabItemAnnotation == true)
+                            if (viewContentViewModel.OpenBOTA == true && bOTAContent.TabItemAnnotation.IsSelected)
                             {
                                 AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
 
@@ -975,8 +979,8 @@ namespace PDF_Master.ViewModels.Tools
                             break;
 
                         case ActionType.Del:
-                            isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
-                            if (isTabItemAnnotation)
+                            //isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
+                            if (bOTAContent.TabItemAnnotation.IsSelected)
                             {
                                 AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
 
@@ -990,7 +994,7 @@ namespace PDF_Master.ViewModels.Tools
                             break;
 
                         case ActionType.Modify:
-                            isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
+                            //isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
                             if (bOTAContent.TabItemAnnotation.IsSelected)
                             {
                                 AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
@@ -1049,7 +1053,7 @@ namespace PDF_Master.ViewModels.Tools
                 }
             }
 
-            if (isAdd && selectAnnotDicts.Count > 1)
+            if (isAdd && selectAnnotDicts.Count >= 1)
             {
                 PDFViewer.ClearSelectAnnots();
 

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

@@ -974,6 +974,7 @@ namespace PDF_Master.ViewModels.Tools
                     squareArgs.LineWidth = squareAnnot.LineWidth;
                     squareArgs.Transparency = squareAnnot.Transparency;
                     squareArgs.LineDash = squareAnnot.LineDash;
+                    squareArgs.ClientRect = Rect.Empty;
                 }
 
                 if (squareArgs != null)
@@ -1167,7 +1168,6 @@ namespace PDF_Master.ViewModels.Tools
                     lineArgs.LineWidth = lineAnnot.LineWidth;
                     lineArgs.Transparency = lineAnnot.Transparency;
                     lineArgs.LineDash = lineAnnot.LineDash;
-
                 }
 
                 if (lineArgs != null)

+ 4 - 1
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -38,6 +38,8 @@ using PDF_Master.Views.BOTA;
 using System.Drawing;
 using PDF_Master.ViewModels.Tools.AnnotManager;
 using PDF_Master.Model.FillAndSign;
+using PDF_Master.Views.PropertyPanel.ViewModular;
+using PDF_Master.Views.PropertyPanel;
 
 namespace PDF_Master.ViewModels
 {
@@ -1898,6 +1900,7 @@ namespace PDF_Master.ViewModels
             parameters.Add(ParameterNames.PropertyPanelContentViewModel, annotPropertyPanel);
             parameters.Add(ParameterNames.ViewContentViewModel, this);
             region.RequestNavigate(PropertyRegionName, Content, parameters);
+           
         }
 
         /// <summary>
@@ -2028,7 +2031,7 @@ namespace PDF_Master.ViewModels
         {
             try
             {
-                if (string.IsNullOrEmpty(PDFViewer.Document.FilePath)||mainViewModel.NewFile)
+                if (string.IsNullOrEmpty(PDFViewer.Document.FilePath) || mainViewModel.NewFile)
                     return saveAsFile();
 
                 //文档已被修复时 提示另存为

+ 15 - 7
PDF Office/Views/PageEdit/PageEditContent.xaml

@@ -46,13 +46,14 @@
                                 Background="Transparent">
                                 <Image Source="{Binding Image}" Stretch="Uniform" />
                                 <Border
-                                    Width="10"
-                                    Height="10"
+                                    Width="18"
+                                    Height="20"
                                     Margin="0,10,10,0"
                                     HorizontalAlignment="Right"
                                     VerticalAlignment="Top"
-                                    Background="Yellow"
-                                    Visibility="{Binding HaveBookMark, Converter={StaticResource BoolToVisibleConvert}}" />
+                                    Visibility="{Binding HaveBookMark, Converter={StaticResource BoolToVisibleConvert}}">
+                                    <Path Data="M1.75 17.7778V0H0.25V19C0.25 19.2608 0.385462 19.5028 0.607729 19.6392C0.829997 19.7756 1.10716 19.7868 1.33966 19.6687L9 15.7775L16.6603 19.6687C16.8928 19.7868 17.17 19.7756 17.3923 19.6392C17.6145 19.5028 17.75 19.2608 17.75 19V0H16.25V17.7778L9.33966 14.2676C9.1262 14.1592 8.8738 14.1592 8.66034 14.2676L1.75 17.7778Z" Stroke="{StaticResource color.icon.base.accent}" />
+                                </Border>
                             </Grid>
                         </Border>
 
@@ -155,7 +156,7 @@
         <KeyBinding Command="{Binding CutCommand}" Gesture="Ctrl+X" />
         <KeyBinding Command="{Binding RightRotateCommand}" Gesture="Ctrl+R" />
         <KeyBinding Command="{Binding LeftRotateCommand}" Gesture="Ctrl+L" />
-        <KeyBinding Command="{Binding DeleteCommand}" Gesture="Delete"/>
+        <KeyBinding Command="{Binding DeleteCommand}" Gesture="Delete" />
         <KeyBinding Key="Esc" Command="{Binding ClearSelectedCommand}" />
         <KeyBinding
             Key="Add"
@@ -353,8 +354,15 @@
                 ScrollBar.Scroll="ListPageEdit_Scroll"
                 ScrollViewer.ScrollChanged="ListPageEdit_ScrollChanged"
                 SelectedIndex="{Binding ListSelectedIndex, Mode=TwoWay}"
-                SelectionMode="Extended">
-                <!--  此处要用循环模式,否则滚动时容易误触发EndSscroll 从而频繁拿图导致卡顿  -->
+                SelectionMode="Extended"
+                VirtualizingPanel.CacheLength="1"
+                VirtualizingPanel.CacheLengthUnit="Page"
+                VirtualizingPanel.ScrollUnit="Pixel"
+                VirtualizingPanel.VirtualizationMode="Standard">
+                <!--
+                    此处要用循环模式,否则滚动时容易误触发EndSscroll 从而频繁拿图导致卡顿
+                    VirtualizingPanel.ScrollUnit="Pixel" 设置鼠标每次滚动的步进值
+                -->
                 <ListBox.ItemContainerStyle>
                     <Style TargetType="{x:Type ListBoxItem}">
                         <Setter Property="Template" Value="{StaticResource ListBoxItemControlTemplate}" />

+ 2 - 0
PDF Office/Views/PageEdit/PageEditContent.xaml.cs

@@ -107,6 +107,8 @@ namespace PDF_Master.Views.PageEdit
             {
                 ItemSuitAcutalWidth(this.ActualWidth);
             }
+            //页面总数变化后用于通知BOTA面板进行数据集刷新
+            eventor.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode,NotifyType.PageCountChanged));
         }
 
         public PageEditContent(IEventAggregator eventAggregator) : this()