0

我有一个获取缩略图的代码,看起来像这样

public async Task<bool> SetThumbnail(Model.FileInfo Fil)
{
   try
   {
      // Set the File
      var File = await GetStorageFile(Fil);

      // Set the File's thumbnail
      Fil.FileThumbnail = await File.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode.ListView);

      // Set the File
      Fil.File = File;

      // Return true as it was successfully executed
      return true;
   }
   // Otherwise it was not successful so return false
   catch (Exception e) {
      return false;
   }
}

GetStorageFile 方法如下所示

private async Task<StorageFile> GetStorageFile(Model.FileInfo FileInf)
{
   // Create (and open the Folder)
   var Folder = await _Folder.CreateFolderAsync(_FilesFolderName, CreationCollisionOption.OpenIfExists);

   // Get the File
   return await Folder.GetFileAsync(FileInf.ID + "." + FileInf.Extension);
}

第一次效果很好,但是当我第二次显示列表时,缩略图没有出现

当我第二次运行它时,可能出了什么问题?

4

0 回答 0