SharpsAnnotProperty.xaml.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using ComPDFKit.PDFAnnotation;
  2. using ComPDFKitViewer.AnnotEvent;
  3. using PDF_Master.CustomControl;
  4. using PDF_Master.ViewModels.PropertyPanel.AnnotPanel;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using System.Windows.Controls.Primitives;
  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_Master.Views.PropertyPanel.AnnotPanel
  21. {
  22. /// <summary>
  23. /// SharpsAnnotProperty.xaml 的交互逻辑
  24. /// </summary>
  25. public partial class SharpsAnnotProperty : UserControl
  26. {
  27. private SharpsAnnotPropertyViewModel ViewModel => DataContext as SharpsAnnotPropertyViewModel;
  28. public SharpsAnnotProperty()
  29. {
  30. InitializeComponent();
  31. this.Loaded += Usercontrol_Loaded;
  32. cusColor.SelectedColorHandler += cusColor_SelectedColor;
  33. cusFillColor.SelectedColorHandler += CusFillColor_SelectedColorHandler;
  34. }
  35. private void CusFillColor_SelectedColorHandler(object sender, Color e)
  36. {
  37. if (ViewModel != null)
  38. {
  39. ViewModel.SelectedFillColorCommand?.Execute(e);
  40. }
  41. }
  42. private void cusColor_SelectedColor(object sender, Color e)
  43. {
  44. if (ViewModel != null)
  45. {
  46. ViewModel.SelectedBorderColorCommand?.Execute(e);
  47. }
  48. }
  49. private void Usercontrol_Loaded(object sender, RoutedEventArgs e)
  50. {
  51. if (ViewModel != null)
  52. {
  53. var str = ViewModel.BasicVm.strOtherTag;
  54. if (str == "Rect")
  55. {
  56. SharpRectBtn.IsChecked = true;
  57. }
  58. else if (str == "Circle")
  59. {
  60. SharpCircleBtn.IsChecked = true;
  61. }
  62. else if (str == "Arrow")
  63. {
  64. SharpArrowBtn.IsChecked = true;
  65. }
  66. else if (str == "Line")
  67. {
  68. SharpLineBtn.IsChecked = true;
  69. }
  70. }
  71. }
  72. }
  73. }