private void RefreshRecentlyViewed() { var rh = new RecentHelper(); var items = rh.GetRecentItems(); lstRecentItems.DataContext = items; }
private void btnClearRecent_Click(object sender, RoutedEventArgs e) { var rh = new RecentHelper(); rh.ClearRecentItems(); RefreshRecentlyViewed(); }
private async void RefreshProductData() { try { var api = new ArgosAPI(); var result = await api.GetProductDetails(ProductId); if (result == null) { MessageBox.Show("Unable to find product with the id " + ProductId, "error finding product", MessageBoxButton.OK); if (NavigationService.CanGoBack) { NavigationService.GoBack(); } return; } ViewModel.Description = result.Description; ViewModel.Title = result.Title; ViewModel.PreviewImageUrl = result.PreviewImageUrl; ViewModel.Id = result.Id; ViewModel.PriceFormatted = result.PriceFormatted; ViewModel.WasPriceFormatted = result.WasPriceFormatted; ViewModel.Promotions = result.Promotions; var image = result.Images.FirstOrDefault(x => x.Type == "largeImage"); if (image != null) { ViewModel.LargeImageUrl = image.Url; } if (result.Images.Any(x => x.Type == "video")) { ViewModel.Videos = result.Images.Where(x => x.Type == "video" && x.Application == "video/mp4").Select(x => new VideoThumbnail() { Thumbnail = image.Url, Url = x.Url }).ToList(); } if (result.Images.Any(x => x.Type == "image")) { ViewModel.ProductImages = result.Images.Where(x => x.Type == "image").Select(x => x.Url).ToList(); } var rh = new RecentHelper(); rh.AddRecentItem(ViewModel); } catch (Exception e) { Console.WriteLine(e); } }