Esempio n. 1
0
        public void ImdbSyncBackgroundOperation(object args)
        {
            List<MovieIMDB> movies = (List<MovieIMDB>)args;
            int count = 0;

            foreach (MovieIMDB movie in movies)
            {
                IMDBOperations iOps = new IMDBOperations(movie);
                count++;
                // Report progress as a percentage of the total task.
                int percentComplete = (int)((float)count / (float)movies.Count * 100);
                if (percentComplete > highestPercentageReached)
                {
                    highestPercentageReached = percentComplete;
                    try
                    {
                        this.BeginInvoke(this.ImdbSyncDelegate, percentComplete, iOps.status, iOps.iMov);
                    }
                    catch (InvalidOperationException)
                    { return; }
                }
            }
        }
Esempio n. 2
0
 private void LoadMovieDataFromInternet(MovieIMDB movie)
 {
     IMDBOperations iOps = new IMDBOperations(movie);
     if (iOps.status == true)
     {
         iMov = iOps.iMov;
         DisplayIMovieData();
     }
 }
Esempio n. 3
0
 private void LoadMovieDataFromInternet(string movieNameKeywords)
 {
     IMDBOperations iOps = new IMDBOperations(movieNameKeywords);
     if (iOps.status == true)
     {
         iMov = iOps.iMov;
         if (mov != null)
             iMov.Language = mov.Language;
         DisplayIMovieData();
         btnAddMovie.Enabled = btnOpenInIE.Enabled = true;
     }
 }
Esempio n. 4
0
 private void LoadMovieDataFromInternet()
 {
     Regex regex = new Regex(@"(\.)|(-)|(\[)|(\])|(\s{2,})");
     string movieNameForSearch = regex.Replace(movieName, match =>
     {
         switch (match.ToString())
         {
             case ".":
             case "-":
             case "[":
             case "]":
                 return " ";
             case "  ":
             case "   ":
             case "    ":
                 return "";
         }
         return match.ToString();
     });
     IMDBOperations iOps = new IMDBOperations(movieNameForSearch);
     if (iOps.status == true)
     {
         iMov = iOps.iMov;
         iMov.Language = mov.Language;
     }
     else
     {
         this.Close();
         //MessageBox.Show("Error while getting information ! " + Environment.NewLine + iOps.errorMsg, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 5
0
        public void ImdbSyncBackgroundOperation(object args)
        {
            List<Movie> movies = (List<Movie>)args;
            int count = 0;

            foreach (Movie movie in movies)
            {
                Regex regex = new Regex(@"(\.)|(-)|(\[)|(\])|(\s{2,})");
                string movieNameForSearch = regex.Replace(movie.Name, match =>
                {
                    switch (match.ToString())
                    {
                        case ".":
                        case "-":
                        case "[":
                        case "]":
                            return " ";
                        case "  ":
                        case "   ":
                        case "    ":
                            return "";
                    }
                    return match.ToString();
                });
                IMDBOperations iOps = new IMDBOperations(movieNameForSearch);
                count++;
                // Report progress as a percentage of the total task.
                int percentComplete = (int)((float)count / (float)movies.Count * 100);
                if (percentComplete > highestPercentageReached)
                {
                    highestPercentageReached = percentComplete;
                    try
                    {
                        this.BeginInvoke(this.ImdbSyncDelegate, percentComplete, iOps.status, movie, iOps.iMov);
                    }
                    catch (InvalidOperationException)
                    { return; }
                }
            }
        }