public async Task Fill(StorageFolder mainfolder) { if (SourcePrivate.Count > 0) { SourcePrivate.Clear(); } MainFolder = mainfolder; IndexedState folderIndexedState = await MainFolder.GetIndexedStateAsync(); if (folderIndexedState == IndexedState.NotIndexed || folderIndexedState == IndexedState.Unknown) { //Only possible in indexed directories. } else { //this method only works for indexed stuff ( known folders only ) //For More Details visit https://blogs.msdn.microsoft.com/adamdwilson/2017/12/20/fast-file-enumeration-with-partially-initialized-storagefiles/ await FillUpFolders(); FillAds(); await FillUpFiles(); } }
public async Task <List <ImageFile> > GetImageFiles(StorageFolder folder) { // https://docs.microsoft.com/en-us/windows/uwp/files/fast-file-properties Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder); IndexedState folderIndexedState = await folder.GetIndexedStateAsync(); if (folderIndexedState == IndexedState.NotIndexed || folderIndexedState == IndexedState.Unknown) { return(null); } QueryOptions picturesQuery = GetPicturesQuery(folder); List <ImageFile> imageFiles = await GetPicturesQueryResult(folder, picturesQuery); return(imageFiles); }