DigitalSignatureControl.xaml.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using Compdfkit_Tools.PDFControl;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Linq;
  6. using System.Runtime.CompilerServices;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Navigation;
  17. using System.Windows.Shapes;
  18. namespace Compdfkit_Tools.PDFControl
  19. {
  20. /// <summary>
  21. /// DigitalSignatureControl.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class DigitalSignatureControl : UserControl, INotifyPropertyChanged
  24. {
  25. private bool isFirstLoad = true;
  26. public PDFViewControl PdfViewControl = new PDFViewControl();
  27. private bool _isActive = false;
  28. public event PropertyChangedEventHandler PropertyChanged;
  29. protected void OnPropertyChanged([CallerMemberName] string name = null)
  30. {
  31. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
  32. }
  33. public bool IsActive
  34. {
  35. get => _isActive;
  36. set
  37. {
  38. _isActive = value;
  39. OnPropertyChanged();
  40. }
  41. }
  42. public bool CanUndo
  43. {
  44. get
  45. {
  46. if (PdfViewControl != null && PdfViewControl.PDFView != null)
  47. {
  48. return PdfViewControl.PDFView.UndoManager.CanUndo;
  49. }
  50. return false;
  51. }
  52. }
  53. public bool CanRedo
  54. {
  55. get
  56. {
  57. if (PdfViewControl != null && PdfViewControl.PDFView != null)
  58. {
  59. return PdfViewControl.PDFView.UndoManager.CanRedo;
  60. }
  61. return false;
  62. }
  63. }
  64. public DigitalSignatureControl()
  65. {
  66. InitializeComponent();
  67. }
  68. private void UserControl_Loaded(object sender, RoutedEventArgs e)
  69. {
  70. }
  71. private void UserControl_UnLoaded(object sender, RoutedEventArgs e)
  72. {
  73. }
  74. private void AnnotationBarControl_Loaded(object sender, RoutedEventArgs e)
  75. {
  76. }
  77. private void DigitalSignatureBarControl_Unloaded(object sender, RoutedEventArgs e)
  78. {
  79. if (PdfViewControl != null && PdfViewControl.PDFView != null && CanUndo)
  80. {
  81. PdfViewControl.PDFView.UndoManager?.Undo();
  82. }
  83. }
  84. private void CommandBinding_Executed_Undo(object sender, ExecutedRoutedEventArgs e)
  85. {
  86. if (PdfViewControl != null && PdfViewControl.PDFView != null && CanUndo)
  87. {
  88. PdfViewControl.PDFView.UndoManager?.Undo();
  89. }
  90. }
  91. private void CommandBinding_Executed_Redo(object sender, ExecutedRoutedEventArgs e)
  92. {
  93. }
  94. private void UndoButton_Click(object sender, RoutedEventArgs e)
  95. {
  96. }
  97. private void RedoButton_Click(object sender, RoutedEventArgs e)
  98. {
  99. }
  100. }
  101. }