예제 #1
0
파일: Form1.cs 프로젝트: war-man/Movie-app
 private void setAllCastsForMovie()
 {
     try {
         casts = dbController.getAllCastsForMovie(Int32.Parse(((DataRowView)movieBindingSource.Current).Row["id"].ToString()));
     }
     catch (Exception t)
     {}
 }
예제 #2
0
        private void displayMovieContent(MovieConnector.Movie m)
        {
            contentIsNotAvailable.Visibility = Visibility.Hidden;
            clearListBoxCast();
            int numObj = 2;

            if (m != null)
            {
                textBoxSearch.Text = m.Title;
                Grid grid = new Grid();
                grid.Height = 478;
                grid.Width  = 844;
                var bc = new BrushConverter();
                grid.Background = (Brush)bc.ConvertFrom("#FF212121");
                GridSplitter gridSplitter = new GridSplitter();
                gridSplitter.HorizontalAlignment = HorizontalAlignment.Left;
                gridSplitter.VerticalAlignment   = VerticalAlignment.Top;
                gridSplitter.Height     = 430;
                gridSplitter.Width      = 3;
                gridSplitter.Margin     = new Thickness(252, 13, 0, 0);
                gridSplitter.Background = (Brush)bc.ConvertFrom("#FFBCBCBC");
                grid.Children.Add(gridSplitter);
                //Images
                int numImage = 1;
                //Image1
                grid.Children.Add(drawImage(numObj + "" + numImage++, "http://image.tmdb.org/t/p/w185/" + m.PosterPath, 301, 290, new int[] { 20, 15, 0, 0 }, m.Image));
                //Image2
                grid.Children.Add(drawImage(numObj + "" + numImage++, "pack://siteoforigin:,,,/files/ic_stars_white_48dp_2x.ico", 21, 21, new int[] { 295, 65, 0, 0 }, null));
                //Image3
                grid.Children.Add(drawImage(numObj + "" + numImage++, "pack://siteoforigin:,,,/files/ic_timer_white_48dp_2x.ico", 21, 21, new int[] { 390, 65, 0, 0 }, null));
                //TextBlocks
                int    numTextBlock = 1;
                string text         = "";
                //textBlock1
                grid.Children.Add(drawTextBlock(numObj + "" + numTextBlock++, m.Title + " (" + m.ReleaseDate.ToString("yyyy") + ")", "#FFE9E9E9", FontWeights.Bold, 18, new int[] { 288, 10, 0, 0 }, new int[] { 9, 0, 0, 0 }, 31, 551));
                //textBlock2
                text = "Genres: " + m.Genre;
                grid.Children.Add(drawTextBlock(numObj + "" + numTextBlock++, text, "#FFBCBCBC", FontWeights.Bold, 14, new int[] { 288, 42, 0, 0 }, new int[] { 9, 0, 0, 0 }, -1, -1));
                //textBlock3
                TextBlock textBlock = drawTextBlock(numObj + "" + numTextBlock++, "", "#FFE9E9E9", FontWeights.Bold, -1, new int[] { 325, 65, 0, 0 }, null, -1, -1);
                Run       run       = new Run(m.VoteAverage.ToString());
                run.Foreground = (Brush)bc.ConvertFrom("#FFBBBB57");
                textBlock.Inlines.Add(run);
                run = new Run("/10");
                textBlock.Inlines.Add(run);
                grid.Children.Add(textBlock);
                //textBlock4
                grid.Children.Add(drawTextBlock(numObj + "" + numTextBlock++, m.Runtime.ToString() + " min", "#FFE9E9E9", FontWeights.Bold, 14, new int[] { 410, 65, 0, 0 }, new int[] { 9, 0, 0, 0 }, -1, -1));
                //textBlock5
                grid.Children.Add(drawTextBlock(numObj + "" + numTextBlock++, "Release Date: (" + m.ReleaseDate.ToString("MMMM dd, yyyy") + ")", "#FFBCBCBC", FontWeights.Bold, 14, new int[] { 288, 90, 0, 0 }, new int[] { 9, 0, 0, 0 }, 170, 420));

                WrapPanel wrapPanel = new WrapPanel();
                wrapPanel.Width  = 450;
                wrapPanel.Margin = new Thickness(200, 120, 0, 0);
                //textBlock6
                wrapPanel.Children.Add(drawTextBlock(numObj + "" + numTextBlock++, "Storyline: \n" + m.Overview + "\n\nCasts:", "#FFBCBCBC", FontWeights.Bold, 14, null, null, -1, 420));

                List <MovieConnector.Cast> casts;
                if (m.Casts == null)
                {
                    casts = dbController.getAllCastsForMovie(m.Id);
                }
                else
                {
                    casts = m.Casts;
                }

                if (casts.Count != 0)
                {
                    foreach (MovieConnector.Cast cast in casts)
                    {
                        Grid crewMember = new Grid();
                        crewMember.Width  = 400;
                        crewMember.Height = 60;
                        crewMember.Children.Add(drawImage(numObj + "" + numImage++, "http://image.tmdb.org/t/p/w185/" + cast.ProfilePath, 60, -1, new int[] { 0, 10, 10, 0 }, cast.Image));
                        TextBlock crewName = new TextBlock();
                        crewName.MouseDown  += new MouseButtonEventHandler(castName_mouseDownHandler);
                        crewName.MouseEnter += new MouseEventHandler(castName_mouseOverHandler);
                        crewName.MouseLeave += new MouseEventHandler(castName_mouseLeaveHandler);
                        crewName.Text        = cast.Name;
                        crewName.Uid         = m.Id + "_" + cast.Id.ToString();
                        crewName.Margin      = new Thickness(80, 10, 0, 0);
                        crewName.Foreground  = new SolidColorBrush(Color.FromRgb(50, 153, 187));;
                        crewName.FontWeight  = FontWeights.Bold;
                        Label crewCharacter = new Label();
                        crewCharacter.Content    = cast.Character;
                        crewCharacter.Margin     = new Thickness(80, 25, 0, 0);
                        crewCharacter.Foreground = (Brush)bc.ConvertFrom("#FFBCBCBC");

                        crewMember.Children.Add(crewName);
                        crewMember.Children.Add(crewCharacter);
                        wrapPanel.Children.Add(crewMember);
                    }
                }


                grid.Children.Add(wrapPanel);
                //wrapPanel.Children.Add(grid);
                listBoxMovieContent.Items.Add(grid);
            }
        }