本文整理匯總了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);
}
}
}
}