SilverLight遍历本地用户文件夹,由于安全性考虑,SilverLight只能遍历我的文档,我的视频,我的图片,我的音乐四个本地文件夹,而且只能运行于Out-Of-broswer模式中
帖代码:
Dim folderList As New List(Of String) 'Directory.EnumerateFiles 用于在被受信任的应用程序调用时,返回指定路径中文件名的可枚举集合 'Environment.GetFolderPath:用来返回文件的完整路径 'Environment.SpecialFolder:包含我们需要获取的文件类型 Dim docs = Directory.EnumerateFiles(Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments)) '我的文档 Dim videos = Directory.EnumerateFiles(Environment.GetFolderPath(System.Environment.SpecialFolder.MyVideos)) '我的视频 Dim photos = Directory.EnumerateFiles(Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures)) '我的图片 Dim music = Directory.EnumerateFiles(Environment.GetFolderPath(System.Environment.SpecialFolder.MyMusic)) '我的音乐 For Each item As String In docs folderList.Add(item) Next Me.lstFiles.ItemsSource = folderList
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。