DocItemControl.xaml.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 (data.IsGuidPDF && App.IsGuidPDFUpdated)
  38. {
  39. RecNewMark.Visibility = Visibility.Visible;
  40. }
  41. if (!string.IsNullOrEmpty(data.ThumbImgPath))
  42. CoverImage.Source = ToolMethod.GetFileThumbImg(data.ThumbImgPath);
  43. else
  44. {
  45. CPDFDocument tempdoc = CPDFDocument.InitWithFilePath(data.FilePath);
  46. if (tempdoc != null && (bool)(tempdoc.IsLocked))
  47. {
  48. CoverImage.Source = ToolMethod.GetFileThumbImg("pack://application:,,,/Resources/FilesType/ic_propertybar_file_pdf_lock.png");
  49. }
  50. else
  51. CoverImage.Source = ToolMethod.GetFileThumbImg("pack://application:,,,/Resources//FilesType/ic_propertybar_file_png_Large.png");
  52. tempdoc.Release();
  53. }
  54. }
  55. }
  56. }
  57. }