Esempio n. 1
0
        public IMDBResultsList(IList <ImdbResult> results, String title)
        {
            _results = results;
            InitializeComponent();
            Text = "IMDB results - " + title;
            var il    = new ImageList();
            var count = 0;

            listView1.View           = View.Tile;
            il.ImageSize             = new Size(32, 32);
            listView1.LargeImageList = il;
            foreach (var imdbResult in results)
            {
                ListViewItem item;
                if (imdbResult.PicUrl != "/images/b.gif" && !String.IsNullOrEmpty(imdbResult.PicUrl))
                {
                    var pic = new DownloadImage(imdbResult.PicUrl);
                    pic.Download();
                    il.Images.Add(pic.GetImage());
                    item = new ListViewItem(new[] { imdbResult.Title, imdbResult.Year, imdbResult.IMDBIDUrl })
                    {
                        ImageIndex = count++
                    };
                }
                else
                {
                    il.Images.Add(Properties.Resources.no_image);
                    item = new ListViewItem(new[] { imdbResult.Title, imdbResult.Year, imdbResult.IMDBIDUrl })
                    {
                        ImageIndex = count++
                    };
                }
                listView1.Items.Add(item);
            }
        }
Esempio n. 2
0
        private void loadPicture(object sender, DoWorkEventArgs e)
        {
            var    worker = sender as BackgroundWorker;
            var    hw     = new HtmlWeb();
            var    doc    = hw.Load(_url).DocumentNode.WriteContentTo();
            var    p      = doc.IndexOf("<img src=\"http://ia.media-IMDB.com");
            var    pp     = doc.IndexOf("<img src=\"http://ia.media-imdb.com");
            string picURL = null;

            if (p != -1)
            {
                picURL = doc.Remove(0, p + 10);
            }
            else if (pp != -1)
            {
                picURL = doc.Remove(0, pp + 10);
            }
            if (picURL != null)
            {
                picURL = picURL.Remove(picURL.IndexOf("\""));
                var pic = new DownloadImage(picURL);
                pic.Download();
                pictureBox1.Image    = pic.GetImage();
                pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            }
            worker.ReportProgress(100);
        }
Esempio n. 3
0
        private ImageList GetImageList(Film film)
        {
            var nil = new ImageList {
                ImageSize = new Size(32, 32)
            };

            for (int i = 0; i < _il.Images.Count; i++)
            {
                if (i == _previousIndex)
                {
                    if (film.PicURL != "/images/b.gif" && !string.IsNullOrEmpty(film.PicURL))
                    {
                        var pic = new DownloadImage(film.PicURL);
                        pic.Download();
                        nil.Images.Add(pic.GetImage() ?? Properties.Resources.no_image);
                    }
                    else
                    {
                        nil.Images.Add(Properties.Resources.no_image);
                    }
                }
                else
                {
                    nil.Images.Add(_il.Images[i]);
                }
            }
            return(nil);
        }
Esempio n. 4
0
        private void loadPicture(object sender, DoWorkEventArgs e)
        {
            var worker = sender as BackgroundWorker;

            if (_film.PicURL != null)
            {
                var pic = new DownloadImage(_film.PicURL);
                pic.Download();
                pb_Filmposter.Image    = pic.GetImage();
                pb_Filmposter.SizeMode = PictureBoxSizeMode.StretchImage;
            }
            worker.ReportProgress(100);
        }
Esempio n. 5
0
        public void PopulateList()
        {
            listView1.Groups.Clear();
            listView1.Items.Clear();
            var count = 0;

            listView1.Groups.Add(new ListViewGroup("Films"));
            listView1.Groups.Add(new ListViewGroup("Possible Errors"));
            listView1.Groups.Add(new ListViewGroup("Not Found"));
            listView1.View           = View.Tile;
            _il.ImageSize            = new Size(32, 32);
            listView1.LargeImageList = _il;
            foreach (var film in _filmDic.Values)
            {
                ListViewItem item;
                if (film.PicURL != "/images/b.gif" && !string.IsNullOrEmpty(film.PicURL))
                {
                    var pic = new DownloadImage(film.PicURL);
                    pic.Download();
                    var picture = pic.GetImage();
                    _il.Images.Add(picture ?? Properties.Resources.no_image);
                    item = new ListViewItem(new[] { film.Title, film.ReleaseYear, film.FilmPath })
                    {
                        ImageIndex = count++
                    };
                }
                else
                {
                    _il.Images.Add(Properties.Resources.no_image);
                    item = new ListViewItem(new[] { film.Title, film.ReleaseYear, film.FilmPath })
                    {
                        ImageIndex = count++
                    };
                }
                if (film.PossibleErrors.HasValue)
                {
                    item.Group = film.PossibleErrors.Value ? listView1.Groups[1] : listView1.Groups[0];
                }
                else
                {
                    item.SubItems[0].Text = film.FilmPath;
                    item.SubItems[1].Text = "";
                    item.SubItems[2].Text = film.FilmPath;
                    item.Group            = listView1.Groups[2];
                }
                listView1.Items.Add(item);
            }
        }