public async Task FetchFullDownloadableDataIntoDatabase( string exhibitId, int idForRestApi, CancellationToken token, IProgressListener listener) { double totalSteps = await FetchNeededMediaForFullExhibit(idForRestApi); if (token.IsCancellationRequested) { return; } listener.SetMaxProgress(totalSteps); // We need to attach all images since the quiz download may download existing images var itemsToTrack = DbManager .DataAccess .GetItems <Image>() .Where(image => image.Id != BackupData.BackupImage.Id && image.Id != BackupData.BackupImageTag.Id); await mediaDataFetcher.FetchMedias(requiredMedia, token, listener); var quizzes = await DownloadQuizes(idForRestApi, token); var mediaToFilePath = await mediaDataFetcher.WriteMediaToDiskAsync(); DbManager.InTransaction(itemsToTrack, transaction => { ProcessPages(exhibitId, token, transaction.DataAccess, mediaToFilePath); transaction.DataAccess.Quizzes().Add(quizzes); if (token.IsCancellationRequested) { transaction.Rollback(); } }); }
public async Task FetchMediaData(CancellationToken token, IProgressListener listener) { await mediaDataFetcher.FetchMedias(requiredExhibitImages, token, listener); }
private async Task FetchMediaData(CancellationToken token, IProgressListener listener) { await mediaDataFetcher.FetchMedias(requiredMedia, token, listener); }