问题
I want to know how to get files from the directory under Picture Library.(C:\Users\username\Pictures\MyFoler)
I know how to get files and folders from PicturesLibrary.
StorageFolder picturesFolder = KnownFolders.PicturesLibrary;
IReadOnlyList<StorageFile> fileLists = await picturesFolder.GetFilesAsync();
IReadOnlyList<StorageFolder> folderLists = await picturesFolder.GetFoldersAsync();
回答1:
Using the same general mechanism, StorageFolder exposes GetFoldersAsync and GetFilesAsync.
This code, added after what you have, would get a list of files in Pictures\MyFolder
StorageFolder myFolder = folderLists.Where(f => f.DisplayName == "MyFolder").FirstOrDefault();
if (myFolder != null)
{
ReadOnlyList<StorageFile> myPictures = await myFolder.GetFilesAsync();
}
来源:https://stackoverflow.com/questions/14391321/how-to-get-files-from-the-directory-under-picture-library