Exemple #1
0
 public ResultsTemplate(FilmResult film, String searchString)
 {
     InitializeComponent();
     Film = film;
     SearchString = searchString;
     populate();
     lbl_filepath.Text = Film.FilmPath;
 }
Exemple #2
0
        private void ExecuteScan(string url)
        {
            var bg = new BackgroundWorker();
            bg.WorkerReportsProgress = true;
            panel1.Enabled = false;
            panel2.Visible = true;
            bg.DoWork += (s, ee) =>
                             {
                                 var worker = s as BackgroundWorker;
                                 worker.ReportProgress(100, ImdbFilm.GetFilmByUrl(url));
                             };
            bg.ProgressChanged += (s, ee) =>
                                      {
                                          if (ee.UserState != null)
                                          {
                                              var path = Film.FilmPath;
                                              var error = Film.PossibleErrors;
                                              Film = new FilmResult((Film) ee.UserState)
                                                         {
                                                             FilmPath = path,
                                                             PossibleErrors = error
                                                         };
                                          }
                                          else if (
                                              MessageBox.Show("No film found!\n Check URL!", "Error",
                                                              MessageBoxButtons.RetryCancel, MessageBoxIcon.Error,
                                                              MessageBoxDefaultButton.Button2) == DialogResult.Retry)
                                          {
                                              Scan(url);
                                          }
                                      };
            bg.RunWorkerCompleted += (s, ee) =>
                                         {
                                             populate();
                                             panel1.Enabled = true;
                                         };

            bg.RunWorkerAsync();
        }
Exemple #3
0
 void AddFilm(FilmResult film)
 {
     if (!_filmDic.ContainsKey(film.FilmPath))
         _filmDic[film.FilmPath] = film;
 }
Exemple #4
0
 private void ShowControl(FilmResult film, string title)
 {
     _cont = new ResultsTemplate(film, title);
     panel1.Controls.Add(_cont);
     _cont.Dock = DockStyle.Fill;
 }
Exemple #5
0
 void ReplaceFilm(FilmResult film, String path)
 {
     if (_filmDic.ContainsKey(path))
         _filmDic[path] = film;
 }
Exemple #6
0
 private void GrapFilms(object sender, List<PossibleFilm> films)
 {
     var worker = sender as BackgroundWorker;
     var numFilms = films.Count;
     var count = 1;
     foreach (var film in films)
     {
         if (UClosePending)
             return;
         var percent = (count++/(double) numFilms)*100;
         worker.ReportProgress((int)percent,film.Path);
         var newFilm = ImdbFilm.GetFilmByName(film.Title);
         if (newFilm != null)
         {
             newFilm.FilmPath = film.Path;
             if(Regex.IsMatch(newFilm.Title,film.Title.Trim(),RegexOptions.IgnoreCase))
             {
                 _films.Add(new FilmResult(newFilm)
                                {
                                    PossibleErrors = false
                                });
             }
             else
             {
                 var f = new FilmResult(newFilm)
                             {
                                 PossibleErrors = true
                             };
                 _films.Add(f);
             }
         }
         else
         {
             var f = new FilmResult()
                         {
                             FilmPath = film.Path,
                             PossibleErrors = null
                         };
             _films.Add(f);
         }
     }
 }