Exemple #1
0
        private void FillFullSeriesDetails(TvdbSeries _series)
        {
            List <TvdbSeasonBanner> seasonBannerList = _series.SeasonBanners;

            tvEpisodes.Nodes.Clear();
            foreach (TvdbEpisode e in _series.Episodes)
            {
                bool found = false;
                foreach (TreeNode seasonNode in tvEpisodes.Nodes)
                {
                    if (((SeasonTag)seasonNode.Tag).SeasonId == e.SeasonId)
                    {
                        TreeNode node = new TreeNode(e.EpisodeNumber + " - " + e.EpisodeName);
                        node.Tag = e;
                        seasonNode.Nodes.Add(node);
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    TreeNode node = new TreeNode("Season " + e.SeasonNumber);

                    List <TvdbSeasonBanner> tagList = new List <TvdbSeasonBanner>();
                    foreach (TvdbSeasonBanner b in seasonBannerList)
                    {
                        if (b.Season == e.SeasonNumber)
                        {
                            tagList.Add(b);
                        }
                    }
                    SeasonTag tag = new SeasonTag(e.SeasonNumber, e.SeasonId, tagList);
                    node.Tag = tag;
                    tvEpisodes.Nodes.Add(node);

                    TreeNode epNode = new TreeNode(e.EpisodeNumber + " - " + e.EpisodeName);
                    epNode.Tag = e;
                    node.Nodes.Add(epNode);
                }
            }
        }
Exemple #2
0
        private void tvEpisodes_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (tvEpisodes.SelectedNode != null && tvEpisodes.SelectedNode.Tag != null)
            {
                int selectedSeason = 0;
                if (tvEpisodes.SelectedNode.Tag.GetType() == typeof(TvdbEpisode))
                {//episode node
                    TvdbEpisode ep = (TvdbEpisode)tvEpisodes.SelectedNode.Tag;
                    FillEpisodeDetail(ep);

                    //load episode image
                    if (ep.Banner != null)
                    {
                        bcEpisodeBanner.BannerImage = ep.Banner;
                    }
                    else
                    {
                        bcEpisodeBanner.ClearControl();
                    }
                    selectedSeason = ep.SeasonNumber;
                }
                else if (tvEpisodes.SelectedNode.Tag.GetType() == typeof(SeasonTag))
                {//season node
                    SeasonTag tag = (SeasonTag)tvEpisodes.SelectedNode.Tag;
                    selectedSeason = tag.SeasonNumber;
                    ClearEpisodeDetail();
                    lbEpisodeInformation.Text = "Season " + tag.SeasonNumber;
                }
                else
                {//shouldn't happen at all
                    return;
                }

                if (bcSeasonBanner.Tag == null || selectedSeason != (int)bcSeasonBanner.Tag)
                {
                    List <TvdbBanner> seasonList     = new List <TvdbBanner>();
                    List <TvdbBanner> seasonWideList = new List <TvdbBanner>();

                    if (m_currentSeries.SeasonBanners != null && m_currentSeries.SeasonBanners.Count > 0)
                    {
                        foreach (TvdbSeasonBanner b in m_currentSeries.SeasonBanners)
                        {
                            if (b.Season == selectedSeason)
                            {
                                if (b.BannerType == TvdbSeasonBanner.Type.season)
                                {
                                    if (b.Language == null || b.Language.Abbriviation.Equals(m_currentLanguage.Abbriviation))
                                    {
                                        seasonList.Add(b);
                                    }
                                }

                                if (b.BannerType == TvdbSeasonBanner.Type.seasonwide)
                                {
                                    if (b.Language == null || b.Language.Abbriviation.Equals(m_currentLanguage.Abbriviation))
                                    {
                                        seasonWideList.Add(b);
                                    }
                                }
                            }
                        }
                    }
                    if (seasonList.Count > 0)
                    {
                        bcSeasonBanner.BannerImages = seasonList;
                    }
                    else
                    {
                        bcSeasonBanner.ClearControl();
                    }
                    bcSeasonBanner.Tag = selectedSeason;

                    if (seasonWideList.Count > 0)
                    {
                        bcSeasonBannerWide.BannerImages = seasonWideList;
                    }
                    else
                    {
                        bcSeasonBannerWide.ClearControl();
                    }

                    bcSeasonBannerWide.Tag = selectedSeason;
                }
            }
        }
Exemple #3
0
        private void FillFullSeriesDetails(TvdbSeries _series)
        {
            List<TvdbSeasonBanner> seasonBannerList = _series.SeasonBanners;
              tvEpisodes.Nodes.Clear();
              foreach (TvdbEpisode e in _series.Episodes)
              {
            bool found = false;
            foreach (TreeNode seasonNode in tvEpisodes.Nodes)
            {
              if (((SeasonTag)seasonNode.Tag).SeasonId == e.SeasonId)
              {
            TreeNode node = new TreeNode(e.EpisodeNumber + " - " + e.EpisodeName);
            node.Tag = e;
            seasonNode.Nodes.Add(node);
            found = true;
            break;
              }
            }
            if (!found)
            {
              TreeNode node = new TreeNode("Season " + e.SeasonNumber);

              List<TvdbSeasonBanner> tagList = new List<TvdbSeasonBanner>();
              foreach (TvdbSeasonBanner b in seasonBannerList)
              {
            if (b.Season == e.SeasonNumber) tagList.Add(b);
              }
              SeasonTag tag = new SeasonTag(e.SeasonNumber, e.SeasonId, tagList);
              node.Tag = tag;
              tvEpisodes.Nodes.Add(node);

              TreeNode epNode = new TreeNode(e.EpisodeNumber + " - " + e.EpisodeName);
              epNode.Tag = e;
              node.Nodes.Add(epNode);
            }
              }
        }