Browse Source

其他 - 为事件添加解除引用

sunhaonan 11 months ago
parent
commit
3e1f0e53b9
42 changed files with 162 additions and 23 deletions
  1. 3 0
      Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml.cs
  2. 2 0
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListControl/CPDFAnnotationListControl.xaml.cs
  3. 2 0
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListUI/CPDFAnnoationListUI.xaml.cs
  4. 4 0
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationControl/CPDFAnnotationControl.xaml.cs
  5. 1 0
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFCreateSignatureDialog.xaml.cs
  6. 7 0
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFFreeTextUI.xaml.cs
  7. 4 0
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFFreehandUI.xaml.cs
  8. 3 0
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFMarkupUI.xaml.cs
  9. 1 0
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFNoteUI.xaml.cs
  10. 7 0
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFShapeUI.xaml.cs
  11. 1 0
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFAnnotationBarControl.xaml.cs
  12. 6 0
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFBOTABarControl.xaml.cs
  13. 2 0
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFDigitalSignatureBarControl.xaml.cs
  14. 1 0
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFPageEditBarControl.xaml.cs
  15. 1 0
      Demo/Examples/Compdfkit_Tools/Common/BarControl/FormBarControl.xaml.cs
  16. 1 0
      Demo/Examples/Compdfkit_Tools/Common/BaseControl/PageNumberControl.xaml.cs
  17. 2 1
      Demo/Examples/Compdfkit_Tools/Common/DeviceSerial/DeviceSerialControl.xaml.cs
  18. 6 3
      Demo/Examples/Compdfkit_Tools/Common/PasswordControl/PasswordWindow.xaml.cs
  19. 3 0
      Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFArrow/CPDFArrowControl.xaml.cs
  20. 5 0
      Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFFont/CPDFFontControl.xaml.cs
  21. 1 0
      Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFLineStyle/CPDFLineStyleControl.xaml.cs
  22. 1 0
      Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFOpacity/CPDFOpacityControl.xaml.cs
  23. 1 0
      Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFThickness/CPDFThicknessControl.xaml.cs
  24. 2 1
      Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCertificationDialog.xaml.cs
  25. 3 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/CPDFSignatureListControl/CPDFSignatureListControl.xaml.cs
  26. 1 0
      Demo/Examples/Compdfkit_Tools/DigitalSignature/DigitalSignatureControl/DigitalSignatureControl.xaml.cs
  27. 8 7
      Demo/Examples/Compdfkit_Tools/Edit/ContentEditCOntrol/ContentEditControl.xaml.cs
  28. 5 2
      Demo/Examples/Compdfkit_Tools/Edit/PDFImageEdit/PDFImageEditControl/PDFImageEditControl.xaml.cs
  29. 5 0
      Demo/Examples/Compdfkit_Tools/Form/FormControl/FormControl.xaml.cs
  30. 7 0
      Demo/Examples/Compdfkit_Tools/PDFView/PDFBookmark/PDFBookmarkControl/CPDFBookmarkControl.xaml.cs
  31. 10 4
      Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml.cs
  32. 1 0
      Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDrawModeControl.xaml.cs
  33. 7 3
      Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFViewModeControl.xaml.cs
  34. 6 0
      Demo/Examples/Compdfkit_Tools/PDFView/PDFScaling/PDFScalingControl/CPDFScalingControl.xaml.cs
  35. 5 1
      Demo/Examples/Compdfkit_Tools/PDFView/PDFSearch/PDFSearchControl/CPDFSearchControl.xaml.cs
  36. 3 0
      Demo/Examples/Compdfkit_Tools/PDFView/PDFThumbnail/PDFThumbnailControl/CPdfThumbnailControl.xaml.cs
  37. 13 1
      Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml.cs
  38. 2 0
      Demo/Examples/Compdfkit_Tools/PageEdit/PDFPageEdit/CPDFPageEditControl.xaml.cs
  39. 7 0
      Demo/Examples/Compdfkit_Tools/PageEdit/PDFPageExtract/CPDFPageExtractWindow.xaml.cs
  40. 2 0
      Demo/Examples/Compdfkit_Tools/PageEdit/PDFPageInsert/CPDFPageInsertUI.xaml.cs
  41. 9 0
      Demo/Examples/Compdfkit_Tools/PageEdit/PDFPageInsert/CPDFPageInsertWindow.xaml.cs
  42. 1 0
      Demo/Examples/PDFViewer/MainPage.xaml.cs

+ 3 - 0
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml.cs

@@ -162,6 +162,9 @@ namespace Compdfkit_Tools.PDFControl
 
         private void AnnotationBarControl_Loaded(object sender, RoutedEventArgs e)
         {
+            AnnotationBarControl.AnnotationPropertyChanged -= AnnotationBarControl_AnnotationPropertyChanged;
+            AnnotationBarControl.AnnotationCancel -= AnnotationBarControl_AnnotationCancel;
+
             AnnotationBarControl.AnnotationPropertyChanged += AnnotationBarControl_AnnotationPropertyChanged;
             AnnotationBarControl.AnnotationCancel += AnnotationBarControl_AnnotationCancel;
         }

+ 2 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListControl/CPDFAnnotationListControl.xaml.cs

@@ -56,6 +56,7 @@ namespace Compdfkit_Tools.PDFControl
         public void InitWithPDFViewer(PDFViewControl newPDFView)
         {
             pdfViewer = newPDFView;
+            pdfViewer.PDFToolManager.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
             pdfViewer.PDFToolManager.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
         }
 
@@ -147,6 +148,7 @@ namespace Compdfkit_Tools.PDFControl
 
         private void AnnotationList_Loaded(object sender, RoutedEventArgs e)
         {
+            AnnotationList.AnnotationSelectionChanged -= AnnotationList_AnnotationSelectionChanged;
             AnnotationList.AnnotationSelectionChanged += AnnotationList_AnnotationSelectionChanged;
         }
 

+ 2 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListUI/CPDFAnnoationListUI.xaml.cs

@@ -83,10 +83,12 @@ namespace Compdfkit_Tools.PDFControlUI
             popContextMenu = new ContextMenu();
             MenuItem deleteMenu = new MenuItem();
             deleteMenu.Header = "Delete";
+            deleteMenu.Click -= DeleteMenu_Click;
             deleteMenu.Click += DeleteMenu_Click;
             popContextMenu.Items.Add(deleteMenu);
             MenuItem deleteAllMenu = new MenuItem();
             deleteAllMenu.Header = "Delete All";
+            deleteAllMenu.Click -= DeleteAllMenu_Click;
             deleteAllMenu.Click += DeleteAllMenu_Click;
             popContextMenu.Items.Add(deleteAllMenu);
         }

+ 4 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationControl/CPDFAnnotationControl.xaml.cs

@@ -844,6 +844,8 @@ namespace Compdfkit_Tools.PDFControl
                     if (pdfFreehandUI == null)
                     {
                         pdfFreehandUI = new CPDFFreehandUI();
+                        pdfFreehandUI.EraseClickHandler -= PdfFreehandUI_EraseClickHandler;
+                        pdfFreehandUI.EraseChangeHandler -= PdfFreehandUI_EraseChangeHandler;
                         pdfFreehandUI.EraseClickHandler += PdfFreehandUI_EraseClickHandler;
                         pdfFreehandUI.EraseChangeHandler += PdfFreehandUI_EraseChangeHandler;
                     }
@@ -1144,6 +1146,8 @@ namespace Compdfkit_Tools.PDFControl
                                                                baseAnnot.GetAnnotData().PageIndex,
                                                                baseAnnot.GetAnnotData().Annot);
                         tempFreehandPanel.SetPresentAnnotAttrib(annotParam, baseAnnot.GetAnnotData().Annot, pdfViewerControl.PDFToolManager.GetDocument(), pdfViewerControl);
+                        tempFreehandPanel.EraseClickHandler -= PdfFreehandUI_EraseClickHandler;
+                        tempFreehandPanel.EraseChangeHandler -= PdfFreehandUI_EraseChangeHandler;
                         tempFreehandPanel.EraseClickHandler += PdfFreehandUI_EraseClickHandler;
                         tempFreehandPanel.EraseChangeHandler += PdfFreehandUI_EraseChangeHandler;
                         tempAnnotationPanel = tempFreehandPanel;

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFCreateSignatureDialog.xaml.cs

@@ -487,6 +487,7 @@ namespace Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI
 
         private void DrawinkCanvas_Loaded(object sender, RoutedEventArgs e)
         {
+            DrawinkCanvas.Strokes.StrokesChanged -= Strokes_StrokesChanged;
             DrawinkCanvas.Strokes.StrokesChanged += Strokes_StrokesChanged;
         }
 

+ 7 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFFreeTextUI.xaml.cs

@@ -22,6 +22,13 @@ namespace Compdfkit_Tools.PDFControlUI
         public CPDFFreeTextUI()
         {
             InitializeComponent();
+            ColorPickerControl.ColorChanged -= ColorPickerControl_ColorChanged;
+            CPDFOpacityControl.OpacityChanged -= CPDFOpacityControl_OpacityChanged;
+            CPDFFontControl.FontFamilyChanged -= CPDFFontControl_FontFamilyChanged;
+            CPDFFontControl.FontStyleChanged -= CPDFFontControl_FontStyleChanged;
+            CPDFFontControl.FontAlignChanged -= CPDFFontControl_FontAlignChanged;
+            CPDFFontControl.FontSizeChanged -= CPDFFontControl_FontSizeChanged;
+
             ColorPickerControl.ColorChanged += ColorPickerControl_ColorChanged;
             CPDFOpacityControl.OpacityChanged += CPDFOpacityControl_OpacityChanged;
             CPDFFontControl.FontFamilyChanged += CPDFFontControl_FontFamilyChanged;

+ 4 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFFreehandUI.xaml.cs

@@ -25,10 +25,14 @@ namespace Compdfkit_Tools.PDFControlUI
         public CPDFFreehandUI()
         {
             InitializeComponent();
+            ColorPickerControl.ColorChanged -= ColorPickerControl_ColorChanged;
+            CPDFOpacityControl.OpacityChanged -= CPDFOpacityControl_OpacityChanged;
+            CPDFThicknessControl.ThicknessChanged -= CPDFThicknessControl_ThicknessChanged;
             ColorPickerControl.ColorChanged += ColorPickerControl_ColorChanged;
             CPDFOpacityControl.OpacityChanged += CPDFOpacityControl_OpacityChanged;
             CPDFThicknessControl.ThicknessChanged += CPDFThicknessControl_ThicknessChanged;
             CPDFAnnotationPreviewerControl.DrawFreehandPreview(GetFreehandData());
+            EraseThickness.ThicknessChanged -= EraseThickness_ThicknessChanged;
             EraseThickness.ThicknessChanged += EraseThickness_ThicknessChanged;
         }
 

+ 3 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFMarkupUI.xaml.cs

@@ -21,6 +21,9 @@ namespace Compdfkit_Tools.PDFControlUI
         public CPDFMarkupUI()
         {
             InitializeComponent();
+            ColorPickerControl.ColorChanged -= ColorPickerControl_ColorChanged;
+            CPDFOpacityControl.OpacityChanged -= CPDFOpacityControl_OpacityChanged;
+
             ColorPickerControl.ColorChanged += ColorPickerControl_ColorChanged;
             CPDFOpacityControl.OpacityChanged += CPDFOpacityControl_OpacityChanged;
         }

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFNoteUI.xaml.cs

@@ -20,6 +20,7 @@ namespace Compdfkit_Tools.PDFControlUI
         public CPDFNoteUI()
         {
             InitializeComponent();
+            ColorPickerControl.ColorChanged -= ColorPickerControl_ColorChanged;
             ColorPickerControl.ColorChanged += ColorPickerControl_ColorChanged;
             CPDFAnnotationPreviewerControl.DrawNotePreview(GetNoteData());
         }

+ 7 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFShapeUI.xaml.cs

@@ -26,6 +26,11 @@ namespace Compdfkit_Tools.PDFControlUI
         public CPDFShapeUI()
         {
             InitializeComponent();
+            BorderColorPickerControl.ColorChanged -= BorderColorPickerControl_ColorChanged;
+            CPDFOpacityControl.OpacityChanged -= CPDFOpacityControl_OpacityChanged;
+            CPDFThicknessControl.ThicknessChanged -= CPDFThicknessControl_ThicknessChanged;
+            CPDFLineStyleControl.LineStyleChanged -= CPDFLineStyleControl_LineStyleChanged;
+
             BorderColorPickerControl.ColorChanged += BorderColorPickerControl_ColorChanged;
             CPDFOpacityControl.OpacityChanged += CPDFOpacityControl_OpacityChanged;
             CPDFThicknessControl.ThicknessChanged += CPDFThicknessControl_ThicknessChanged;
@@ -485,6 +490,7 @@ namespace Compdfkit_Tools.PDFControlUI
             FillColorStackPanel.Visibility = Visibility.Visible;
             ArrowStackPanel.Visibility = Visibility.Collapsed;
 
+            FillColorPickerControl.ColorChanged -= FillColorPickerControl_ColorChanged;
             FillColorPickerControl.ColorChanged += FillColorPickerControl_ColorChanged;
             CPDFArrowControl.ArrowChanged -= CPDFArrowControl_ArrowChanged;
         }
@@ -494,6 +500,7 @@ namespace Compdfkit_Tools.PDFControlUI
             FillColorStackPanel.Visibility = Visibility.Collapsed;
             ArrowStackPanel.Visibility = Visibility.Visible;
 
+            CPDFArrowControl.ArrowChanged -= CPDFArrowControl_ArrowChanged;
             CPDFArrowControl.ArrowChanged += CPDFArrowControl_ArrowChanged;
             FillColorPickerControl.ColorChanged -= FillColorPickerControl_ColorChanged;
             LineType lineType;

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFAnnotationBarControl.xaml.cs

@@ -292,6 +292,7 @@ namespace Compdfkit_Tools.PDFControl
                 canvas.HorizontalAlignment = HorizontalAlignment.Center;
                 canvas.VerticalAlignment = VerticalAlignment.Center;
                 toggleButton.Content = canvas;
+                toggleButton.Click -= ToggleButton_Click;
                 toggleButton.Click += ToggleButton_Click;
                 toggleButton.ToolTip = toggleButton.Tag.ToString();
                 Grid.SetColumn(toggleButton, annotationCounter++);

+ 6 - 0
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFBOTABarControl.xaml.cs

@@ -107,6 +107,7 @@ namespace Compdfkit_Tools.PDFControl
                   
                     BOTABarTitleGrid.Children.Add(thumbnailButton);
 
+                    thumbnailButton.Click -= ThumbnailButton_Click;
                     thumbnailButton.Click += ThumbnailButton_Click;
 
                     botaTools -= BOTATools.Thumbnail;
@@ -133,6 +134,7 @@ namespace Compdfkit_Tools.PDFControl
                     outlineButton.Content = path;
                     BOTABarTitleGrid.Children.Add(outlineButton);
 
+                    outlineButton.Click -= OutlineButton_Click;
                     outlineButton.Click += OutlineButton_Click; 
                     outlineButton.ToolTip = botaTools.ToString();
 
@@ -160,6 +162,7 @@ namespace Compdfkit_Tools.PDFControl
                  
                     BOTABarTitleGrid.Children.Add(bookmarkButton);
 
+                    bookmarkButton.Click -= BookmarkButton_Click;
                     bookmarkButton.Click += BookmarkButton_Click;
 
                     botaTools -= BOTATools.Bookmark;
@@ -186,6 +189,7 @@ namespace Compdfkit_Tools.PDFControl
              
                     BOTABarTitleGrid.Children.Add(annotButton);
 
+                    annotButton.Click -= AnnotButton_Click;
                     annotButton.Click += AnnotButton_Click;
 
                     botaTools -= BOTATools.Annotation;
@@ -212,6 +216,7 @@ namespace Compdfkit_Tools.PDFControl
                
                     BOTABarTitleGrid.Children.Add(searchButton);
 
+                    searchButton.Click -= SearchButton_Click;
                     searchButton.Click += SearchButton_Click;
 
                     botaTools -= BOTATools.Search;
@@ -237,6 +242,7 @@ namespace Compdfkit_Tools.PDFControl
     
                         BOTABarTitleGrid.Children.Add(signatureButton);
     
+                        signatureButton.Click -= SignatureButton_Click;
                         signatureButton.Click += SignatureButton_Click;
     
                         botaTools -= BOTATools.Signature;

+ 2 - 0
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFDigitalSignatureBarControl.xaml.cs

@@ -130,10 +130,12 @@ namespace Compdfkit_Tools.Common
             button.Content = stackPanel;
             if (name == "Add a Signature Field")
             {
+                button.Click -= AddDigitalSignatureBtn_Click;
                 button.Click += AddDigitalSignatureBtn_Click;
             }
             else if (name == "Verify the Signature")
             {
+                button.Click -= VerifySignatureBtn_Click;
                 button.Click += VerifySignatureBtn_Click;
             }
             DigitalSignBarGrid.ColumnDefinitions.Add(new ColumnDefinition());

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFPageEditBarControl.xaml.cs

@@ -95,6 +95,7 @@ namespace Compdfkit_Tools.PDFControl
             button.ToolTip = name;
             button.Style = style;
             button.Content = stackPanel;
+            button.Click -= PageEditBtn_Click;
             button.Click += PageEditBtn_Click;
             FormGrid.Children.Add(button);
         }

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Common/BarControl/FormBarControl.xaml.cs

@@ -114,6 +114,7 @@ namespace Compdfkit_Tools.PDFControl
             button.ToolTip = name;
             button.Style = style;
             button.Content = stackPanel;
+            button.Click -= FormBtn_Click;
             button.Click += FormBtn_Click;
             FormGrid.Children.Add(button);
         }

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Common/BaseControl/PageNumberControl.xaml.cs

@@ -29,6 +29,7 @@ namespace Compdfkit_Tools.Common
                 pdfView = newPDFView;
                 if (pdfView != null)
                 {
+                    pdfView.PDFViewTool.DrawChanged -= PdfView_InfoChanged;
                     pdfView.PDFViewTool.DrawChanged += PdfView_InfoChanged;
                 }
             }

+ 2 - 1
Demo/Examples/Compdfkit_Tools/Common/DeviceSerial/DeviceSerialControl.xaml.cs

@@ -38,7 +38,8 @@ namespace Compdfkit_Tools.PDFControl
 					Clipboard.SetText(BoardText.Text);
 					CopyTips.Visibility = Visibility.Visible;
 					DispatcherTimer dispatcherTimer = new DispatcherTimer();
-					dispatcherTimer.Tick += this.StartTimer_Tick;
+                    dispatcherTimer.Tick -= this.StartTimer_Tick;
+                    dispatcherTimer.Tick += this.StartTimer_Tick;
 					dispatcherTimer.IsEnabled = false;
 					dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1);
 					dispatcherTimer.Start();

+ 6 - 3
Demo/Examples/Compdfkit_Tools/Common/PasswordControl/PasswordWindow.xaml.cs

@@ -21,14 +21,17 @@ namespace Compdfkit_Tools.Common
 
         private void PasswordDialog_Loaded(object sender, RoutedEventArgs e)
         {
-            PasswordDialog.Canceled += PasswordDialog_Canceled;
-            PasswordDialog.Confirmed += PasswordDialog_Confirmed;
-            PasswordDialog.Closed += PasswordDialog_Closed;
         }
 
         public void InitDocument(CPDFDocument pdfDoc)
         {
             this.pdfDoc = pdfDoc;
+            PasswordDialog.Canceled -= PasswordDialog_Canceled;
+            PasswordDialog.Confirmed -= PasswordDialog_Confirmed;
+            PasswordDialog.Closed -= PasswordDialog_Closed;
+            PasswordDialog.Canceled += PasswordDialog_Canceled;
+            PasswordDialog.Confirmed += PasswordDialog_Confirmed;
+            PasswordDialog.Closed += PasswordDialog_Closed;
         }
 
         private void PasswordDialog_Unloaded(object sender, RoutedEventArgs e)

+ 3 - 0
Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFArrow/CPDFArrowControl.xaml.cs

@@ -31,6 +31,9 @@ namespace Compdfkit_Tools.Common
         public CPDFArrowControl()
         {
             InitializeComponent();
+            CPDFHeadArrowUI.ArrowChanged -= CPDFHeadArrowUI_ArrowChanged;
+            CPDFTailArrowUI.ArrowChanged -= CPDFTailArrowUI_ArrowChanged;
+
             CPDFHeadArrowUI.ArrowChanged += CPDFHeadArrowUI_ArrowChanged;
             CPDFTailArrowUI.ArrowChanged += CPDFTailArrowUI_ArrowChanged;
             Loaded += CPDFArrowControl_Loaded;

+ 5 - 0
Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFFont/CPDFFontControl.xaml.cs

@@ -47,6 +47,11 @@ namespace Compdfkit_Tools.Common
         public CPDFFontControl()
         {
             InitializeComponent();
+            CPDFFontUI.FontFamilyChanged -= CPDFFontUI_FontFamilyChanged;
+            CPDFFontUI.FontStyleChanged -= CPDFFontUI_FontStyleChanged;
+            CPDFFontUI.FontSizeChanged -= CPDFFontUI_FontSizeChanged;
+            CPDFFontUI.FontAlignChanged -= CPDFFontUI_FontAlignChanged;
+
             CPDFFontUI.FontFamilyChanged += CPDFFontUI_FontFamilyChanged;
             CPDFFontUI.FontStyleChanged += CPDFFontUI_FontStyleChanged;
             CPDFFontUI.FontSizeChanged += CPDFFontUI_FontSizeChanged;

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFLineStyle/CPDFLineStyleControl.xaml.cs

@@ -40,6 +40,7 @@ namespace Compdfkit_Tools.Common
         public CPDFLineStyleControl()
         {
             InitializeComponent();
+            CPDFLineStyleUI.LineStyleChanged -= CPDFLineStyleUI_LineStyleChanged;
             CPDFLineStyleUI.LineStyleChanged += CPDFLineStyleUI_LineStyleChanged;
         }
 

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFOpacity/CPDFOpacityControl.xaml.cs

@@ -16,6 +16,7 @@ namespace Compdfkit_Tools.Common
         public CPDFOpacityControl()
         {
             InitializeComponent();
+            CPDFOpacityUI.OpacityChanged -= CPDFOpacityUI_OpacityChanged;
             CPDFOpacityUI.OpacityChanged += CPDFOpacityUI_OpacityChanged;
         }
 

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Common/PropertyControl/PDFThickness/CPDFThicknessControl.xaml.cs

@@ -18,6 +18,7 @@ namespace Compdfkit_Tools.Common
         public CPDFThicknessControl()
         {
             InitializeComponent();
+            CPDFThicknessUI.ThicknessChanged -= CPDFThicknessUI_ThicknessChanged;
             CPDFThicknessUI.ThicknessChanged += CPDFThicknessUI_ThicknessChanged;
         }
 

+ 2 - 1
Demo/Examples/Compdfkit_Tools/DigitalSignature/AddCertificationControl/AddCertificationDialog.xaml.cs

@@ -57,7 +57,8 @@ namespace Compdfkit_Tools.PDFControl
                 Title = addExistedCertificationControlTitle;
                 this.Height = addExistedCertificationControl.Height + 35;
                 this.Width = addExistedCertificationControl.Width + 20;
-                 
+
+                addExistedCertificationControl.CancelEvent -= CancelEvent;
                 addExistedCertificationControl.CancelEvent += CancelEvent;
                 addExistedCertificationControl.FillSignatureEvent -= FillSignature;
                 addExistedCertificationControl.FillSignatureEvent += FillSignature;

+ 3 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/CPDFSignatureListControl/CPDFSignatureListControl.xaml.cs

@@ -40,16 +40,19 @@ namespace Compdfkit_Tools.DigitalSignature.CPDFSignatureListControl
             popContextMenu = new ContextMenu();
             MenuItem viewSignatureDetailsMenu = new MenuItem();
             viewSignatureDetailsMenu.Header = "Signature Details";
+            viewSignatureDetailsMenu.Click -= ViewSignatureDetailsMenu_Click;
             viewSignatureDetailsMenu.Click += ViewSignatureDetailsMenu_Click;
             popContextMenu.Items.Add(viewSignatureDetailsMenu);
             
             MenuItem viewCertificateDetailsMenu = new MenuItem();
             viewCertificateDetailsMenu.Header = "Certificate Details";
+            viewCertificateDetailsMenu.Click -= ViewCertificateDetailsMenu_Click;
             viewCertificateDetailsMenu.Click += ViewCertificateDetailsMenu_Click;
             popContextMenu.Items.Add(viewCertificateDetailsMenu);
             
             MenuItem deleteMenu = new MenuItem();
             deleteMenu.Header = "Delete";
+            deleteMenu.Click -= DeleteMenu_Click;
             deleteMenu.Click += DeleteMenu_Click;
             popContextMenu.Items.Add(deleteMenu);
         }

+ 1 - 0
Demo/Examples/Compdfkit_Tools/DigitalSignature/DigitalSignatureControl/DigitalSignatureControl.xaml.cs

@@ -345,6 +345,7 @@ namespace Compdfkit_Tools.PDFControl
                 //Document = PDFViewControl.PDFView.Document,
                 Owner = Window.GetWindow(this)
             };
+            fillDigitalSignatureDialog.AfterFillSignature -= FillDigitalSignatureDialog_AfterFillSignature; ;
             fillDigitalSignatureDialog.AfterFillSignature += FillDigitalSignatureDialog_AfterFillSignature; ;
             fillDigitalSignatureDialog.ShowDialog();
         }

+ 8 - 7
Demo/Examples/Compdfkit_Tools/Edit/ContentEditCOntrol/ContentEditControl.xaml.cs

@@ -118,6 +118,7 @@ namespace Compdfkit_Tools.PDFControl
         public ContentEditControl()
         {
             InitializeComponent();
+            panelState.PropertyChanged -= PanelState_PropertyChanged;
             panelState.PropertyChanged += PanelState_PropertyChanged;
         }
         
@@ -356,13 +357,11 @@ namespace Compdfkit_Tools.PDFControl
         {
             PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
             PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged += UndoManager_PropertyChanged;
-            PdfViewControl.PDFToolManager.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
-            PdfViewControl.PDFToolManager.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
-            PdfViewControl.PDFToolManager.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
-            PdfViewControl.PDFToolManager.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
+            PdfViewControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
+            PdfViewControl.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
+            PdfViewControl.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
+            PdfViewControl.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
             PdfViewControl = view;
-            PdfViewControl.SplitPDFViewToolCreated -= PdfViewControl_SplitPDFViewToolCreated;
-            PdfViewControl.SplitPDFViewToolCreated += PdfViewControl_SplitPDFViewToolCreated;
             PDFGrid.Child = PdfViewControl;
             FloatPageTool.InitWithPDFViewer(view);
             pdfContentEditControl.InitWithPDFViewer(view);
@@ -373,7 +372,7 @@ namespace Compdfkit_Tools.PDFControl
         {
             if (e.IsCreate)
             {
-                PdfViewControl.PDFViewTool.GetCPDFViewer().SetIsShowStampMouse(false);
+                PdfViewControl.SetIsShowStampMouse(false);
             }
         }
 
@@ -423,6 +422,7 @@ namespace Compdfkit_Tools.PDFControl
                     UIElement pageView = sender as UIElement;
                     if (pageView != null)
                     {
+                        pageView.MouseLeftButtonUp -= PageView_MouseLeftButtonUp;
                         pageView.MouseLeftButtonUp += PageView_MouseLeftButtonUp;
                     }
                     PDFEditParam pDFEditParam = ParamConverter.CPDFDataConverterToPDFEitParam(PdfViewControl.PDFToolManager.GetDocument(), editAreaArea, PageIndex);
@@ -479,6 +479,7 @@ namespace Compdfkit_Tools.PDFControl
                 UIElement pageView = sender as UIElement;
                 if (pageView != null)
                 {
+                    pageView.MouseLeftButtonUp -= PageView_MouseLeftButtonUp;
                     pageView.MouseLeftButtonUp += PageView_MouseLeftButtonUp;
                 }
                 pdfContentEditControl.SetPDFImageEditData((ImageEditParam)e);

+ 5 - 2
Demo/Examples/Compdfkit_Tools/Edit/PDFImageEdit/PDFImageEditControl/PDFImageEditControl.xaml.cs

@@ -41,6 +41,10 @@ namespace Compdfkit_Tools.Edit
         public void InitWithPDFViewer(CPDFViewerTool newPDFView)
         {
             ToolView = newPDFView;
+            RotateUI.RotationChanged -= RotateUI_RotationChanged;
+            FlipUI.FlipChanged -= FlipUI_FlipChanged; 
+            RotateUI.RotationChanged += RotateUI_RotationChanged;
+            FlipUI.FlipChanged += FlipUI_FlipChanged;
         }
 
         public void SetPDFImageEditData(ImageEditParam newEvent)
@@ -63,8 +67,7 @@ namespace Compdfkit_Tools.Edit
 
         private void PDFImageEditControl_Loaded(object sender, RoutedEventArgs e)
         {
-            RotateUI.RotationChanged += RotateUI_RotationChanged;
-            FlipUI.FlipChanged += FlipUI_FlipChanged;
+      
         }
 
         private void FlipUI_FlipChanged(object sender, bool e)

+ 5 - 0
Demo/Examples/Compdfkit_Tools/Form/FormControl/FormControl.xaml.cs

@@ -283,6 +283,11 @@ namespace Compdfkit_Tools.PDFControl
         public void InitWithPDFViewer(PDFViewControl pDFViewControl)
         {
             PdfViewControl = pDFViewControl;
+
+            PdfViewControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
+            PdfViewControl.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
+            PdfViewControl.MouseMoveHandler -= PDFToolManager_MouseMoveHandler;
+
             PdfViewControl.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
             PdfViewControl.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
             PdfViewControl.MouseMoveHandler += PDFToolManager_MouseMoveHandler;

+ 7 - 0
Demo/Examples/Compdfkit_Tools/PDFView/PDFBookmark/PDFBookmarkControl/CPDFBookmarkControl.xaml.cs

@@ -25,6 +25,13 @@ namespace Compdfkit_Tools.PDFControl
 
         private void CPDFBookmarkControl_Loaded(object sender, RoutedEventArgs e)
         {
+            BookmarkAddUI.BookmarkAddEvent -= BookmarkAddUI_BookmarkAddEvent;
+            BookmarkAddUI.BookmarkInputExpandEvent -= BookmarkAddUI_BookmarkInputExpandEvent;
+            BookmarkResultUI.SelectionChanged -= BookmarkResultUI_SelectionChanged;
+            BookmarkResultUI.BookmarkDelete -= BookmarkResultUI_BookmarkDelete;
+            BookmarkResultUI.BookmarkClicked -= BookmarkResultUI_BookmarkClicked;
+            BookmarkResultUI.BookmarkEdit -= BookmarkResultUI_BookmarkEdit;
+
             BookmarkAddUI.BookmarkAddEvent += BookmarkAddUI_BookmarkAddEvent;
             BookmarkAddUI.BookmarkInputExpandEvent += BookmarkAddUI_BookmarkInputExpandEvent;
             BookmarkResultUI.SelectionChanged += BookmarkResultUI_SelectionChanged;

+ 10 - 4
Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml.cs

@@ -22,10 +22,7 @@ namespace Compdfkit_Tools.PDFControl
 
         private void CPDFDisplaySettingsControl_Loaded(object sender, RoutedEventArgs e)
         {
-            ViewModeUI.ViewModeChanged += ViewModeUI_ViewModeChanged;
-            ViewModeUI.SplitModeChanged += ViewModeUI_SplitModeChanged;
-            ViewModeUI.CropModeChanged += ViewModeUI_CropModeChanged;
-            DrawModeUI.DrawModeChanged += DrawModeUI_DrawModeChanged;
+            
         }
 
         private void ViewModeUI_SplitModeChanged(object sender, CPDFViewModeUI.SplitMode e)
@@ -79,6 +76,15 @@ namespace Compdfkit_Tools.PDFControl
                     //ViewModeUI.SetCropUI(ViewControl.IsCropMode());
                 }
             }
+            ViewModeUI.ViewModeChanged -= ViewModeUI_ViewModeChanged;
+            ViewModeUI.SplitModeChanged -= ViewModeUI_SplitModeChanged;
+            ViewModeUI.CropModeChanged -= ViewModeUI_CropModeChanged;
+            DrawModeUI.DrawModeChanged -= DrawModeUI_DrawModeChanged;
+
+            ViewModeUI.ViewModeChanged += ViewModeUI_ViewModeChanged;
+            ViewModeUI.SplitModeChanged += ViewModeUI_SplitModeChanged;
+            ViewModeUI.CropModeChanged += ViewModeUI_CropModeChanged;
+            DrawModeUI.DrawModeChanged += DrawModeUI_DrawModeChanged;
         }
 
         private void PDFViewControl_SelectedPDFViewToolChanged(object sender,EventArgs e)

+ 1 - 0
Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDrawModeControl.xaml.cs

@@ -25,6 +25,7 @@ namespace Compdfkit_Tools.PDFControl
             GetDrawMode.Add("Dark", DrawModes.Dark);
             GetDrawMode.Add("Green", DrawModes.Green);
             GetDrawMode.Add("Custom", DrawModes.Custom);
+            CPDFDrawModeUI.SetDrawModeEvent -= CPDFDrawModeUI_SetDrawModeEvent;
             CPDFDrawModeUI.SetDrawModeEvent += CPDFDrawModeUI_SetDrawModeEvent;
         }
 

+ 7 - 3
Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFViewModeControl.xaml.cs

@@ -27,6 +27,13 @@ namespace Compdfkit_Tools.PDFControl
         public void InitWithPDFViewer(PDFViewControl viewControl)
         {
             this.ViewControl = viewControl;
+            CPDFViewModeUI.SetContinuousEvent -= CPDFViewModeUI_SetContinuousEvent;
+            CPDFViewModeUI.SetViewModeEvent -= CPDFViewModeUI_SetViewModeEvent;
+            CPDFViewModeUI.SplitModeChanged -= CPDFViewModeUI_SplitModeChanged;
+
+            CPDFViewModeUI.SetContinuousEvent += CPDFViewModeUI_SetContinuousEvent;
+            CPDFViewModeUI.SetViewModeEvent += CPDFViewModeUI_SetViewModeEvent;
+            CPDFViewModeUI.SplitModeChanged += CPDFViewModeUI_SplitModeChanged;
         }
 
         private void CPDFViewModeUI_Loaded(object sender, RoutedEventArgs e)
@@ -38,9 +45,6 @@ namespace Compdfkit_Tools.PDFControl
             GetViewMode.Add(Tuple.Create("Discontinuous", "Single"), ViewModes.Single);
             GetViewMode.Add(Tuple.Create("Discontinuous", "Double"), ViewModes.Double);
             GetViewMode.Add(Tuple.Create("Discontinuous", "Book"), ViewModes.Book);
-            CPDFViewModeUI.SetContinuousEvent += CPDFViewModeUI_SetContinuousEvent;
-            CPDFViewModeUI.SetViewModeEvent += CPDFViewModeUI_SetViewModeEvent;
-            CPDFViewModeUI.SplitModeChanged += CPDFViewModeUI_SplitModeChanged; 
         }
 
         private void CPDFViewModeUI_SplitModeChanged(object sender, SplitMode e)

+ 6 - 0
Demo/Examples/Compdfkit_Tools/PDFView/PDFScaling/PDFScalingControl/CPDFScalingControl.xaml.cs

@@ -31,6 +31,12 @@ namespace Compdfkit_Tools.PDFControl
 
         private void PDFScalingControl_Loaded(object sender, RoutedEventArgs e)
         {
+            CPDFScalingUI.SetScaleEvent -= PDFScalingControl_SetScaleEvent;
+            CPDFScalingUI.ScaleIncreaseEvent -= PDFScalingControl_ScaleIncreaseEvent;
+            CPDFScalingUI.ScaleDecreaseEvent -= PDFScalingControl_ScaleDecreaseEvent;
+            CPDFScalingUI.SetPresetScaleEvent -= CPDFScalingUI_SetPresetScaleEvent;
+            ViewControl.PDFViewTool.GetCPDFViewer().MouseWheelZoomHandler -= PDFControl_MouseWheelZoomHandler;
+
             CPDFScalingUI.SetScaleEvent += PDFScalingControl_SetScaleEvent;
             CPDFScalingUI.ScaleIncreaseEvent += PDFScalingControl_ScaleIncreaseEvent;
             CPDFScalingUI.ScaleDecreaseEvent += PDFScalingControl_ScaleDecreaseEvent;

+ 5 - 1
Demo/Examples/Compdfkit_Tools/PDFView/PDFSearch/PDFSearchControl/CPDFSearchControl.xaml.cs

@@ -46,7 +46,6 @@ namespace Compdfkit_Tools.PDFControl
                     {
                         ClearSearchResult();
                         pdfView = newPDFView;
-
                     }
                 }
             }
@@ -60,6 +59,11 @@ namespace Compdfkit_Tools.PDFControl
         private void PDFSearch_Loaded(object sender, RoutedEventArgs e)
         {
             textSearch = new PDFTextSearch();
+            SearchInput.SearchEvent -= SearchInput_SearchEvent;
+            SearchInput.ClearEvent -= SearchInput_ClearEvent;
+            textSearch.SearchCompletedHandler -= TextSearch_SearchCompletedHandler;
+            SearchResult.SelectionChanged -= SearchResult_SelectionChanged;
+
             SearchInput.SearchEvent += SearchInput_SearchEvent;
             SearchInput.ClearEvent += SearchInput_ClearEvent;
             textSearch.SearchCompletedHandler += TextSearch_SearchCompletedHandler;

+ 3 - 0
Demo/Examples/Compdfkit_Tools/PDFView/PDFThumbnail/PDFThumbnailControl/CPdfThumbnailControl.xaml.cs

@@ -55,6 +55,9 @@ namespace Compdfkit_Tools.PDFControl
         /// </summary>
         private void PdfThumbnail_Loaded(object sender, RoutedEventArgs e)
         {
+            ThumbControl.ViewChanged -= ThumbControl_ViewChanged;
+            ThumbControl.SelectionChanged -= ThumbControl_SelectionChanged;
+
             ThumbControl.ViewChanged += ThumbControl_ViewChanged;
             ThumbControl.SelectionChanged += ThumbControl_SelectionChanged;
         }

+ 13 - 1
Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml.cs

@@ -59,17 +59,29 @@ namespace Compdfkit_Tools.PDFControl
             splitViewerTool = new CPDFViewerTool();
             splitToolManager = new CPDFToolManager(splitViewerTool);
             splitToolManager.SetToolType(CPDFToolManager.ToolType.Viewer);
-            splitViewerTool.SizeChanged += SplitViewerTool_SizeChanged;
 
             FocusPDFViewTool = viewerTool;
             PDFView.Child = PDFViewTool;
 
+            PDFViewTool.SizeChanged -= PDFViewTool_SizeChanged;
+            PDFViewTool.GetCPDFViewer().MouseWheelZoomHandler -= PDFViewControl_MouseWheelZoomHandler;
+            PDFToolManager.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
+            PDFToolManager.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
+            PDFToolManager.MouseMoveHandler -= PDFToolManager_MouseMoveHandler;
+
             PDFViewTool.SizeChanged += PDFViewTool_SizeChanged;
             PDFViewTool.GetCPDFViewer().MouseWheelZoomHandler += PDFViewControl_MouseWheelZoomHandler;
             PDFToolManager.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
             PDFToolManager.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
             PDFToolManager.MouseMoveHandler += PDFToolManager_MouseMoveHandler;
 
+            splitViewerTool.SizeChanged -= SplitViewerTool_SizeChanged;
+            splitViewerTool.GetCPDFViewer().MouseWheelZoomHandler -= SplitPDFViewControl_MouseWheelZoomHandler;
+            splitToolManager.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
+            splitToolManager.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
+            splitToolManager.MouseMoveHandler -= PDFToolManager_MouseMoveHandler;
+
+            splitViewerTool.SizeChanged += SplitViewerTool_SizeChanged;
             splitViewerTool.GetCPDFViewer().MouseWheelZoomHandler += SplitPDFViewControl_MouseWheelZoomHandler;
             splitToolManager.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
             splitToolManager.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;

+ 2 - 0
Demo/Examples/Compdfkit_Tools/PageEdit/PDFPageEdit/CPDFPageEditControl.xaml.cs

@@ -136,6 +136,7 @@ namespace Compdfkit_Tools.PDFControl
                 CPDFPageInsertWindow pageInsertWindow = new CPDFPageInsertWindow();
                 Window parentWindow = Window.GetWindow(this);
                 pageInsertWindow.InitPageInsertWindow(SelectedIndex, pdfDoc.PageCount);
+                pageInsertWindow.DialogClosed -= PageInsertWindow_DialogClosed;
                 pageInsertWindow.DialogClosed += PageInsertWindow_DialogClosed;
                 pageInsertWindow.Owner = parentWindow;
                 pageInsertWindow.ShowDialog();
@@ -149,6 +150,7 @@ namespace Compdfkit_Tools.PDFControl
                 CPDFPageExtractWindow pageExtractWindow = new CPDFPageExtractWindow();
                 Window parentWindow = Window.GetWindow(this);
                 pageExtractWindow.InitPageExtractWindow(SelectedItemsRange, pdfDoc.PageCount);
+                pageExtractWindow.DialogClosed -= PageExtractWindow_DialogClosed;
                 pageExtractWindow.DialogClosed += PageExtractWindow_DialogClosed;
                 pageExtractWindow.Owner = parentWindow;
                 pageExtractWindow.ShowDialog();  

+ 7 - 0
Demo/Examples/Compdfkit_Tools/PageEdit/PDFPageExtract/CPDFPageExtractWindow.xaml.cs

@@ -47,6 +47,13 @@ namespace Compdfkit_Tools.PDFControl
 
         private void CPDFPageExtractUI_Loaded(object sender, RoutedEventArgs e)
         {
+            CPDFPageExtractUI.PageRangeChanged -= CPDFPageExtractUI_PageRangeChanged;
+            CPDFPageExtractUI.CustomPageRangeChanged -= CPDFPageExtractUI_CustomPageRangeChanged;
+            CPDFPageExtractUI.SeparateChanged -= CPDFPageExtractUI_SeparateChanged;
+            CPDFPageExtractUI.DeleteChanged -= CPDFPageExtractUI_DeleteChanged;
+            CPDFPageExtractUI.ExtractEvent -= CPDFPageExtractUI_ExtractEvent;
+            CPDFPageExtractUI.CancelEvent -= CPDFPageExtractUI_CancelEvent;
+
             CPDFPageExtractUI.PageRangeChanged += CPDFPageExtractUI_PageRangeChanged;
             CPDFPageExtractUI.CustomPageRangeChanged += CPDFPageExtractUI_CustomPageRangeChanged;
             CPDFPageExtractUI.SeparateChanged += CPDFPageExtractUI_SeparateChanged;

+ 2 - 0
Demo/Examples/Compdfkit_Tools/PageEdit/PDFPageInsert/CPDFPageInsertUI.xaml.cs

@@ -105,6 +105,7 @@ namespace Compdfkit_Tools.PDFControlUI
                     Window parentWindow = Window.GetWindow(this);
                     passwordWindow.Owner = parentWindow;
                     passwordWindow.InitDocument(pdfDoc);
+                    passwordWindow.DialogClosed -= PasswordWindow_DialogClosed;
                     passwordWindow.DialogClosed += PasswordWindow_DialogClosed;
                     passwordWindow.ShowDialog();
                     if (password != string.Empty)
@@ -186,6 +187,7 @@ namespace Compdfkit_Tools.PDFControlUI
 
         private void WritableComboBoxControl_Loaded(object sender, RoutedEventArgs e)
         {
+            WritableComboBoxControl.TextChanged -= WritableComboBoxControl_TextChanged;
             WritableComboBoxControl.TextChanged += WritableComboBoxControl_TextChanged;
         }
 

+ 9 - 0
Demo/Examples/Compdfkit_Tools/PageEdit/PDFPageInsert/CPDFPageInsertWindow.xaml.cs

@@ -36,6 +36,15 @@ namespace Compdfkit_Tools.PDFControl
 
         private void CPDFPageInsertUI_Loaded(object sender, RoutedEventArgs e)
         {
+            CPDFPageInsertUI.InsertTypeChanged -= CPDFPageInsertUI_InsertTypeChanged;
+            CPDFPageInsertUI.SelectedFileChanged -= CPDFPageInsertUI_SelectedFileChanged;
+            CPDFPageInsertUI.InsertIndexChanged -= CPDFPageInsertUI_InsertIndexChanged;
+            CPDFPageInsertUI.TextChanged -= CPDFPageInsertUI_TextChanged;
+            CPDFPageInsertUI.CancelEvent -= CPDFPageInsertUI_CancelEvent;
+            CPDFPageInsertUI.InsertEvent -= CPDFPageInsertUI_InsertEvent;
+            CPDFPageInsertUI.PageSizeChanged -= CPDFPageInsertUI_PageSizeChanged;
+            CPDFPageInsertUI.PasswordChanged -= CPDFPageInsertUI_PasswordChanged;
+
             CPDFPageInsertUI.InsertTypeChanged += CPDFPageInsertUI_InsertTypeChanged;
             CPDFPageInsertUI.SelectedFileChanged += CPDFPageInsertUI_SelectedFileChanged;
             CPDFPageInsertUI.InsertIndexChanged += CPDFPageInsertUI_InsertIndexChanged;

+ 1 - 0
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -173,6 +173,7 @@ namespace PDFViewer
                 LoadCustomControl();
                 panelState.PropertyChanged -= PanelState_PropertyChanged;
                 panelState.PropertyChanged += PanelState_PropertyChanged;
+                displaySettingsControl.SplitModeChanged -= DisplaySettingsControl_SplitModeChanged;
                 displaySettingsControl.SplitModeChanged += DisplaySettingsControl_SplitModeChanged;
             }
         }