Browse Source

ComPDFKit.Demo(win) - 修复删除注释回复,回复列表没有刷新的问题; 修正文案

TangJinZhou 7 months ago
parent
commit
6a77d241bc

+ 1 - 0
Demo/Examples/Compdfkit.Controls/Annotation/PDFAnnotationList/PDFAnnotationListUI/AnnotationReplyListControl.xaml

@@ -6,6 +6,7 @@
              xmlns:common="clr-namespace:ComPDFKit.Controls.Common"
              xmlns:local="clr-namespace:ComPDFKit.Controls.PDFControlUI"
              mc:Ignorable="d" 
+             Loaded= "UserControl_Loaded"
              d:DesignHeight="450" d:DesignWidth="800">
     <UserControl.Resources>
         <ResourceDictionary>

+ 13 - 11
Demo/Examples/Compdfkit.Controls/Annotation/PDFAnnotationList/PDFAnnotationListUI/AnnotationReplyListControl.xaml.cs

@@ -1,18 +1,8 @@
 using System;
-using System.Collections.Generic;
 using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
 using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
 
 namespace ComPDFKit.Controls.PDFControlUI
 {
@@ -165,9 +155,21 @@ namespace ComPDFKit.Controls.PDFControlUI
                 if (textBox.DataContext is CPDFAnnotationListUI.ReplyData replyData)
                 {
                     replyData.ReplyAnnotation.SetContent(textBox.Text);
+                    InvokeReplyListChanged();
                 }
             }
         }
+
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            ReplyDeleted -= AnnotationReplyListControl_ReplyDeleted;
+            ReplyDeleted += AnnotationReplyListControl_ReplyDeleted;
+        }
+
+        private void AnnotationReplyListControl_ReplyDeleted(object sender, CPDFAnnotationListUI.ReplyData e)
+        {
+            ReplyListSource.Remove(e);
+        }
     }
 
     public class ShowContentBoxCommand : ICommand
@@ -204,8 +206,8 @@ namespace ComPDFKit.Controls.PDFControlUI
             if (parameter is CPDFAnnotationListUI.ReplyData replyData)
             {
                 replyData.ReplyAnnotation.RemoveAnnot();
-                AnnotationReplyListControl.InvokeReplyListChanged();
                 AnnotationReplyListControl.InvokeReplyDeleted(replyData);
+                AnnotationReplyListControl.InvokeReplyListChanged();
             }
         }
     }

+ 1 - 1
Demo/Examples/Compdfkit.Controls/Strings/Bota.resx

@@ -262,7 +262,7 @@
     <value>Delete all annotations</value>
   </data>
   <data name="Menu_DelAllReply" xml:space="preserve">
-    <value>Delete a replies</value>
+    <value>Delete all replies</value>
   </data>
   <data name="Menu_DelAnnot" xml:space="preserve">
     <value>Delete annotation</value>