private void OnCalendarDateSelected(GUIListItem item, GUIControl parent) { // Skip over date to next/prev movie if a header (Date) if (LastMoved == FacadeMovement.Down) { Facade.OnAction(new Action(Action.ActionType.ACTION_MOVE_DOWN, 0, 0)); } else { Facade.OnAction(new Action(Action.ActionType.ACTION_MOVE_UP, 0, 0)); } }
private void OnCalendarDateSelected(GUIListItem item, GUIControl parent) { // Skip over date to next/prev episode if a header (Date) if (LastMoved == FacadeMovement.Down) { Facade.OnAction(new Action(Action.ActionType.ACTION_MOVE_DOWN, 0, 0)); } else { Facade.OnAction(new Action(Action.ActionType.ACTION_MOVE_UP, 0, 0)); // if the current item is now the first item which is a header, then skip to end // we need to bypass the scroll delay so we are not stuck on the first item if (Facade.SelectedListItemIndex == 0) { Facade.SelectedListItemIndex = Facade.Count - 1; } } }
// triggered when a group header was selected on the facade private static void onGroupHeaderSelected(GUIListItem item, GUIControl parent) { // if this is not a message from the facade, exit GUIFacadeControl facade = Browser.Facade; if (!facade.IsRelated(parent) || facade.SelectedListItem != item) { return; } int newIndex = facade.SelectedListItemIndex; int oldIndex = Browser.SelectedIndex; int lastIndex = facade.Count - 1; logger.Debug("onGroupHeaderSelected CurrentIndex {0} OldIndex {1}", newIndex, oldIndex); if (newIndex < oldIndex && !(newIndex == 0 && oldIndex == lastIndex)) { // MOVE UP logger.Debug("Jumping Up"); if (newIndex == 0) { facade.SelectIndex(lastIndex); } else { facade.OnAction(new MediaPortal.GUI.Library.Action(MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_UP, 0, 0)); } } else { // MOVE DOWN logger.Debug("Jumping Down"); facade.OnAction(new MediaPortal.GUI.Library.Action(MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_DOWN, 0, 0)); } }
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); } }
private void LoadData() { dummyAnyAnimeForMonth.Visible = false; monthNow = new DateTime(MainWindow.CurrentCalendarYear, MainWindow.CurrentCalendarMonth, 1); monthMinusOne = monthNow.AddMonths(-1); monthMinusTwo = monthNow.AddMonths(-2); monthMinusThree = monthNow.AddMonths(-3); monthPlusOne = monthNow.AddMonths(1); monthPlusTwo = monthNow.AddMonths(2); monthPlusThree = monthNow.AddMonths(3); setGUIProperty("Calendar.CurrentMonth", monthNow.ToString("MMM")); setGUIProperty("Calendar.CurrentYear", monthNow.ToString("yyyy")); setGUIProperty("Calendar.MinusOneMonth", monthMinusOne.ToString("MMM")); setGUIProperty("Calendar.MinusOneYear", monthMinusOne.ToString("yyyy")); setGUIProperty("Calendar.MinusTwoMonth", monthMinusTwo.ToString("MMM")); setGUIProperty("Calendar.MinusTwoYear", monthMinusTwo.ToString("yyyy")); setGUIProperty("Calendar.MinusThreeMonth", monthMinusThree.ToString("MMM")); setGUIProperty("Calendar.MinusThreeYear", monthMinusThree.ToString("yyyy")); setGUIProperty("Calendar.PlusOneMonth", monthPlusOne.ToString("MMM")); setGUIProperty("Calendar.PlusOneYear", monthPlusOne.ToString("yyyy")); setGUIProperty("Calendar.PlusTwoMonth", monthPlusTwo.ToString("MMM")); setGUIProperty("Calendar.PlusTwoYear", monthPlusTwo.ToString("yyyy")); setGUIProperty("Calendar.PlusThreeMonth", monthPlusThree.ToString("MMM")); setGUIProperty("Calendar.PlusThreeYear", monthPlusThree.ToString("yyyy")); // find the anime for this month colAnime = JMMServerHelper.GetAnimeForMonthYear(monthNow.Month, monthNow.Year); if (colAnime.Count > 0) { dummyAnyAnimeForMonth.Visible = true; } // now sort the groups by air date List <SortPropOrFieldAndDirection> sortCriteria = new List <SortPropOrFieldAndDirection>(); sortCriteria.Add(new SortPropOrFieldAndDirection("AirDate", false, SortType.eDateTime)); colAnime = Sorting.MultiSort <AniDB_AnimeVM>(colAnime, sortCriteria); //BaseConfig.MyAnimeLog.Write(monthNow.ToString("MMM yyyy").ToUpper()); GUIControl.ClearControl(this.GetID, m_Facade.GetID); m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip; int selIndex = 0; int pos = 0; foreach (AniDB_AnimeVM 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) { selIndex = pos; } pos++; GUIListItem item = new GUIListItem(); item.IconImage = item.IconImageBig = imagePath; item.TVTag = anime; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected); m_Facade.Add(item); } if (m_Facade.Count > 0) { //BaseConfig.MyAnimeLog.Write("selIndex: {0}", selIndex.ToString()); int currentIndex = m_Facade.SelectedListItemIndex; if (selIndex >= 0 && selIndex < m_Facade.Count && selIndex != currentIndex) { int increment = (currentIndex < selIndex) ? 1 : -1; MediaPortal.GUI.Library.Action.ActionType actionType = (currentIndex < selIndex) ? MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_RIGHT : MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_LEFT; for (int i = currentIndex; i != selIndex; i += increment) { m_Facade.OnAction(new MediaPortal.GUI.Library.Action(actionType, 0, 0)); } } m_Facade.SelectedListItemIndex = selIndex; AniDB_AnimeVM anime = m_Facade.SelectedListItem.TVTag as AniDB_AnimeVM; if (anime != null) { SetAnime(anime); } } // set the focus button btnCurrentPlusOne.Focus = false; switch (MainWindow.CurrentCalendarButton) { case 3: btnCurrentMinusOne.Focus = true; break; case 4: btnCurrentPlusOne.Focus = true; break; } }