本文整理汇总了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);
}
示例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);
}
}
}
}