DocItemControl.xaml.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. using System.IO;
  16. using PDFSettings.Settings;
  17. using PDF_Office.Helper;
  18. using ComPDFKit.PDFDocument;
  19. namespace PDF_Office.Views.HomePanel.RecentFiles
  20. {
  21. /// <summary>
  22. /// DocItemControl.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class DocItemControl : UserControl
  25. {
  26. public DocItemControl()
  27. {
  28. InitializeComponent();
  29. }
  30. private void Grid_Loaded(object sender, RoutedEventArgs e)
  31. {
  32. var grid = sender as Grid;
  33. if (grid != null)
  34. {
  35. var data = grid.DataContext as OpenFileInfo;
  36. if (data == null) return;
  37. if (!string.IsNullOrEmpty(data.ThumbImgPath))
  38. CoverImage.Source = ToolMethod.GetFileThumbImg(data.ThumbImgPath);
  39. else
  40. {
  41. CPDFDocument tempdoc = CPDFDocument.InitWithFilePath(data.FilePath);
  42. if (tempdoc != null && (bool)(tempdoc.IsLocked))
  43. {
  44. CoverImage.Source = ToolMethod.GetFileThumbImg("pack://application:,,,/Resources/FilesType/ic_propertybar_file_pdf_lock.png");
  45. }
  46. else
  47. CoverImage.Source = ToolMethod.GetFileThumbImg("pack://application:,,,/Resources//FilesType/ic_propertybar_file_png_Large.png");
  48. }
  49. }
  50. }
  51. }
  52. }