当前位置: 首页>>代码示例>>C#>>正文


C# StorageFolder.GetBasicPropertiesAsync方法代码示例

本文整理汇总了C#中Windows.Storage.StorageFolder.GetBasicPropertiesAsync方法的典型用法代码示例。如果您正苦于以下问题:C# StorageFolder.GetBasicPropertiesAsync方法的具体用法?C# StorageFolder.GetBasicPropertiesAsync怎么用?C# StorageFolder.GetBasicPropertiesAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.Storage.StorageFolder的用法示例。


在下文中一共展示了StorageFolder.GetBasicPropertiesAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateFolder

        async Task UpdateFolder(StorageFolder storageFolder)
        {
            var folder = await databaseConnection.Table<Folder>().Where(p => p.Path == storageFolder.Path).FirstOrDefaultAsync();

            if (folder == null)
            {
                folder = new Folder() { LastUpdateTime = DateTime.Now, CheckedToday = true, Path = storageFolder.Path };
                await databaseConnection.InsertAsync(folder);

                await UpdateFilesInFolder(folder.Id, storageFolder);
            }
            else
            {
                var dateChanged = (await storageFolder.GetBasicPropertiesAsync()).DateModified;
                if (dateChanged > folder.LastUpdateTime)
                {
                    await UpdateFilesInFolder(folder.Id, storageFolder);
                    folder.LastUpdateTime = DateTime.Now;
                }

                folder.CheckedToday = true;
                await databaseConnection.UpdateAsync(folder);
            }

            foreach (var subFolder in await storageFolder.GetFoldersAsync())
                await UpdateFolder(subFolder);
        }
开发者ID:JulianMH,项目名称:music-3,代码行数:27,代码来源:LocalLibrarySource.cs

示例2: UpdateFilesInFolder

        private async Task UpdateFilesInFolder(int folderId, StorageFolder storageFolder)
        {
            var files = await databaseConnection.Table<File>().Where(p => p.FolderId == folderId).ToListAsync();

            foreach (var storageFile in await storageFolder.GetFilesAsync())
            {
                var file = files.Where(p => p.Path == storageFile.Path).FirstOrDefault();

                if (file == null)
                {
                    await databaseConnection.InsertAsync(new File() { LastUpdateTime = DateTime.Now, FolderId = folderId, Path = storageFile.Path });

                    await AddSong(storageFile);
                }
                else
                {
                    files.Remove(file);

                    var dateChanged = (await storageFolder.GetBasicPropertiesAsync()).DateModified;
                    if (dateChanged > file.LastUpdateTime)
                    {
                        await RemoveSong(storageFile.Path);
                        await AddSong(storageFile);

                        file.LastUpdateTime = DateTime.Now;
                        await databaseConnection.UpdateAsync(file);
                    }

                }
            }
        }
开发者ID:JulianMH,项目名称:music-3,代码行数:31,代码来源:LocalLibrarySource.cs


注:本文中的Windows.Storage.StorageFolder.GetBasicPropertiesAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。