Przeglądaj źródła

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

zhuyi 1 rok temu
rodzic
commit
644e06b9b8

+ 12 - 0
PDF Office/App.xaml.cs.rej

@@ -0,0 +1,12 @@
+diff a/PDF Office/App.xaml.cs b/PDF Office/App.xaml.cs	(rejected hunks)
+@@ -194,10 +194,6 @@
+                 Settings.Default.UserDate = new PDFSettings.UserDate();
+             }
+ 
+-            if(Settings.Default.AppProperties==null)
+-            {
+-                Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
+-            }
+ 
+             if (Settings.Default.RecentOpenFiles == null)
+             {

+ 2 - 0
PDF Office/PDF Master.csproj

@@ -2265,6 +2265,8 @@
     </Content>
     <Resource Include="Resources\PromotionIcon\black_pdfreaderpro_home_en.png" />
     <Resource Include="Resources\PromotionIcon\Mac.png" />
+    <Resource Include="Resources\Service\IAPBottom.png" />
+    <Resource Include="Resources\Service\IAPTop.png" />
     <Content Include="Resources\Service\Login.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>

+ 6 - 0
PDF Office/PDF Master.csproj.user

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

BIN
PDF Office/Resources/Service/IAPBottom.png


BIN
PDF Office/Resources/Service/IAPTop.png


+ 81 - 42
PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs

@@ -1026,13 +1026,13 @@ namespace PDF_Master.ViewModels.BOTA
                         await Task.Delay(5);//不加延时 每页的第一个注释不会展开
                         ExpandGroupHeader(args, listBox);
                         listBox.SelectedItem = item;
-                        await Task.Delay(5);//不加延时 会有不滚动的现象
+                        //await Task.Delay(5);//不加延时 会有不滚动的现象
                         listBox.ScrollIntoView(item);
-                        if (!listBox.SelectedItems.Contains(args))
-                        {
-                            listBox.SelectedItem = args;
-                            //PdfViewer.SelectAnnotation(args.PageIndex, args.AnnotIndex);
-                        }
+                        //if (!listBox.SelectedItems.Contains(args))
+                        //{
+                        //    listBox.SelectedItem = args;
+                        //    //PdfViewer.SelectAnnotation(args.PageIndex, args.AnnotIndex);
+                        //}
                     }
                 }
             }
@@ -1044,41 +1044,80 @@ namespace PDF_Master.ViewModels.BOTA
             }
         }
 
-        public async void UpdateModifiedAnnot(int pageIndex, int annotIndex, bool isDelete)
+        public void DeleteModifiedAnnot(int pageIndex, int annotIndex)
         {
-            try
+            var items = PdfViewer.GetAnnotCommentList(pageIndex, PdfViewer.Document);
+            //if (items.Count == 0)
+            //{
+            //    for (int k = 0; k < AnnotationListItems.Count; k++)
+            //    {
+            //        if (AnnotationListItems[k].PageIndex == pageIndex && AnnotationListItems[k].AnnotIndex == annotIndex)
+            //        {
+            //            AnnotationListItems.RemoveAt(k);
+            //            AnnotationHandlerEventArgs annotation1 = CurrentAnnotationLists.FirstOrDefault(x => x.PageIndex == AnnotationListItems[k].PageIndex && x.AnnotIndex == AnnotationListItems[k].AnnotIndex);
+            //            CurrentAnnotationLists.Remove(annotation1);
+            //            UpdateAnnotListAfterDelete(pageIndex, annotIndex);
+            //            return;
+            //        }
+            //    }
+            //}
+            //else
+            //{
+            for (int k = 0; k < AnnotationListItems.Count; k++)
             {
-                var items = PdfViewer.GetAnnotCommentList(pageIndex, PdfViewer.Document);
-                if (isDelete && items.Count == 0)//当前页的最后一次删除
+                //不能加item[j].annoteIndex = annotIndex  删除后必匹配不上
+                if (AnnotationListItems[k].PageIndex == pageIndex && AnnotationListItems[k].AnnotIndex == annotIndex)
                 {
-                    for (int k = 0; k < AnnotationListItems.Count; k++)
-                    {
-                        if (AnnotationListItems[k].PageIndex == pageIndex && AnnotationListItems[k].AnnotIndex == annotIndex)
-                        {
-                            AnnotationListItems.RemoveAt(k);
-                            AnnotationHandlerEventArgs annotation1 = CurrentAnnotationLists.FirstOrDefault(x => x.PageIndex == AnnotationListItems[k].PageIndex && x.AnnotIndex == AnnotationListItems[k].AnnotIndex);
-                            CurrentAnnotationLists.Remove(annotation1);
-                            UpdateAnnotListAfterDelete(pageIndex, annotIndex);
-                            return;
-                        }
-                    }
+                    AnnotationHandlerEventArgs annotation1 = CurrentAnnotationLists.FirstOrDefault(x => x.PageIndex == AnnotationListItems[k].PageIndex && x.AnnotIndex == AnnotationListItems[k].AnnotIndex);
+                    CurrentAnnotationLists.Remove(annotation1);
+                    AnnotationListItems.RemoveAt(k);
+                    UpdateAnnotListAfterDelete(pageIndex, annotIndex);
+                    return;
                 }
+            }
+            //}
+        }
 
-                if (isDelete)//删除
-                {
-                    for (int k = 0; k < AnnotationListItems.Count; k++)
-                    {
-                        //不能加item[j].annoteIndex = annotIndex  删除后必匹配不上
-                        if (AnnotationListItems[k].PageIndex == pageIndex && AnnotationListItems[k].AnnotIndex == annotIndex)
-                        {
-                            AnnotationListItems.RemoveAt(k);
-                            AnnotationHandlerEventArgs annotation1 = CurrentAnnotationLists.FirstOrDefault(x => x.PageIndex == AnnotationListItems[k].PageIndex && x.AnnotIndex == AnnotationListItems[k].AnnotIndex);
-                            CurrentAnnotationLists.Remove(annotation1);
-                            UpdateAnnotListAfterDelete(pageIndex, annotIndex);
-                            return;
-                        }
-                    }
-                }
+        public async void UpdateModifiedAnnot(int pageIndex, int annotIndex/*, bool isDelete*/)
+        {
+            try
+            {
+                var items = PdfViewer.GetAnnotCommentList(pageIndex, PdfViewer.Document);
+
+                #region 删除
+
+                //if (isDelete && items.Count == 0)//当前页的最后一次删除
+                //{
+                //    for (int k = 0; k < AnnotationListItems.Count; k++)
+                //    {
+                //        if (AnnotationListItems[k].PageIndex == pageIndex && AnnotationListItems[k].AnnotIndex == annotIndex)
+                //        {
+                //            AnnotationListItems.RemoveAt(k);
+                //            AnnotationHandlerEventArgs annotation1 = CurrentAnnotationLists.FirstOrDefault(x => x.PageIndex == AnnotationListItems[k].PageIndex && x.AnnotIndex == AnnotationListItems[k].AnnotIndex);
+                //            CurrentAnnotationLists.Remove(annotation1);
+                //            UpdateAnnotListAfterDelete(pageIndex, annotIndex);
+                //            return;
+                //        }
+                //    }
+                //}
+
+                //if (isDelete)//删除
+                //{
+                //    for (int k = 0; k < AnnotationListItems.Count; k++)
+                //    {
+                //        //不能加item[j].annoteIndex = annotIndex  删除后必匹配不上
+                //        if (AnnotationListItems[k].PageIndex == pageIndex && AnnotationListItems[k].AnnotIndex == annotIndex)
+                //        {
+                //            AnnotationListItems.RemoveAt(k);
+                //            AnnotationHandlerEventArgs annotation1 = CurrentAnnotationLists.FirstOrDefault(x => x.PageIndex == AnnotationListItems[k].PageIndex && x.AnnotIndex == AnnotationListItems[k].AnnotIndex);
+                //            CurrentAnnotationLists.Remove(annotation1);
+                //            UpdateAnnotListAfterDelete(pageIndex, annotIndex);
+                //            return;
+                //        }
+                //    }
+                //}
+
+                #endregion 删除
 
                 for (int j = 0; j < items.Count; j++)
                 {
@@ -1098,11 +1137,11 @@ namespace PDF_Master.ViewModels.BOTA
                                     break;
                                 }
                             }
-                            if (!listBox.SelectedItems.Contains(AnnotationListItems[k]))
-                            {
-                                listBox.SelectedItem = AnnotationListItems[k];
-                                //PdfViewer.SelectAnnotation(args.PageIndex, args.AnnotIndex);
-                            }
+                            //if (!listBox.SelectedItems.Contains(AnnotationListItems[k]))
+                            //{
+                            //    listBox.SelectedItem = AnnotationListItems[k];
+                            //    //PdfViewer.SelectAnnotation(args.PageIndex, args.AnnotIndex);
+                            //}
 
                             await Task.Delay(5);//不加延时 每页的第一个注释不会展开
                             ExpandGroupHeader(AnnotationListItems[k], listBox);
@@ -1395,7 +1434,7 @@ namespace PDF_Master.ViewModels.BOTA
             return list;
         }
 
-        private AnnotationHandlerEventArgs GetAddAnnotEventArgs(AnnotHandlerEventArgs item)
+        public AnnotationHandlerEventArgs GetAddAnnotEventArgs(AnnotHandlerEventArgs item)
         {
             AnnotationHandlerEventArgs args = new AnnotationHandlerEventArgs();
             if (item.EventType == AnnotArgsType.AnnotFreehand)

+ 88 - 1
PDF Office/ViewModels/Dialog/ServiceDialog/IAPCompareDialogViewModel.cs

@@ -3,6 +3,10 @@ using Prism.Mvvm;
 using Prism.Regions;
 using Prism.Services.Dialogs;
 using System;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
 
 namespace PDF_Master.ViewModels.Dialog.ServiceDialog
 {
@@ -15,7 +19,39 @@ namespace PDF_Master.ViewModels.Dialog.ServiceDialog
 
         public event Action<IDialogResult> RequestClose;
 
+        #region 文案
 
+        private string _Text_Signup = "";
+
+        public string Text_Signup
+        {
+            get { return _Text_Signup; }
+            set
+            {
+                SetProperty(ref _Text_Signup, value);
+            }
+        }
+
+        private string _Text_Login = "";
+
+        public string Text_Login
+        {
+            get { return _Text_Login; }
+            set
+            {
+                SetProperty(ref _Text_Login, value);
+            }
+        }
+        private void InitString()
+        {
+
+            Text_Signup = App.ServiceLoader.GetString("Text_Signup");
+
+            Text_Login = App.ServiceLoader.GetString("Text_Login");
+        }
+
+
+        #endregion
 
         private string _IAPRegionName;
         public string IAPRegionName
@@ -24,6 +60,14 @@ namespace PDF_Master.ViewModels.Dialog.ServiceDialog
             set { _IAPRegionName = value; }
         }
 
+        private List<User> _Items= new List<User>();
+        public List<User> Items
+        {
+            get { return _Items; }
+            set { _Items = value; }
+        }
+
+
         public bool CanCloseDialog()
         {
             return true;
@@ -38,21 +82,64 @@ namespace PDF_Master.ViewModels.Dialog.ServiceDialog
         {
             
         }
+        public enum UseType { CreatePDF, ConvertPDF , AdvancedEditTools, AnnotatePDF, Security};
+
+        public class User
+        {
+          
+            public string Use { get; set; }
+
+            public bool Re { get; set; }
+
+            public bool UnRe { get; set; }
+
+
+    
+            public UseType UseType { get; set; }
+        }
 
         public DelegateCommand GoLoginCommand { get; set; }
         public DelegateCommand GoRegisterCommand { get; set; }
 
 
 
-        IAPCompareDialogViewModel(IRegionManager regionManager, IDialogService dialogService)
+       public IAPCompareDialogViewModel(IRegionManager regionManager, IDialogService dialogService)
         {
            
             IAPRegionName = Guid.NewGuid().ToString();
             GoLoginCommand = new DelegateCommand(GoLogin);
             GoRegisterCommand = new DelegateCommand(GoRegisterd);
+            InitString();
+
+            
+
+            
+
+            Items.Add(new User() { Use = "Create PDF from Microsoft Word, PowerPoint, Excel, Text, and image", UnRe = true, Re=true, UseType = UseType.CreatePDF });
+            Items.Add(new User() { Use = "Create PDF from scanner", UnRe = true, Re = true, UseType = UseType.CreatePDF });
+            Items.Add(new User() { Use = "Convert PDF to Microsoft Word, Excel, PPT, Text, and image", UnRe = false, Re = true, UseType = UseType.ConvertPDF });
+            Items.Add(new User() { Use = "Turn PDF to RTF, HTML, CSV", UnRe = false, Re = true, UseType = UseType.ConvertPDF });
+            Items.Add(new User() { Use = "Save as flatten PDF", UnRe = false, Re = true, UseType = UseType.ConvertPDF });
+            Items.Add(new User() { Use = "Merge multiple PDFs", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools });
+            Items.Add(new User() { Use = "Fill & sign forms", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools });
+            Items.Add(new User() { Use = "Crop pages", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools });
+            Items.Add(new User() { Use = "Rotate, delete, paste, copy pages", UnRe = false, Re = true, UseType = UseType.AdvancedEditTools });
+            Items.Add(new User() { Use = "Basic markup tools", UnRe = true, Re = true, UseType = UseType.AnnotatePDF });
+            Items.Add(new User() { Use = "Hyperlink", UnRe = false, Re = true, UseType = UseType.AnnotatePDF });
+            Items.Add(new User() { Use = "Stamp", UnRe = false, Re = true, UseType = UseType.AnnotatePDF });
+            Items.Add(new User() { Use = "Signature", UnRe = false, Re = true, UseType = UseType.AnnotatePDF });
+            Items.Add(new User() { Use = "Add password and permission", UnRe = false, Re = true, UseType = UseType.Security });
+            Items.Add(new User() { Use = "Remove password", UnRe = false, Re = true, UseType = UseType.Security });
+
+
+            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(Items);
+            PropertyGroupDescription groupDescription = new PropertyGroupDescription("UseType");
+            view.GroupDescriptions.Add(groupDescription);
         }
 
 
+
+
         private void GoRegisterd()
         {
 

+ 42 - 32
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreetextAnnotPropertyViewModel.cs

@@ -312,20 +312,23 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 AnnotAttribDir.Add(AnnotAttrib.FontWeight, FontVm.FontWeightItem);
                 PropertyPanel.UpdateAnnotAllAttribs(AnnotAttribDir);
 
-                var currentItem = FontVm.PresetFontList.FirstOrDefault(temp => temp.mTag == FontVm.CurrentPresetFont.ValueStr);
-                if (currentItem.mTag != "Custom")
+                if (FontVm.CurrentPresetFont != null)
                 {
-                    foreach (var item in Settings.Default.PresetFontList)
+                    var currentItem = FontVm.PresetFontList.FirstOrDefault(temp => temp.mTag == FontVm.CurrentPresetFont.ValueStr);
+                    if (currentItem.mTag != "Custom")
                     {
-                        if (item.mTag == currentItem.mTag)
+                        foreach (var item in Settings.Default.PresetFontList)
                         {
-                            if (FontVm.FontWeightItem != item.mFontWeight || FontVm.FontStyleItem != item.mFontStyle)
+                            if (item.mTag == currentItem.mTag)
                             {
-                                Title = string.Format($"*{currentItem.mTagContent}");
-                            }
-                            else
-                            {
-                                Title = currentItem.mTagContent;
+                                if (FontVm.FontWeightItem != item.mFontWeight || FontVm.FontStyleItem != item.mFontStyle)
+                                {
+                                    Title = string.Format($"*{currentItem.mTagContent}");
+                                }
+                                else
+                                {
+                                    Title = currentItem.mTagContent;
+                                }
                             }
                         }
                     }
@@ -360,21 +363,24 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         //设置字体大小
         private void FontSizeChanged()
         {
-            var currentItem = FontVm.PresetFontList.FirstOrDefault(temp => temp.mTag == FontVm.CurrentPresetFont.ValueStr);
-            //var comboDataItem = FontVm.PresetFontItems.FirstOrDefault(temp => temp.ValueStr == FontVm.CurrentPresetFont.ValueStr);
-            if (currentItem.mTag != "Custom")
+            if (FontVm.CurrentPresetFont != null)
             {
-                foreach (var item in Settings.Default.PresetFontList)
+                var currentItem = FontVm.PresetFontList.FirstOrDefault(temp => temp.mTag == FontVm.CurrentPresetFont.ValueStr);
+                //var comboDataItem = FontVm.PresetFontItems.FirstOrDefault(temp => temp.ValueStr == FontVm.CurrentPresetFont.ValueStr);
+                if (currentItem.mTag != "Custom")
                 {
-                    if (item.mTag == currentItem.mTag)
+                    foreach (var item in Settings.Default.PresetFontList)
                     {
-                        if (FontVm.CurrentFontSize.Value != item.mFontSize)
-                        {
-                            Title = string.Format($"*{currentItem.mTagContent}");
-                        }
-                        else
+                        if (item.mTag == currentItem.mTag)
                         {
-                            Title = currentItem.mTagContent;
+                            if (FontVm.CurrentFontSize.Value != item.mFontSize)
+                            {
+                                Title = string.Format($"*{currentItem.mTagContent}");
+                            }
+                            else
+                            {
+                                Title = currentItem.mTagContent;
+                            }
                         }
                     }
                 }
@@ -391,25 +397,29 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         //设置字体样式
         private void FontFamilyChanged()
         {
-            var currentItem = FontVm.PresetFontList.FirstOrDefault(temp => temp.mTag == FontVm.CurrentPresetFont.ValueStr);
-            //var comboDataItem = FontVm.PresetFontItems.FirstOrDefault(temp => temp.ValueStr == FontVm.CurrentPresetFont.ValueStr);
-            if (currentItem.mTag != "Custom")
+            if (FontVm.CurrentPresetFont != null)
             {
-                foreach (var item in Settings.Default.PresetFontList)
+                var currentItem = FontVm.PresetFontList.FirstOrDefault(temp => temp.mTag == FontVm.CurrentPresetFont.ValueStr);
+                //var comboDataItem = FontVm.PresetFontItems.FirstOrDefault(temp => temp.ValueStr == FontVm.CurrentPresetFont.ValueStr);
+                if (currentItem.mTag != "Custom")
                 {
-                    if (item.mTag == currentItem.mTag)
+                    foreach (var item in Settings.Default.PresetFontList)
                     {
-                        if (FontVm.CurrentFontFamily.ValueStr != item.mFontFamily.Source)
-                        {
-                            Title = string.Format($"*{currentItem.mTagContent}");
-                        }
-                        else
+                        if (item.mTag == currentItem.mTag)
                         {
-                            Title = currentItem.mTagContent;
+                            if (FontVm.CurrentFontFamily.ValueStr != item.mFontFamily.Source)
+                            {
+                                Title = string.Format($"*{currentItem.mTagContent}");
+                            }
+                            else
+                            {
+                                Title = currentItem.mTagContent;
+                            }
                         }
                     }
                 }
             }
+
             if (string.IsNullOrEmpty(FontVm.CurrentFontFamily.ValueStr) == false)
             {
                 PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.FontFamily, new FontFamily(FontVm.CurrentFontFamily.ValueStr));

+ 1 - 1
PDF Office/ViewModels/PropertyPanel/ViewModular/ViewModularContentViewModel.cs

@@ -386,7 +386,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.ViewModular
                             for (int i = 0; i < list.Count(); i++)
                             {
                                 var item = list[i];
-                                viewModel.UpdateModifiedAnnot(item.PageIndex, item.AnnotIndex, false);
+                                viewModel.UpdateModifiedAnnot(item.PageIndex, item.AnnotIndex);
                             }
                         }
                     }

+ 11 - 0
PDF Office/ViewModels/Tools/AnnotManager/AnnotTransfer.cs

@@ -179,6 +179,17 @@ namespace PDF_Master.ViewModels.Tools.AnnotManager
         //单个属性更改
         public void UpdateAnnotAAttrib(AnnotAttrib annotAttrib, object obj)
         {
+            if(obj is Color)
+            {
+                if (AnnotEvents != null)
+                {
+                    foreach (var itemevent in AnnotEvents)
+                    {
+                        itemevent?.UpdateAttrib(annotAttrib, obj);
+                        itemevent?.UpdateAnnot();
+                    }
+                }
+            }
             if (annotlists == null) return;
             if (annotlists != null && annotlists.Count > 1)
             {

+ 124 - 71
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -335,8 +335,7 @@ namespace PDF_Master.ViewModels.Tools
                     viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
                     //GetSignature();
                     //StrAnnotToolChecked = "Signature";
-                }
-                
+                }
             }
         }
 
@@ -374,29 +373,26 @@ namespace PDF_Master.ViewModels.Tools
                     //viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
                     return;
                 }
-
-                if (!string.IsNullOrWhiteSpace(StrAnnotToolChecked))
+                PropertyPanel.annot = null;
+                PropertyPanel.AnnotEvents = null;
+                PropertyPanel.AnnotEvent = null;
+                PropertyPanel.annotlists = null;
+                //PDFViewer.SetMouseMode(MouseModes.PanTool);
+                //HandToolIsCheckedEvent(false);
+                if (string.IsNullOrWhiteSpace(StrAnnotToolChecked))
+                {
+                    viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                }
+                else
                 {
-                    PropertyPanel.annot = null;
-                    PropertyPanel.AnnotEvents = null;
-                    PropertyPanel.AnnotEvent = null;
-                    PropertyPanel.annotlists = null;
                     if (StrAnnotToolChecked != "Stamp" && StrAnnotToolChecked != "Freetext")
                     {
                         AnnotHandlerEventArgs annotArgs = null;
                         //此处不能用这个方法更新创建注释的属性  会导致死循环
-                       // FindAnnotTypeKey(StrAnnotToolChecked, ref annotArgs);
+                        // FindAnnotTypeKey(StrAnnotToolChecked, ref annotArgs);
 
                         return;
                     }
-                }
-                else
-                {
-                    PropertyPanel.annot = null;
-                    PropertyPanel.AnnotEvents = null;
-                    PropertyPanel.AnnotEvent = null;
-                    PropertyPanel.annotlists = null;
-                    viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
                     return;
                 }
             }
@@ -405,7 +401,8 @@ namespace PDF_Master.ViewModels.Tools
             {
                 if (e.IsMouseRightActive)
                 {
-                    ShowPropertyPanel(false);
+                    if (string.IsNullOrEmpty(StrAnnotToolChecked))
+                        ShowPropertyPanel(false);
                     return;
                 }
                 CurrentSelectedAnnot = null;
@@ -441,8 +438,21 @@ namespace PDF_Master.ViewModels.Tools
                         }
                         else
                         {
-                            GetSelectedAnnots(e);
-                            PDFViewer.SetToolParam(annot);
+                            if (!string.IsNullOrEmpty(StrAnnotToolChecked))
+                            {
+                                GetSelectedAnnots(e);
+                                PDFViewer.SetToolParam(annot);
+                            }
+                            else
+                            {
+                                PropertyPanel.annot = null;
+                                PropertyPanel.AnnotEvents = null;
+                                PropertyPanel.AnnotEvent = null;
+                                PropertyPanel.annotlists = null;
+                                PDFViewer.SetMouseMode(MouseModes.PanTool);
+                                HandToolIsCheckedEvent(false);
+                                viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                            }
 
                             //switch (annot.EventType)
                             //{
@@ -944,45 +954,53 @@ namespace PDF_Master.ViewModels.Tools
         private void PDFViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
         {
             bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
-
+            AnnotationContentViewModel viewModel = null;
+            AnnotationContent annotation = null;
+            if (viewContentViewModel.OpenBOTA == true && bOTAContent.TabItemAnnotation.IsSelected)
+            {
+                viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out annotation);
+            }
+            bool isMultiple = false;
+            Dictionary<int, List<int>> selectAnnotDicts = new Dictionary<int, List<int>>();
             if (e != null && e.Count > 0)
             {
-                MultipleSelectionAnnot(e);
-
                 for (int i = 0; i < e.Count; i++)
                 {
                     AnnotEditEvent editEvent = e[i];
+
                     bool isVisible = PDFViewer.CheckAnnotVisible(editEvent.PageIndex, editEvent.AnnotIndex);
+
+                    var annot = editEvent.EditAnnotArgs;
                     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);
-                            //}
-                            //if (editEvent.EditAnnotArgs is FreeTextAnnotArgs freeTextAnnotArgs)
-                            //{
-                            //    PDFViewer.SelectAnnotation(freeTextAnnotArgs.PageIndex, freeTextAnnotArgs.AnnotIndex);
-                            //}
-                            //BOTA
-
-                            if (viewContentViewModel.OpenBOTA == true && bOTAContent.TabItemAnnotation.IsSelected)
+                            if (annot.EventType == AnnotArgsType.AnnotSquare || annot.EventType == AnnotArgsType.AnnotCircle ||
+               annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp || annot.EventType == AnnotArgsType.AnnotFreeText /*|| annot.EventType == AnnotArgsType.AnnotFreehand*/)
                             {
-                                AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
-
-                                if (viewModel != null)
+                                if (selectAnnotDicts.ContainsKey(editEvent.PageIndex) == false)
+                                {
+                                    selectAnnotDicts.Add(editEvent.PageIndex, new List<int>());
+                                    selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
+                                }
+                                else
                                 {
-                                    int pageindex = editEvent.PageIndex;
-                                    int annotindex = editEvent.AnnotIndex;
-                                    viewModel.UpdateAddedAnnot(pageindex, annotindex);
+                                    selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
                                 }
+                                isMultiple = true;
                             }
 
+                            //if (viewContentViewModel.OpenBOTA == true && bOTAContent.TabItemAnnotation.IsSelected)
+                            //{
+                            //    AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
+
+                            if (viewModel != null)
+                            {
+                                int pageindex = editEvent.PageIndex;
+                                int annotindex = editEvent.AnnotIndex;
+                                viewModel.UpdateAddedAnnot(pageindex, annotindex);
+                            }
+                            //}
+
                             //添加书签注释,用于未保存前跟图章手绘注释的区分
                             if (StrAnnotToolChecked == "Signature")
                             {
@@ -996,44 +1014,74 @@ namespace PDF_Master.ViewModels.Tools
 
                             break;
 
-                        case ActionType.Del:
-                            //isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
-                            if (bOTAContent.TabItemAnnotation.IsSelected)
-                            {
-                                AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
+                        case ActionType.Modify:
 
-                                if (viewModel != null)
-                                {
-                                    int pageindex = editEvent.PageIndex;
-                                    int annotindex = editEvent.AnnotIndex;
-                                    viewModel.UpdateModifiedAnnot(pageindex, annotindex, true);
-                                }
+                            //             if (annot.EventType == AnnotArgsType.AnnotSquare || annot.EventType == AnnotArgsType.AnnotCircle ||
+                            //annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp || annot.EventType == AnnotArgsType.AnnotFreeText || annot.EventType == AnnotArgsType.AnnotFreehand)
+                            //             {
+                            //                 if (selectAnnotDicts.ContainsKey(editEvent.PageIndex) == false)
+                            //                 {
+                            //                     selectAnnotDicts.Add(editEvent.PageIndex, new List<int>());
+                            //                     selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
+                            //                 }
+                            //                 else
+                            //                 {
+                            //                     selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
+                            //                 }
+                            //                 isMultiple = true;
+                            //             }
+
+                            if (viewModel != null)
+                            {
+                                int pageindex = editEvent.PageIndex;
+                                int annotindex = editEvent.AnnotIndex;
+                                viewModel.UpdateModifiedAnnot(pageindex, annotindex);
                             }
+                            //}
                             break;
 
-                        case ActionType.Modify:
+                        case ActionType.Del:
                             //isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
-                            if (bOTAContent.TabItemAnnotation.IsSelected)
-                            {
-                                AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
+                            //if (viewContentViewModel.OpenBOTA == true && bOTAContent.TabItemAnnotation.IsSelected)
+                            //{
+                            //    AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
 
-                                if (viewModel != null)
-                                {
-                                    int pageindex = editEvent.PageIndex;
-                                    int annotindex = editEvent.AnnotIndex;
-                                    viewModel.UpdateModifiedAnnot(pageindex, annotindex, false);
-                                }
+                            if (viewModel != null)
+                            {
+                                int pageindex = editEvent.PageIndex;
+                                int annotindex = editEvent.AnnotIndex;
+                                viewModel.DeleteModifiedAnnot(pageindex, annotindex);
                             }
+                            //}
+                            ExitAnnotationTool();
+                            viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
                             break;
 
                         case ActionType.TextEdit:
                             break;
-                          
 
                         default:
                             break;
                     }
                 }
+                if (isMultiple && selectAnnotDicts.Count >= 1)
+                {
+                    PDFViewer.ClearSelectAnnots();
+
+                    if (StrAnnotToolChecked != "Signature")
+                    {
+                        PDFViewer.SelectAnnotation(selectAnnotDicts);
+
+                        //foreach (var item in selectAnnotDicts.Keys)
+                        //{
+                        //    List<int> value = selectAnnotDicts[item];
+                        //    foreach (var item1 in value)
+                        //    {
+                        //    }
+                        //}
+                    }
+                }
+                //MultipleSelectionAnnot(e);
                 //空白处 右键菜单 添加注释   为单次添加,不连续添加
                 if (IsNoSelectMenu)
                 {
@@ -1051,11 +1099,11 @@ namespace PDF_Master.ViewModels.Tools
 
             foreach (var item in e)
             {
-                if (item.EditAction == ActionType.Add /*|| item.EditAction == ActionType.Modify*/)
+                if (item.EditAction == ActionType.Add || item.EditAction == ActionType.Modify)
                 {
                     var annot = item.EditAnnotArgs;
                     if (annot.EventType == AnnotArgsType.AnnotSquare || annot.EventType == AnnotArgsType.AnnotCircle ||
-                        annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp || annot.EventType == AnnotArgsType.AnnotFreeText)
+                        annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp || annot.EventType == AnnotArgsType.AnnotFreeText || annot.EventType == AnnotArgsType.AnnotFreehand)
                     {
                         if (selectAnnotDicts.ContainsKey(item.PageIndex) == false)
                         {
@@ -1077,7 +1125,9 @@ namespace PDF_Master.ViewModels.Tools
                 PDFViewer.ClearSelectAnnots();
 
                 if (StrAnnotToolChecked != "Signature")
+                {
                     PDFViewer.SelectAnnotation(selectAnnotDicts);
+                }
             }
         }
 
@@ -1190,9 +1240,12 @@ namespace PDF_Master.ViewModels.Tools
 
                 foreach (AnnotArgsType argsType in e.Keys)
                 {
-                    if (PropertyPanel.annot.EventType != argsType)
+                    if (PropertyPanel.annot != null)
                     {
-                        PDFViewer.SetMouseMode(MouseModes.PanTool);
+                        if (PropertyPanel.annot.EventType != argsType)
+                        {
+                            PDFViewer.SetMouseMode(MouseModes.PanTool);
+                        }
                     }
                     switch (argsType)
                     {

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

@@ -978,7 +978,10 @@ namespace PDF_Master.ViewModels.Tools
             }
         }
 
-        //更改为当前注释属性默认值
+        /// <summary>
+        /// 更改为当前注释属性默认值
+        /// </summary>
+        /// <param name="obj"></param>
         private void AnnotDefaultValues_Menu(object obj)
         {
             if (obj as CusMenuItem != null)
@@ -1050,6 +1053,17 @@ namespace PDF_Master.ViewModels.Tools
                         }
 
                         SettingHelper.SetAnnotDefaultProperty(FreehandDefault);
+
+                        FreehandAnnotArgs annotArgs = new FreehandAnnotArgs()
+                        {
+                            InkColor = freeHand.InkColor,
+                            Transparency = freeHand.Transparency,
+                            LineWidth = freeHand.LineWidth,
+                            LineDash = freeHand.LineDash
+                        };
+
+                        PDFViewer.SetToolParam(annotArgs);
+                        
                     }
                     else if (annot is FreeTextAnnotArgs)
                     {
@@ -1180,6 +1194,8 @@ namespace PDF_Master.ViewModels.Tools
                     }
 
                     Settings.Default.Save();
+                    PropertyPanel.annot = annot;
+                    PropertyPanel.SaveLastAnnot();
                 }
             }
         }
@@ -1514,7 +1530,7 @@ namespace PDF_Master.ViewModels.Tools
                             AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
                             if (viewModel != null)
                             {
-                                viewModel.UpdateModifiedAnnot(linkAnnotArgs.PageIndex, linkAnnotArgs.AnnotIndex, true);
+                                viewModel.DeleteModifiedAnnot(linkAnnotArgs.PageIndex, linkAnnotArgs.AnnotIndex);
                             }
                         }
                     }

Plik diff jest za duży
+ 323 - 13
PDF Office/Views/Dialog/ServiceDialog/IAPCompareDialog.xaml


+ 7 - 0
PDF Office/Views/Dialog/ServiceDialog/IAPCompareDialog.xaml.cs

@@ -30,6 +30,13 @@ namespace PDF_Master.Views.Dialog.ServiceDialog
             var regionManager = containerProvider.Resolve<IRegionManager>();
             RegionManager.SetRegionManager(this, regionManager);
             RegionManager.UpdateRegions();
+            
+          
         }
+
+
+   
+
+
     }
 }