private void LoadData(int step, DateTime monthNow, bool special = false) { BaseConfig.MyAnimeLog.Write("LoadData Step: " + step + " Month: " + monthNow); // find the anime for this month colAnime = ShokoServerHelper.GetAnimeForMonthYear(monthNow.Month, monthNow.Year); dummyAnyAnimeForMonth.Visible = ((colAnime.Count > 0) || (m_Facade.Count > 0)); // now sort the groups by air date if (step == -1) { colAnime = colAnime.OrderByDescending(a => a.AirDate).ToList(); } else { colAnime = colAnime.OrderBy(a => a.AirDate).ToList(); } //BaseConfig.MyAnimeLog.Write(monthNow.ToString("MMM yyyy").ToUpper()); if (m_Facade.Count == 0) { GUIControl.ClearControl(GetID, m_Facade.GetID); m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip; } VM_AniDB_Anime selanime = null; if (m_Facade.Count > 0) { selanime = (VM_AniDB_Anime)m_Facade.SelectedListItem.TVTag; } int selIndex = 0; foreach (VM_AniDB_Anime anime in colAnime) { //BaseConfig.MyAnimeLog.Write(anime.ToString()); string imagePath = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_question_poster.png"; if (anime.DefaultPosterPath.Trim().Length > 0) { if (File.Exists(anime.DefaultPosterPath)) { imagePath = anime.DefaultPosterPath; } } if ((anime.AnimeID == MainWindow.GlobalSeriesID) && (m_Facade.Count == 0)) { selanime = anime; } GUIListItem item = new GUIListItem(); item.IconImage = item.IconImageBig = imagePath; item.TVTag = anime; item.OnItemSelected += onFacadeItemSelected; if (step == -1) { m_Facade.Insert(0, item); } else { m_Facade.Add(item); } } if ((m_Facade.Count > 0) && (selanime != null)) { //BaseConfig.MyAnimeLog.Write("selIndex: {0}", selIndex.ToString()); for (int x = 0; x < m_Facade.Count; x++) { if ((m_Facade.FilmstripLayout.ListItems[x].TVTag) == selanime) { selIndex = x; break; } } if (special) //hack { m_Facade.OnAction(new MediaPortal.GUI.Library.Action(MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_LEFT, 0, 0)); m_Facade.OnAction(new MediaPortal.GUI.Library.Action(MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_RIGHT, 0, 0)); } m_Facade.SelectedListItemIndex = selIndex; VM_AniDB_Anime anime = m_Facade.SelectedListItem.TVTag as VM_AniDB_Anime; if (anime != null) { SetAnime(anime); } } if (step == 0) { LoadData(-1, monthNow.AddMonths(-1), true); } }