private void printRecommendMovies() { List <ImageBrush> brushes = new List <ImageBrush>(); for (int i = 0; i < 5; i++) { string posterUrl = JsonLib.findPosterUrl(db.recommendMovies[i], movieInfos); if (posterUrl.Equals("")) { brushes.Add(null); continue; } BitmapImage bitmapImg = new BitmapImage(new Uri(posterUrl, UriKind.RelativeOrAbsolute)); ImageBrush brush = new ImageBrush(); brush.ImageSource = bitmapImg; brushes.Add(brush); } rePoster1.Background = brushes[0]; rePoster2.Background = brushes[1]; rePoster3.Background = brushes[2]; rePoster4.Background = brushes[3]; rePoster5.Background = brushes[4]; }
private void printMovies(List <string> list) { List <ImageBrush> brushes = new List <ImageBrush>(); for (int i = 0; i < list.Count; i++) { string posterUrl = JsonLib.findPosterUrl(list[i], movieInfos); if (posterUrl.Equals("")) { brushes.Add(null); continue; } BitmapImage bitmapImg = new BitmapImage(new Uri(posterUrl, UriKind.RelativeOrAbsolute)); ImageBrush brush = new ImageBrush(); brush.ImageSource = bitmapImg; brushes.Add(brush); } btnMv1.Background = brushes[0]; btnMv2.Background = brushes[1]; btnMv3.Background = brushes[2]; btnMv4.Background = brushes[3]; btnMv5.Background = brushes[4]; btnMv6.Background = brushes[5]; btnMv7.Background = brushes[6]; btnMv8.Background = brushes[7]; btnMv9.Background = brushes[8]; btnMv10.Background = brushes[9]; }
private void InitMovie(string extraData) { db = new MovieDB(); // get title from Page1.xaml db.title = extraData; db.url = JsonLib.findMovieUrl(db.title, movieInfos); db.posterUrl = JsonLib.findPosterUrl(db.title, movieInfos); // init name of label(=mvName) mvName.Content = db.title; // load movie Uri url = new Uri(db.url); webBrowser.Navigate(url.AbsoluteUri); }