public static void OnCallback(object s, HtmlDocumentLoadCompleted htmlDocumentLoadCompleted) { if (thereIsNoErrors(htmlDocumentLoadCompleted)) { var htmlDocument = htmlDocumentLoadCompleted.Document; HtmlNodeCollection catalogItems = htmlDocument.DocumentNode.SelectNodes( "//*[@class='catalog_item_middle_center']//a[starts-with(@href,'/films/movie/id')]//img[starts-with(@src,'http://')]"); tempList = new List<FilmData>(); if (catalogItems != null) { foreach (HtmlNode item in catalogItems) { FilmData fd = new FilmData(); if (item.Attributes.Contains("src")) { fd.imageUrl = item.Attributes["src"].Value; } if (item.Attributes.Contains("alt")) { fd.name = item.Attributes["alt"].Value.Substring(6); } tempList.Add(fd); } Networking.getImagesAsync(tempList); } } }
public static void setImageUrlToCashedFile(FilmData fd, string url) { Image image = ImageHelper.getImage(url); if (image != null && image.Source != null) { BitmapImage tn = new BitmapImage(); tn = (BitmapImage)image.Source; if (tn.UriSource.IsAbsoluteUri) fd.imageUrl = tn.UriSource.AbsoluteUri.ToString(); } }