FreehandAnnotProperty.xaml.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. // data.SelectColor = e;
  36. }
  37. }
  38. private void cusColor_SelectedColor(object sender, Color e)
  39. {
  40. var data = this.DataContext as FreehandAnnotPropertyViewModel;
  41. if (data != null)
  42. {
  43. data.SelectedColorChangedCommand?.Execute(e);
  44. }
  45. }
  46. private void EraseBtn_Click(object sender, RoutedEventArgs e)
  47. {
  48. if (EraseBtn.IsChecked == true)
  49. {
  50. ErasePath.Visibility = Visibility.Visible;
  51. FreehandPath.Visibility = Visibility.Collapsed;
  52. PnlPen.Visibility = Visibility.Collapsed;
  53. PnlEraser.Visibility = Visibility.Visible;
  54. PenBtn.IsChecked = !EraseBtn.IsChecked;
  55. }
  56. else
  57. {
  58. EraseBtn.IsChecked = true;
  59. }
  60. }
  61. private void PenBtn_Click(object sender, RoutedEventArgs e)
  62. {
  63. if (PenBtn.IsChecked == true)
  64. {
  65. FreehandPath.Visibility = Visibility.Visible;
  66. ErasePath.Visibility = Visibility.Collapsed;
  67. PnlPen.Visibility = Visibility.Visible;
  68. PnlEraser.Visibility = Visibility.Collapsed;
  69. EraseBtn.IsChecked = !PenBtn.IsChecked;
  70. }
  71. else
  72. {
  73. PenBtn.IsChecked = true;
  74. }
  75. }
  76. }
  77. }