public async void GetReviewsByUser() { var list = await connectionHandler.DownloadReviewList(); ReviewsList.Clear(); foreach (var review in list) { var stream = await connectionHandler.DownloadThumbnail(review.id); using (var memoryStream = new MemoryStream()) { stream.CopyTo(memoryStream); var bytes = memoryStream.ToArray(); var imgSrc = ImageSource.FromStream(() => new MemoryStream(bytes)); var menuItem = new ReviewMenuItem(review.id, review.userId, review.appId, review.category, review.temporalContext, review.spatialContext, review.socialContext, review.textReview, review.createdAt, review.updatedAt, review.imagePath, imgSrc); ReviewsList.Add(menuItem); } } }
public async Task Init() { List <MReview> restoranReviews = null; if (Restoran != null && Produkt == null) { restoranReviews = await _reviewsService.Get <List <MReview> >(new ReviewSearchRequest { RestoranId = Restoran.RestoranId }); } else if (Produkt != null && Restoran == null) { restoranReviews = await _reviewsService.Get <List <MReview> >(new ReviewSearchRequest { ProduktId = Produkt.ProduktiId }); } ReviewsList.Clear(); foreach (var x in restoranReviews) { ReviewsList.Add(x); } }
public async Task Init() { await Recommend(); int maximum = await Helper.numInStorage(Product.Id); if (Quantity == 0) { _isAvailable = false; } WishlistsSearchRequest requestWish = new WishlistsSearchRequest { ProductId = Product.Id, UserId = User.Id }; try { ICollection <Wishlists> wishlist = await _wishlistsService.Get <ICollection <Wishlists> >(requestWish); if (wishlist.Count == 0) { IsToggled = false; } else { isFirstTime = true; IsToggled = true; } } catch (Exception ex) { IsToggled = false; } ReviewsSearchRequest requestAll = new ReviewsSearchRequest { ProductId = Product.Id }; var listAll = await _reviewsService.Get <IEnumerable <Reviews> >(requestAll); ReviewsList.Clear(); foreach (var item in listAll) { if (item.Description.Equals("")) { item.Description = NO_CONTENT; } ReviewsList.Add(item); } ReviewsSearchRequest requestUser = new ReviewsSearchRequest { ProductId = Product.Id, UserId = User.Id }; var listUser = await _reviewsService.Get <ICollection <Reviews> >(requestUser); ReviewsListUser.Clear(); foreach (var item in listUser) { if (item.Description.Equals("")) { item.Description = NO_CONTENT; } ReviewsListUser.Add(item); } }
private void OnLoginStateChanged(object sender, EventArgs e) { ReviewsList.Clear(); GetReviewsByUser(); }