如何在Windows Phone 8上获取文件夹中的文件列表?
答案 0 :(得分:2)
IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication();
if(file.GetDirectoryNames().Contains("Personal"))
{
string directory = "Personal/";
string[] filenames = file.GetFileNames(directory);
List<FileData> files = new List<FileData>();
foreach(string filename in filenames)
{
FileData f = new FileData();
f.filename = filename;
files.Add(f);
}
lstFiles.ItemsSource = files;
}
这只是从名为Personal
的目录中检索文件的代码段答案 1 :(得分:1)
在Windows Phone 8中,您应该使用StorageFile和StorageFolder API:
Quickstart: Working with files and folders in Windows Phone 8