private void bwVideoBackgroundBox_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; DownloadManagerThreaded downMan = new DownloadManagerThreaded(); Image img = downMan.DownloadFromUrl(tbBoxUrl.Text, worker, e); e.Result = img; }
private void bgwCode_DoWork(object sender, DoWorkEventArgs e) { DownloadManagerThreaded downMan = new DownloadManagerThreaded(); BackgroundWorker worker = sender as BackgroundWorker; Image img = downMan.DownloadFromUrl("http://www.eztvix.info/Alpha.png", "There is a problem connecting to Internet. \r\nSome functions will not work properly!", worker, e); //e.Result = img; }
private void thumbCode_DoWork(object sender, DoWorkEventArgs e) { DownloadManagerThreaded downMan = new DownloadManagerThreaded(); BackgroundWorker worker = sender as BackgroundWorker; Image img = downMan.DownloadFromUrl("http://www.eztvix.info/Alpha.png", "", // means that the error message will not beeing displayed. worker, e); e.Result = img; }
public override Movie LoadMovie(XmlNode movieNode, BackgroundWorker worker, DoWorkProviderEventArgs e) { Movie movie = new Movie(); Dictionary <String, MoviePicture> dicoPics; String pictureID, pictureType; DownloadManagerThreaded downMan = new DownloadManagerThreaded(); if (this.Movie != null) { movie = this._movie; } movie.Node = movieNode; movie.ID = Convert.ToInt32(movieNode.SelectSingleNode("id").InnerText); movie.ID_Allocine = Convert.ToInt32(movieNode.SelectSingleNode("id_allocine").InnerText); movie.ID_IMDB = Convert.ToInt32(movieNode.SelectSingleNode("id_imdb").InnerText); movie.Url = movieNode.SelectSingleNode("url").InnerText; movie.Title = movieNode.SelectSingleNode("title").InnerText; movie.OriginalTitle = movieNode.SelectSingleNode("originaltitle").InnerText; movie.Plot = movieNode.SelectSingleNode("plot").InnerText; movie.Year = Convert.ToInt32(movieNode.SelectSingleNode("year").InnerText); movie.Runtime = Convert.ToInt32(movieNode.SelectSingleNode("runtime").InnerText); //_nodes = movieNode.SelectNodes("director"); try { foreach (XmlNode dir in movieNode.SelectNodes("directors/director")) { movie.Directors.Add(dir.InnerText); } } catch (Exception ex) { } try { foreach (XmlNode cast in movieNode.SelectNodes("casting/person ")) { //TODO Implement Actor OBJECT (directos would be the same) movie.Actors.Add( new Actor( Int32.Parse(cast.Attributes["id"].Value), cast.Attributes["name"].Value, cast.Attributes["character"].Value, Int32.Parse(cast.Attributes["idthumb"].Value), cast.Attributes["thumb"].Value ) ); } } catch (Exception ex) { } try { foreach (XmlNode rat in movieNode.SelectNodes("ratings/rating")) { movie.Ratings.Add(new Rating(rat.Attributes["type"].Value, rat.Attributes["votes"].Value, rat.InnerText)); } } catch (Exception ex) { } try { foreach (XmlNode genre in movieNode.SelectNodes("genres/genre")) { //movie.Ratings.Add(new Rating(rat.Attributes["type"].Value, rat.Attributes["votes"].Value, rat.InnerText)); movie.Genres.Add(genre.InnerText); } } catch (Exception ex) { } //int thumbCount = movieNode.SelectNodes("images/image[@type='Poster' and @size='thumb']").Count; movie.Posters.Clear(); //MTH : le clear vide l'objet movie... => obligation de reloader les images... TOO BAD movie.FanArts.Clear(); foreach (XmlNode img in movieNode.SelectNodes("images/image")) { pictureID = img.Attributes["id"].Value; pictureType = img.Attributes["type"].Value; if (pictureType.ToLower() == "poster") { #region --- poster dico --- try { movie.Posters.Add(pictureID, new MoviePicture()); } catch (Exception ex) { } movie.Posters[pictureID].Type = pictureType; movie.Posters[pictureID].Size = img.Attributes["size"].Value;; movie.Posters[pictureID].ID = int.Parse(pictureID); switch (img.Attributes["size"].Value.ToLower()) { case "original": movie.Posters[pictureID].Width = Convert.ToInt32(img.Attributes["width"].Value); movie.Posters[pictureID].Height = Convert.ToInt32(img.Attributes["height"].Value); movie.Posters[pictureID].UrlOriginal = img.Attributes["url"].Value.Replace(".peg", ".jpg"); break; case "preview": movie.Posters[pictureID].UrlPreview = img.Attributes["url"].Value.Replace(".peg", ".jpg"); break; case "thumb": movie.Posters[pictureID].UrlThumb = img.Attributes["url"].Value.Replace(".peg", ".jpg"); if (!(movie.Posters[pictureID].ThumbLoaded)) { movie.Posters[pictureID].Thumb = DownloadFromWebClient(movie.Posters[pictureID].UrlThumb); movie.Posters[pictureID].ThumbLoaded = true; } //worker.ReportProgress(pourcent); if (movie.ThumbCover == null) { movie.ThumbCover = movie.Posters[pictureID].Thumb; } this.ReportProgress(movie); this.ReportCoverProgress(movie); break; default: break; } #endregion } else { #region --- Fanart dico--- try { movie.FanArts.Add(pictureID, new MoviePicture()); } catch (Exception ex) { } movie.FanArts[pictureID].Type = pictureType; movie.FanArts[pictureID].Size = img.Attributes["size"].Value;; movie.FanArts[pictureID].ID = int.Parse(pictureID); switch (img.Attributes["size"].Value.ToLower()) { case "original": movie.FanArts[pictureID].Width = Convert.ToInt32(img.Attributes["width"].Value); movie.FanArts[pictureID].Height = Convert.ToInt32(img.Attributes["height"].Value); movie.FanArts[pictureID].UrlOriginal = img.Attributes["url"].Value; break; case "preview": movie.FanArts[pictureID].UrlPreview = img.Attributes["url"].Value; break; case "thumb": movie.FanArts[pictureID].UrlThumb = img.Attributes["url"].Value; if (!(movie.FanArts[pictureID].ThumbLoaded)) { movie.FanArts[pictureID].Thumb = DownloadFromWebClient(movie.FanArts[pictureID].UrlThumb); movie.FanArts[pictureID].ThumbLoaded = true; } this.ReportFanartProgress(movie); //if (movie.FanArts[pictureID].Type.ToLower() == "poster") // movie.FanArts[pictureID].Thumb = DownloadFromUrl(movie.FanArts[pictureID].Urlthumb); break; default: break; } #endregion } } dicoPics = new Dictionary <String, MoviePicture>(); return(movie); }
private void bwVideoBackgroundBox_loadCover() { DownloadManagerThreaded downMan = new DownloadManagerThreaded(); ImageTemplate _localImage = new ImageTemplate(); ResizeFilter _res = new ResizeFilter(); }