public override async Task ProcessActivityAsync(IStatus status) { var updateWishlistTask = await statusController.CreateAsync(status, "Update Wishlisted"); var requestContentTask = await statusController.CreateAsync(updateWishlistTask, "Request content"); var wishlistedProductPageResult = await getProductsPageResultDelegate.GetDeserializedAsync( requestContentTask, Uris.Paths.Account.Wishlist); await statusController.CompleteAsync(requestContentTask); var saveDataTask = await statusController.CreateAsync(updateWishlistTask, "Save"); foreach (var product in wishlistedProductPageResult.Products) { if (product == null) { continue; } await wishlistedDataController.CreateAsync(product.Id, saveDataTask); } await statusController.CompleteAsync(saveDataTask); await wishlistedDataController.CommitAsync(updateWishlistTask); await statusController.CompleteAsync(updateWishlistTask); }
public override async Task ProcessActivityAsync(IStatus status) { var updateProductsTask = await statusController.CreateAsync(status, $"Update {updateTypeDescription}"); // We'll limit detail updates to user specified ids. // if user didn't provide a list of ids - we'll use the details gaps // (ids that exist in master list, but not detail) and updated var productsUpdateList = await itemizeUserRequestedOrDefaultAsyncDelegate.ItemizeAllAsync(updateProductsTask); var currentProduct = 0; foreach (var id in productsUpdateList) { var product = await masterDataController.GetByIdAsync(id, updateProductsTask); if (product == null) { continue; } await statusController.UpdateProgressAsync( updateProductsTask, ++currentProduct, productsUpdateList.Count(), product.Title); var updateIdentity = getUpdateIdentityDelegate.GetUpdateIdentity(product); if (string.IsNullOrEmpty(updateIdentity)) { continue; } var uri = string.Format( getUpdateUriDelegate.GetUpdateUri(context), updateIdentity); var data = await getDeserializedDelegate.GetDeserializedAsync(updateProductsTask, uri); if (data != null) { fillGapsDelegate?.FillGaps(data, product); await detailDataController.UpdateAsync(data, updateProductsTask); } } await detailDataController.CommitAsync(updateProductsTask); await statusController.CompleteAsync(updateProductsTask); }
public async Task <GameProductData> GetDeserializedAsync(IStatus status, string uri, IDictionary <string, string> parameters = null) { var gogData = await gogDataGetDeserializedDelegate.GetDeserializedAsync(status, uri, parameters); return(gogData.GameProductData); }