ソースを参照

首页-修复清空缓存后第一次打开软件时,最近文件列表不显示图标的问题

ZhouJieSheng 1 年間 前
コミット
746310be82

+ 2 - 0
PDF Office/ViewModels/HomeContentViewModel.cs

@@ -351,6 +351,8 @@ namespace PDF_Master.ViewModels
                         if (!App.OpenedFileList.Contains(fileList[i]))
                         {
                             App.mainWindowViewModel.AddTabItem(fileList[i]);
+                            //这一段很重要 如果注释掉将不能多选文件打开
+                            await Task.Delay(30);
                         }
                         ToolMethod.SetFileThumbImg(fileList[i]);
                     }

+ 1 - 0
PDF Office/Views/HomePanel/RecentFiles/DocItemControl.xaml

@@ -10,6 +10,7 @@
     mc:Ignorable="d">
     <Grid
         DataContext="{Binding}"
+        DataContextChanged="Grid_DataContextChanged"
         Loaded="Grid_Loaded"
         ToolTip="{Binding FilePath}">
         <Grid.RowDefinitions>

+ 29 - 0
PDF Office/Views/HomePanel/RecentFiles/DocItemControl.xaml.cs

@@ -57,5 +57,34 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
                 }
             }
         }
+
+        private void Grid_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
+        {
+            var grid = sender as Grid;
+            if (grid != null&&CoverImage.Source==null)
+            {
+                var data = grid.DataContext as OpenFileInfo;
+                if (data == null) return;
+
+                if (data.IsGuidPDF && App.IsGuidPDFUpdated)
+                {
+                    RecNewMark.Visibility = Visibility.Visible;
+                }
+
+                if (!string.IsNullOrEmpty(data.ThumbImgPath))
+                    CoverImage.Source = ToolMethod.GetFileThumbImg(data.ThumbImgPath);
+                else
+                {
+                    CPDFDocument tempdoc = CPDFDocument.InitWithFilePath(data.FilePath);
+                    if (tempdoc != null && (bool)(tempdoc.IsLocked))
+                    {
+                        CoverImage.Source = ToolMethod.GetFileThumbImg("pack://application:,,,/Resources/FilesType/ic_propertybar_file_pdf_lock.png");
+                    }
+                    else
+                        CoverImage.Source = ToolMethod.GetFileThumbImg("pack://application:,,,/Resources//FilesType/ic_propertybar_file_png_Large.png");
+                    tempdoc?.Release();
+                }
+            }
+        }
     }
 }