Exemple #1
0
 /// <summary>
 /// Download file from server to local, and keep contentInfo to recentViewedFiles.
 /// </summary>
 /// <param name="contentInfo"></param>
 /// <returns></returns>
 public async Task<StorageFile> DownloadFile(KbListContentInfo contentInfo)
 {
     StorageFile sfile = null;
     if (await CheckToken())
     {
         sfile = await KBApiUtil.DownloadFileAsync(contentInfo.FullPath, token);
         if (!recentViewedFiles.Exists(o => o.FullPath.Equals(contentInfo.FullPath)))
         {
             recentViewedFiles.Insert(0, contentInfo);
         }
     }
     return sfile;
 }
Exemple #2
0
 // Get icon file path for individual extend file name.
 private string getFileIcon(KbListContentInfo contentInfo)
 {
     string fileIconPath = "Images/";
     if (contentInfo.IsFolder)
     {
         fileIconPath += ICON_FILETYPE_FOLDER;
     }
     else
     {
         string fileTypeIcon = ICON_FILETYPE_UNKNOWN;
         string fileExt = contentInfo.FullPath.Substring(contentInfo.FullPath.LastIndexOf(".") + 1);
         if (fileExt != null)
         {
             fileExt = fileExt.ToLower();
             if (!FileTypeIcon.TryGetValue(fileExt, out fileTypeIcon))
             {
                 fileTypeIcon = ICON_FILETYPE_UNKNOWN;
             }
         }
         fileIconPath += fileTypeIcon;
     }
     return fileIconPath;
 }