private static async Task<IEnumerable<ReportItem>> GetSpooledReportsAsync()
{
IStorageFile file = null;
try
{
file = await ApplicationData.Current.TemporaryFolder.GetFileAsync(BackgroundSyncTask.SpoolFilename);
}
catch (FileNotFoundException)
{
return null;
}
// load...
try
{
var json = await FileIO.ReadTextAsync(file);
return JsonConvert.DeserializeObject<IEnumerable<ReportItem>>(json);
}
finally
{
// delete the file - we have to do this regardless, but we can't await here...
file.DeleteAsync();
}
}