TextAnnotProperty.xaml.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using ComPDFKitViewer;
  2. using ComPDFKitViewer.AnnotEvent;
  3. using PDF_Office.Properties;
  4. using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
  5. using PDFSettings;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows;
  12. using System.Windows.Controls;
  13. using System.Windows.Data;
  14. using System.Windows.Documents;
  15. using System.Windows.Input;
  16. using System.Windows.Media;
  17. using System.Windows.Media.Imaging;
  18. using System.Windows.Navigation;
  19. using System.Windows.Shapes;
  20. namespace PDF_Office.Views.PropertyPanel.AnnotPanel
  21. {
  22. /// <summary>
  23. /// TextAnnotProperty.xaml 的交互逻辑
  24. /// </summary>
  25. public partial class TextAnnotProperty : UserControl
  26. {
  27. private TextAnnotPropertyViewModel ViewModel =>DataContext as TextAnnotPropertyViewModel;
  28. public TextAnnotProperty()
  29. {
  30. InitializeComponent();
  31. ViewModel.LoadPropertyHandler += ViewModel_LoadPropertyHandler;
  32. }
  33. private void ViewModel_LoadPropertyHandler(object sender, object e)
  34. {
  35. var item = e as AnnotHandlerEventArgs;
  36. switch (item.EventType)
  37. {
  38. case AnnotArgsType.AnnotHighlight:
  39. {
  40. var annot = item as TextHighlightAnnotArgs;
  41. if (annot != null)
  42. {
  43. SlidOpacity.SetSliOpacity(annot.Transparency);
  44. }
  45. break;
  46. }
  47. case AnnotArgsType.AnnotUnderline:
  48. {
  49. var annot = item as TextUnderlineAnnotArgs;
  50. if (annot != null)
  51. {
  52. SlidOpacity.SetSliOpacity(annot.Transparency);
  53. }
  54. break;
  55. }
  56. case AnnotArgsType.AnnotStrikeout:
  57. {
  58. var annot = item as TextStrikeoutAnnotArgs;
  59. if (annot != null)
  60. {
  61. SlidOpacity.SetSliOpacity(annot.Transparency);
  62. }
  63. break;
  64. }
  65. }
  66. }
  67. }
  68. }