WinRT:用于枚举库和已知文件夹之外的文件的应用程序 [英] WinRT: App to enumerate files outside libraries and known folders

查看:112
本文介绍了WinRT:用于枚举库和已知文件夹之外的文件的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Metro应用程序,该应用程序在ListView控件中显示给定文件夹的内容。
MS认为开发人员不需要System.IO.Directory类,并将其完全从框架中删除。

I am working on a Metro app that shows the content of a given folder in a ListView control. MS decided that developers don't need the System.IO.Directory class and removed it entirely from the framework.

我正在寻找一种替代工具,以在Metro风格的应用程序中枚举C#中的文件。我检查了MS提供的所有枚举示例,它们似乎都只使用 KnownFolders 类枚举Windows库,例如:

I am looking for a replacement to enumerate files in C# in a metro style app. I have checked all the enumeration samples provided by MS and they all seem to only enumerate the Windows Libraries using the KnownFolders class, something like:

StorageFolder picturesFolder = KnownFolders.PicturesLibrary;

并调用 GetFilesAsync() GetFoldersAsync()方法取决于您的需求。如果我只想枚举图片或音乐库中的内容,这些都是金子。但是,我希望枚举库中未包含的目录上的文件。

and calling the GetFilesAsync() or GetFoldersAsync() methods depending on your needs. These are all gold if I wanted to enumerate only inside the pictures or music library. However I am looking to enumerate files on directories that are not included in a library.

任何人都知道WinRT中这是怎么可能的?

Anyone knows how this is possible in WinRT???

推荐答案

在设计上,您对于Metro应用程序在这一领域极为有限。想法是,仅授予Metro应用程序访问它受信任访问的那些内容的权限,因此您可以:

You are, by design, extremely limited in this area for Metro apps. The idea is that a Metro app is only given access to those things that it is trusted to access, so you can either:


  1. 访问本地特定于您的应用程序的存储空间

  2. 访问一些众所周知的存储位置,或者

  3. 访问特定授予的位置。

看看 http://msdn.microsoft.com/zh-cn/library/windows/apps/hh464959.aspx ,以了解您将能够访问的内容。

Take a look at http://msdn.microsoft.com/en-us/library/windows/apps/hh464959.aspx to get an idea as to what you'll be able to access.

这篇关于WinRT:用于枚举库和已知文件夹之外的文件的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆