Exemple #1
0
 private void pb_Click(object sender, EventArgs e)
 {
     try
     {
         string localAppFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Personal TV Organiser\\";
         _seriesID = ((PosterButton.PosterButton)sender).SeriesID;
         Series series = _favourites[_seriesID];
         if (series != null)
         {
             _dbManager.OpenConnection();
             Series  seriesInfo  = _dbManager.GetSeriesInfo(series.SeriesID);
             Episode nextEpisode = _dbManager.GetNextEpisode(series.SeriesID);
             _dbManager.CloseConnection();
             if (series.Fanart != "")
             {
                 if (!File.Exists(string.Concat(new object[4] {
                     localAppFolder, series.SeriesID, "\\", series.Fanart.Replace("/original", "").Replace("/", "\\")
                 })))
                 {
                     _tvdbAPI.SaveFanartVignette(series.SeriesID, series.Fanart);
                 }
                 pbBackground.BackgroundImage = new Bitmap(string.Concat(new object[4] {
                     localAppFolder, series.SeriesID, "\\", series.Fanart.Replace("/original", "").Replace("/", "\\")
                 }));
             }
             else
             {
                 pbBackground.BackgroundImage = null;
             }
             lblName.Text         = series.SeriesName;
             lblYear.Text         = series.FirstAired.ToString("yyyy");
             lblRating.Text       = series.Rating.ToString() + "/10";
             lblNoOfEpisodes.Text = seriesInfo.Episodes.Count.ToString() + " episodes";
             lblOverview.Text     = series.Overview;
             if (series.Actors.Count >= 3)
             {
                 lblActors.Text = series.Actors[0] + ", " + series.Actors[1] + ", " + series.Actors[2];
             }
             lblContentRating.Text = series.ContentRating;
             if (nextEpisode != null)
             {
                 lblNextEpisode.Text = "Next Episode to watch: " + nextEpisode.ToString();
             }
             else
             {
                 lblNextEpisode.Text = "No more episodes to watch";
             }
             lblName.Visible          = true;
             lblYear.Visible          = true;
             lblRating.Visible        = true;
             lblNoOfEpisodes.Visible  = true;
             lblOverview.Visible      = true;
             lblActors.Visible        = true;
             lblContentRating.Visible = true;
             lblNextEpisode.Visible   = true;
             btnShowMore.Visible      = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }