void PrintText(object sender, SelectionChangedEventArgs args) { try { string curItem = List.SelectedItem.ToString(); film = film.SearchTitle(curItem, searchShortPlot); textBlock1.Text = "Title: " + film.Title; textBlock2.Text = "Year: " + film.Year; textBlock3.Text = "Rated: " + film.Rated; textBlock3.Text = "Released: " + film.Released; textBlock4.Text = "Runtime: " + film.Runtime; textBlock5.Text = "Genre: " + film.Genre; textBlock6.Text = "Director: " + film.Director; textBlock7.Text = "Writer: " + film.Writer; textBlock8.Text = "Actors: " + film.Actors; textBlock9.Text = "Plot: " + film.Plot; textBlock10.Text = "Language: " + film.Language; textBlock11.Text = "Country: " + film.Country; textBlock12.Text = "Awards: " + film.Awards; textBlock13.Text = "Poster: " + film.Poster; textBlock14.Text = "Metascore: " + film.Metascore; textBlock15.Text = "imdb rating: " + film.imdbRating; textBlock16.Text = "imdb votes: " + film.imdbVotes; textBlock17.Text = "imdb ID: " + film.imdbID; textBlock18.Text = "Type: " + film.Type; try //image loader { wrapper.Children.Clear(); Image img = new Image(); BitmapImage image = new BitmapImage(); image.BeginInit(); image.UriSource = new Uri(film.Poster, UriKind.Absolute); image.EndInit(); img.Source = image; wrapper.Children.Add(img); } catch { } try //comment loader { int x = 0; while (x < Favorite.Length) { string temp1 = Favorite[x]; char separatingChars = '^'; string[] words = temp1.Split(separatingChars); if (film.Title == words[0]) { textBox_comment.Text = words[1]; } x++; } } catch { } } catch { } }
private void OnKeyDownHandler(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { if (searchByImdb == true) { if (searchByFilm == true) { try { film = film.SearchTitle(textBox1.Text, searchShortPlot); } catch { MessageBox.Show("Invalid film name"); return; } } else { film = film.SearchID(textBox1.Text, searchShortPlot); } textBlock1.Text = "Title: " + film.Title; textBlock2.Text = "Year: " + film.Year; textBlock3.Text = "Rated: " + film.Rated; textBlock3.Text = "Released: " + film.Released; textBlock4.Text = "Runtime: " + film.Runtime; textBlock5.Text = "Genre: " + film.Genre; textBlock6.Text = "Director: " + film.Director; textBlock7.Text = "Writer: " + film.Writer; textBlock8.Text = "Actors: " + film.Actors; textBlock9.Text = "Plot: " + film.Plot; textBlock10.Text = "Language: " + film.Language; textBlock11.Text = "Country: " + film.Country; textBlock12.Text = "Awards: " + film.Awards; textBlock13.Text = "Poster: " + film.Poster; textBlock14.Text = "Metascore: " + film.Metascore; textBlock15.Text = "imdb rating: " + film.imdbRating; textBlock16.Text = "imdb votes: " + film.imdbVotes; textBlock17.Text = "imdb ID: " + film.imdbID; textBlock18.Text = "Type: " + film.Type; try { wrapper.Children.Clear(); Image img = new Image(); BitmapImage image = new BitmapImage(); image.BeginInit(); image.UriSource = new Uri(film.Poster, UriKind.Absolute); image.EndInit(); img.Source = image; wrapper.Children.Add(img); } catch { } } else { if (searchByFilm == true) { //Add search by film functionality } else { Movie desiredFilm = film2.SearchID(textBox1.Text); textBlock1.Text = "Title: " + desiredFilm.Title; textBlock2.Text = "Release date: " + desiredFilm.ReleaseDate.ToString(); textBlock3.Text = "Popularity: " + desiredFilm.Popularity.ToString(); textBlock4.Text = "Runtime: " + desiredFilm.Runtime.ToString(); textBlock5.Text = "Budget: " + desiredFilm.Budget.ToString(); textBlock6.Text = "Poster link: " + desiredFilm.PosterPath; textBlock7.Text = "Revenue: " + desiredFilm.Revenue.ToString(); textBlock8.Text = "Overview: " + desiredFilm.Overview; textBlock9.Text = "Original language: " + desiredFilm.OriginalLanguage; textBlock10.Text = "Keywords: " + desiredFilm.Keywords; textBlock11.Text = "Adult: " + desiredFilm.Adult.ToString(); textBlock12.Text = "Vote average: " + desiredFilm.VoteAverage.ToString(); textBlock13.Text = "Vote count: " + desiredFilm.VoteCount.ToString(); textBlock14.Text = ""; textBlock15.Text = ""; textBlock16.Text = ""; textBlock17.Text = ""; textBlock18.Text = ""; } } } }
void Button6(object sender, RoutedEventArgs e) { ImdbEntity movie = new ImdbEntity(); Random rnd = new Random(); bool repeatLoop = true; while (repeatLoop) { if (searchByImdb == true) { int one = rnd.Next(0, 10); int two = rnd.Next(0, 10); int three = rnd.Next(0, 10); int four = rnd.Next(0, 10); int five = rnd.Next(0, 10); int six = rnd.Next(0, 10); int seven = rnd.Next(0, 10); string id = "tt" + one + two + three + four + five + six + seven; movie = film.SearchID(id, searchShortPlot); if (movie.Title != "No such ID exists") { textBox1.Text = id; film = film.SearchID(id, searchShortPlot); textBlock1.Text = "Title: " + film.Title; textBlock2.Text = "Year: " + film.Year; textBlock3.Text = "Rated: " + film.Rated; textBlock3.Text = "Released: " + film.Released; textBlock4.Text = "Runtime: " + film.Runtime; textBlock5.Text = "Genre: " + film.Genre; textBlock6.Text = "Director: " + film.Director; textBlock7.Text = "Writer: " + film.Writer; textBlock8.Text = "Actors: " + film.Actors; textBlock9.Text = "Plot: " + film.Plot; textBlock10.Text = "Language: " + film.Language; textBlock11.Text = "Country: " + film.Country; textBlock12.Text = "Awards: " + film.Awards; textBlock13.Text = "Poster: " + film.Poster; textBlock14.Text = "Metascore: " + film.Metascore; textBlock15.Text = "imdb rating: " + film.imdbRating; textBlock16.Text = "imdb votes: " + film.imdbVotes; textBlock17.Text = "imdb ID: " + film.imdbID; textBlock18.Text = "Type: " + film.Type; try //image loader { wrapper.Children.Clear(); Image img = new Image(); BitmapImage image = new BitmapImage(); image.BeginInit(); image.UriSource = new Uri(film.Poster, UriKind.Absolute); image.EndInit(); img.Source = image; wrapper.Children.Add(img); } catch { } repeatLoop = false; } } } }