首页新闻找找看学习计划

win8 app中获取本地音乐库中的文件夹及文件显示到界面的时候,设置断点一步步跟踪是正常获取到,但如果去掉

0
[已关闭问题] 关闭于 2013-04-18 12:58

获取本地音乐库中的文件夹及文件显示到界面的时候,设置断点一步步跟踪是正常获取到,但如果去掉了断点就会出错,菜鸟寻求高手指点,如果解决?下面是代码

 List<FileInfo> DatailInfo = new List<FileInfo>();

        public List<FileInfo> GetLocalDetailInfo(string strDitroyName)         {             GetAllFolder(strDitroyName);             return DatailInfo;///执行完这里就会出错,一步步跟踪的时候这里DatailInfo可以得到数据,但不设置断点,这里DatailInfo的count是0.这个时候就出现了错误。         }

private async void GetAllFolder(string strDitoryName)         {             IAsyncOperation<IReadOnlyList<IStorageItem>> istroageItem = null;

           istroageItem = KnownFolders.MusicLibrary.GetItemsAsync();

 IReadOnlyList<IStorageItem> ItemList = istroageItem.GetResults();

            if (ItemList.Count <= 0) return;

            foreach (var item in ItemList)             {                 string strName = item.Name;                 string strPath = item.Path;                 string strDate = item.DateCreated.ToString("yyyy-MM-dd");                 string strType = item.Attributes.ToString();

 ulong lSize = (await item.GetBasicPropertiesAsync()).Size;//.GetResults().Size;                 string strSize = "";

if (strType.Equals("Directory"))                 {                                        DatailInfo.Add(new FileInfo()                     {                         FileName = strName,                         FileType = "文件夹",                         FileSize = "",                         SmallImageUrl = "ms-appx:///Assets/Images/Icons/folder.png",                         BigImageUrl = "ms-appx:///Assets/Images/Icons/folder.png",                         FileUrl = strPath,                         CreateTime = strDate                     });                 }

}

}

问题补充:

错误信息:未处理InvalidoperationException

在意外的时间调用了方法(异常来自: HRESULT: Ox8000000E)

zihaobiao的主页 zihaobiao | 初学一级 | 园豆:200
提问于:2013-04-17 09:29
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册