public MainPage() { this.InitializeComponent(); var Service = new KodiService(); var movieParams = new GetMoviesParams() { Properties = MovieProperties.All() }; var movies = Service.GetMovies(movieParams); for (int i = 0; i < 50; i++) { var row = movies.Result.Movies[i]; ListViewItem item = new ListViewItem(); item.Content = new Grid(); Grid grid = (Grid)item.Content; grid.Height = 100; grid.Margin = new Thickness(0, 0, 0, 0); ColumnDefinition col1 = new ColumnDefinition(); ColumnDefinition col2 = new ColumnDefinition(); col1.Width = new GridLength(0, GridUnitType.Auto); col2.Width = new GridLength(1, GridUnitType.Star); grid.ColumnDefinitions.Add(col1); grid.ColumnDefinitions.Add(col2); Image image = new Image(); BitmapImage bitmap = new BitmapImage(); string uriUnescape = Uri.UnescapeDataString(row.Art.Poster).ToString(); bitmap.UriSource = new Uri(uriUnescape.Substring(8, uriUnescape.Length - 9)); image.Source = bitmap; image.Margin = new Thickness(0, 0, 5, 0); RichTextBlock richTextBlock = new RichTextBlock(); richTextBlock.TextWrapping = TextWrapping.Wrap; Paragraph paragraph1 = new Paragraph(); Paragraph paragraph2 = new Paragraph(); Run title = new Run(); Run plot = new Run(); title.Text = $"{row.Title} ({row.Year})"; title.FontWeight = FontWeights.Bold; plot.Text = row.Plot; paragraph1.Inlines.Add(title); paragraph2.Inlines.Add(plot); richTextBlock.Blocks.Add(paragraph1); richTextBlock.Blocks.Add(paragraph2); grid.Children.Add(image); grid.Children.Add(richTextBlock); Grid.SetColumn(image, 0); Grid.SetColumn(richTextBlock, 1); MediaList.Items.Add(item); } }
public DisplayView() { this.InitializeComponent(); var Service = new KodiService(); var movieParams = new GetMoviesParams() { Properties = MovieProperties.All() }; var movies = Service.GetMovies(movieParams); }
public void WhenGettingAllMovies_ItShouldReturnAListOfMovies() { var service = new KodiService(); var parameters = new GetMoviesParams { Properties = new[] { MovieProperties.Title, MovieProperties.Year } }; var details = service.GetMovies(parameters); Assert.IsNotNull(details); Assert.IsNotNull(details.Result); Assert.Greater(details.Result.Movies.Count, 0); Assert.IsInstanceOf <List <Movie> >(details.Result.Movies); }
public void WhenGettingAllMovies_WithALimitOf0And1_ItShouldReturnAListWithOneMovie() { var service = new KodiService(); var parameters = new GetMoviesParams { Properties = new[] { MovieProperties.Title }, Limits = new Limits { Start = 0, End = 1 } }; var details = service.GetMovies(parameters); Assert.IsNotNull(details); Assert.IsNotNull(details.Result); Assert.That(details.Result.Movies.Count, Is.EqualTo(1)); Assert.IsInstanceOf <List <Movie> >(details.Result.Movies); }