FreehandAnnotProperty.xaml.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace PDF_Office.Views.PropertyPanel.AnnotPanel
  17. {
  18. /// <summary>
  19. /// FreehandAnnotProperty.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class FreehandAnnotProperty : UserControl
  22. {
  23. public FreehandAnnotProperty()
  24. {
  25. InitializeComponent();
  26. cusColor.SelectedColorHandler += cusColor_SelectedColor;
  27. layerThick.SelectedValueChanged += layerThick_SelectedValue;
  28. }
  29. private void layerThick_SelectedValue(object sender, double e)
  30. {
  31. var data = this.DataContext as FreehandAnnotPropertyViewModel;
  32. if (data != null)
  33. {
  34. data.SelectedValueChangedCommand?.Execute(e);
  35. }
  36. }
  37. private void cusColor_SelectedColor(object sender, Color e)
  38. {
  39. var data = this.DataContext as FreehandAnnotPropertyViewModel;
  40. if (data != null)
  41. {
  42. data.SelectedColorChangedCommand?.Execute(e);
  43. }
  44. }
  45. private void EraseBtn_Click(object sender, RoutedEventArgs e)
  46. {
  47. if (EraseBtn.IsChecked == true)
  48. {
  49. ErasePath.Visibility = Visibility.Visible;
  50. FreehandPath.Visibility = Visibility.Collapsed;
  51. PnlPen.Visibility = Visibility.Collapsed;
  52. PnlEraser.Visibility = Visibility.Visible;
  53. PenBtn.IsChecked = !EraseBtn.IsChecked;
  54. }
  55. else
  56. {
  57. EraseBtn.IsChecked = true;
  58. }
  59. }
  60. private void PenBtn_Click(object sender, RoutedEventArgs e)
  61. {
  62. if (PenBtn.IsChecked == true)
  63. {
  64. FreehandPath.Visibility = Visibility.Visible;
  65. ErasePath.Visibility = Visibility.Collapsed;
  66. PnlPen.Visibility = Visibility.Visible;
  67. PnlEraser.Visibility = Visibility.Collapsed;
  68. EraseBtn.IsChecked = !PenBtn.IsChecked;
  69. }
  70. else
  71. {
  72. PenBtn.IsChecked = true;
  73. }
  74. }
  75. }
  76. }