Example #1
0
        public void loadMovies(int loadCount)
        {
            for (int i = 0; i < loadCount; i++)
            {
                BackGroundWorker.RunWorkAsync <object[]>(() => FetchMovieData(), (movie) =>
                {
                    if (movie.Length <= 0)
                    {
                        return;
                    }
                    else if ((ctrlMoviesPoster)movie[0] == null)
                    {
                        return;
                    }

                    ctrlMoviesPoster ctrlPoster = (ctrlMoviesPoster)movie[0];
                    string ImdbID = (string)movie[1];

                    ctrlPoster.Show();
                    ctrlPoster.Name = ImdbID;
                    panelMovies.Controls.Add(ctrlPoster);
                });
            }

            tab.SelectedTab = tabMovies;
        }
Example #2
0
 public void loadMovies(int count)
 {
     MoviesPosters = new List <ctrlMoviesPoster>();
     BackGroundWorker.RunWorkAsync <List <ctrlMoviesPoster> >(() => LoadMovies(count), (data) =>
     {
         if (panelMovies.InvokeRequired)
         {
             loadMoviesCallBack b = new loadMoviesCallBack(loadMovies);
             Invoke(b, new object[] { count });
         }
         else
         {
             foreach (ctrlMoviesPoster item in data)
             {
                 panelMovies.Controls.Add(item);
             }
             tab.SelectedTab = tabMovies;
         }
     });
 }