ViewModularContent.xaml.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using ComPDFKitViewer;
  2. using PDF_Office.ViewModels;
  3. using PDF_Office.ViewModels.PropertyPanel.ViewModular;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  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 PDF_Office.Views.PropertyPanel.ViewModular
  19. {
  20. /// <summary>
  21. /// ViewModularContent.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class ViewModularContent : UserControl
  24. {
  25. private ViewModularContentViewModel viewModel = null;
  26. public ViewModularContent()
  27. {
  28. InitializeComponent();
  29. viewModel = this.DataContext as ViewModularContentViewModel;
  30. }
  31. /// <summary>
  32. /// 阅读模式
  33. /// </summary>
  34. /// <param name="sender"></param>
  35. /// <param name="e"></param>
  36. private void RbtnReadMode_Click(object sender, RoutedEventArgs e)
  37. {
  38. RbtnReadMode.IsChecked = false;
  39. if (Window.GetWindow(this) is MainWindow window)
  40. {
  41. if (window.TabablzControl.SelectedItem is MainContent main)
  42. {
  43. if (main.ContentMain.Content is ViewContent viewContent)
  44. {
  45. //viewContent.RbtnReadMode(sender, e);
  46. ViewContentViewModel model = viewContent.DataContext as ViewContentViewModel;
  47. model.RbtnReadMode();
  48. }
  49. }
  50. }
  51. }
  52. private void btnRotateRight_Click(object sender, RoutedEventArgs e)
  53. {
  54. if (Window.GetWindow(this) is MainWindow window)
  55. {
  56. if (window.TabablzControl.SelectedItem is MainContent main)
  57. {
  58. if (main.ContentMain.Content is ViewContent viewContent)
  59. {
  60. foreach (var item in viewContent.GridViewer.Children)
  61. {
  62. if (item is ContentControl control)
  63. {
  64. if (control.Content is SplitScreenContent splitScreenContent)
  65. {
  66. if (splitScreenContent.PDFViewerContent.Content != null)
  67. {
  68. viewModel.SplitScreenPDFViewer = (ComPDFKitViewer.PdfViewer.CPDFViewer)splitScreenContent.PDFViewerContent.Content;
  69. break;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. }
  77. viewModel.RotateCommand.Execute((sender as Button).Tag.ToString());
  78. }
  79. }
  80. }