public override bool OnMessage(GUIMessage message) { switch (message.Message) { case GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED: { int iControl = message.SenderControlId; if (iControl == m_Facade.GetID) { GUIListItem item = m_Facade.SelectedListItem; if (item == null || item.TVTag == null || !(item.TVTag is CL_AniDB_Character)) { return(true); } CL_AniDB_Character aniChar = item.TVTag as CL_AniDB_Character; SetCharacterProperties(aniChar); } } return(true); default: return(base.OnMessage(message)); } }
private void SetCharacterProperties(CL_AniDB_Character aniChar, VM_AniDB_Anime anime = null) { SetGUIProperty(GuiProperty.Actors_Character_Name, aniChar.CharName); SetGUIProperty(GuiProperty.Actors_Character_KanjiName, aniChar.CharKanjiName); SetGUIProperty(GuiProperty.Actors_Character_Description, aniChar.CharDescription); SetGUIProperty(GuiProperty.Actors_Character_CharType, aniChar.CharType); string imagePath = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png"; if (File.Exists(aniChar.GetPosterPath())) { imagePath = aniChar.GetPosterPath(); } SetGUIProperty(GuiProperty.Actors_Character_Poster, imagePath); if (anime != null) { SetGUIProperty(GuiProperty.Actors_Series_Title, anime.FormattedTitle); SetGUIProperty(GuiProperty.Actors_Series_Poster, ImageAllocator.GetAnimeImageAsFileName(anime, GUIFacadeControl.Layout.List)); } else { ClearGUIProperty(GuiProperty.Actors_Series_Title); ClearGUIProperty(GuiProperty.Actors_Series_Poster); } }
public static string GetPosterPathPlain(this CL_AniDB_Character aniDbCharacterVm) { if (String.IsNullOrEmpty(aniDbCharacterVm.PicName)) { return(""); } return(Path.Combine(Utils.GetAniDBCharacterImagePath(aniDbCharacterVm.CharID), aniDbCharacterVm.PicName)); }
public static CL_AniDB_Character ToClient(this AniDB_Character character, string charType, AniDB_Seiyuu seiyuu) { CL_AniDB_Character contract = character.ToClient(); if (seiyuu != null) { contract.Seiyuu = seiyuu; } return(contract); }
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { MainMenu menu = new MainMenu(); menu.Add(btnGetMissingInfo, () => { VM_ShokoServer.Instance.ShokoServices.UpdateAnimeData(mainAnime.AnimeID); SetGUIProperty(GuiProperty.Character_Status, Translation.RequestSendToServerPleaseRefresh + "..."); m_Facade.Focus = true; }); menu.Add(btnRefreshView, () => { VM_ShokoServer.Instance.ShokoServices.UpdateAnimeData(mainAnime.AnimeID); SetGUIProperty(GuiProperty.Character_Status, Translation.RequestSendToServerPleaseRefresh + "..."); m_Facade.Focus = true; }); menu.Add(btnSeiyuu, () => GUIWindowManager.ActivateWindow(Constants.WindowIDs.ACTORS, false)); if (menu.Check(control)) { return; } try { if (actionType == Action.ActionType.ACTION_SELECT_ITEM) { if (control == m_Facade) { GUIListItem item = m_Facade.SelectedListItem; if (item == null || item.TVTag == null || !(item.TVTag is CL_AniDB_Character)) { return; } CL_AniDB_Character aniChar = item.TVTag as CL_AniDB_Character; AniDB_Seiyuu actor = aniChar.Seiyuu; MainWindow.GlobalSeiyuuID = actor.AniDB_SeiyuuID; GUIWindowManager.ActivateWindow(Constants.WindowIDs.ACTORS, false); } } } // ReSharper disable EmptyGeneralCatchClause catch { } // ReSharper restore EmptyGeneralCatchClause base.OnClicked(controlId, control, actionType); }
private void SetCharacterProperties(CL_AniDB_Character aniChar) { if (dummyMainCharExists != null) { dummyMainCharExists.Visible = true; } if (dummyMainActorExists != null) { dummyMainActorExists.Visible = false; } if (dummySeriesExists != null) { dummySeriesExists.Visible = false; } ClearGUIProperty(GuiProperty.Character_PosterSeries); SetGUIProperty(GuiProperty.Character_Name, aniChar.CharName); SetGUIProperty(GuiProperty.Character_KanjiName, aniChar.CharKanjiName); SetGUIProperty(GuiProperty.Character_Description, aniChar.CharDescription); SetGUIProperty(GuiProperty.Character_CharType, aniChar.CharType); string imagePath = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png"; if (File.Exists(aniChar.GetPosterPath())) { imagePath = aniChar.GetPosterPath(); } try { Image theImage = Image.FromFile(imagePath); float width = theImage.PhysicalDimension.Width; float height = theImage.PhysicalDimension.Height; if (dummyPosterMainChar != null) { dummyPosterMainChar.Visible = height > width; } } catch { } SetGUIProperty(GuiProperty.Character_PosterMainChar, imagePath); SetActorProperties(aniChar); }
private void onFacadeItemSelected(GUIListItem item, GUIControl parent) { // if this is not a message from the facade, exit if (parent != m_Facade && parent != m_Facade.FilmstripLayout && parent != m_Facade.CoverFlowLayout) { return; } if (item == null || item.TVTag == null || !(item.TVTag is CL_AniDB_Character)) { return; } CL_AniDB_Character aniChar = item.TVTag as CL_AniDB_Character; SetCharacterProperties(aniChar); }
public static string GetPosterPath(this CL_AniDB_Character aniDbCharacterVm) { if (String.IsNullOrEmpty(aniDbCharacterVm.GetPosterPathPlain())) { return(aniDbCharacterVm.GetPosterPathPlain()); } if (!File.Exists(aniDbCharacterVm.GetPosterPathPlain())) { ImageDownloadRequest req = new ImageDownloadRequest(ImageEntityType.AniDB_Character, aniDbCharacterVm, false); MainWindow.imageHelper.DownloadImage(req); if (File.Exists(aniDbCharacterVm.GetPosterPathPlain())) { return(aniDbCharacterVm.GetPosterPathPlain()); } } return(aniDbCharacterVm.GetPosterPathPlain()); }
private void RefreshCharacters() { charList = VM_ShokoServer.Instance.ShokoServices.GetCharactersForSeiyuu(MainWindow.GlobalSeiyuuID); foreach (CL_AniDB_Character aniChar in charList) { if (!string.IsNullOrEmpty(aniChar.GetPosterPath()) && File.Exists(aniChar.GetPosterPath())) { string imagePath = aniChar.GetPosterPath(); bool fnd = false; foreach (GUIListItem g in m_Facade.FilmstripLayout.ListItems) { CL_AniDB_Character ac = g.TVTag as CL_AniDB_Character; if (ac != null) { if (ac.CharID == aniChar.CharID) { fnd = true; g.IconImage = g.IconImageBig = imagePath; break; } } } if (!fnd) { GUIListItem item = new GUIListItem(string.Empty); item.IconImage = item.IconImageBig = imagePath; item.TVTag = aniChar; item.OnItemSelected += onFacadeItemSelected; m_Facade.Add(item); BaseConfig.MyAnimeLog.Write(aniChar.ToString()); } } } if (dummyCharactersExist != null) { dummyCharactersExist.Visible = charList.Count > 0; } SetGUIProperty(GuiProperty.Actors_Character_CharacterCount, charList.Count.ToString(Globals.Culture)); }
private void ShowCharacters() { GUIControl.ClearControl(GetID, m_Facade.GetID); BaseConfig.MyAnimeLog.Write("ActorWindow.GlobalSeiyuuID = {0}", MainWindow.GlobalSeiyuuID.ToString(CultureInfo.InvariantCulture)); charList.Clear(); seiyuu = null; seiyuu = VM_ShokoServer.Instance.ShokoServices.GetAniDBSeiyuu(MainWindow.GlobalSeiyuuID); if (seiyuu == null) { ClearGUIProperty(GuiProperty.Actors_Actor_Name); ClearGUIProperty(GuiProperty.Actors_Actor_Poster); ClearGUIProperty(GuiProperty.Actors_Character_CharacterCount); return; } SetGUIProperty(GuiProperty.Actors_Actor_Name, seiyuu.SeiyuuName); string imagePath = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png"; if (File.Exists(seiyuu.GetPosterPath())) { imagePath = seiyuu.GetPosterPath(); } SetGUIProperty(GuiProperty.Actors_Actor_Poster, imagePath); charList = VM_ShokoServer.Instance.ShokoServices.GetCharactersForSeiyuu(MainWindow.GlobalSeiyuuID); bool missingImages = false; string imagePathNoPicture = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png"; foreach (CL_AniDB_Character aniChar in charList) { imagePath = imagePathNoPicture; if (!string.IsNullOrEmpty(aniChar.GetPosterPath()) && File.Exists(aniChar.GetPosterPath())) { imagePath = aniChar.GetPosterPath(); } else { missingImages = true; } GUIListItem item = new GUIListItem(string.Empty); item.IconImage = item.IconImageBig = imagePath; item.TVTag = aniChar; item.OnItemSelected += onFacadeItemSelected; m_Facade.Add(item); BaseConfig.MyAnimeLog.Write(aniChar.ToString()); } if (dummyCharactersExist != null) { dummyCharactersExist.Visible = charList.Count > 0; } SetGUIProperty(GuiProperty.Actors_Character_CharacterCount, charList.Count.ToString(Globals.Culture)); if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; CL_AniDB_Character aniChar = m_Facade.SelectedListItem.TVTag as CL_AniDB_Character; if (aniChar != null) { SetCharacterProperties(aniChar); } } if (missingImages) { GetMissingInfo(); } }
private void SetActorProperties(CL_AniDB_Character aniChar) { if (dummyMainActorExists != null) { dummyMainActorExists.Visible = false; } if (dummySeriesExists != null) { dummySeriesExists.Visible = false; } string imagePath = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png"; // get the actor from the character AniDB_Seiyuu actor = aniChar.Seiyuu; if (actor == null) { try { Image theImage = Image.FromFile(imagePath); float width = theImage.PhysicalDimension.Width; float height = theImage.PhysicalDimension.Height; if (dummyPosterMainActor != null) { dummyPosterMainActor.Visible = height > width; } } // ReSharper disable EmptyGeneralCatchClause catch { } // ReSharper restore EmptyGeneralCatchClause SetGUIProperty(GuiProperty.Character_PosterMainActor, imagePath); ClearGUIProperty(GuiProperty.Actor_Name); } else { MainWindow.GlobalSeiyuuID = actor.AniDB_SeiyuuID; if (dummyMainActorExists != null) { dummyMainActorExists.Visible = true; } SetGUIProperty(GuiProperty.Actor_Name, actor.SeiyuuName); if (File.Exists(actor.GetPosterPath())) { imagePath = actor.GetPosterPath(); } try { Image theImage = Image.FromFile(imagePath); float width = theImage.PhysicalDimension.Width; float height = theImage.PhysicalDimension.Height; if (dummyPosterMainActor != null) { dummyPosterMainActor.Visible = height > width; } } // ReSharper disable EmptyGeneralCatchClause catch { } // ReSharper restore EmptyGeneralCatchClause SetGUIProperty(GuiProperty.Character_PosterMainActor, imagePath); } }
private void ShowCharacters() { GUIControl.ClearControl(GetID, m_Facade.GetID); if (dummyMainCharExists != null) { dummyMainCharExists.Visible = false; } if (dummyMainActorExists != null) { dummyMainActorExists.Visible = false; } if (dummySeriesExists != null) { dummySeriesExists.Visible = false; } BaseConfig.MyAnimeLog.Write("CharWindow.GlobalSeriesID = {0}", MainWindow.GlobalSeriesID.ToString()); charList.Clear(); if (serMain?.Anime == null) { ClearGUIProperty(GuiProperty.Title); ClearGUIProperty(GuiProperty.Character_Name); ClearGUIProperty(GuiProperty.Character_KanjiName); ClearGUIProperty(GuiProperty.Actor_Name); ClearGUIProperty(GuiProperty.Actor_KanjiName); ClearGUIProperty(GuiProperty.Character_CharacterCount); return; } serMain = ShokoServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (serMain != null) { mainAnime = serMain.Anime; } else { return; } if (mainAnime == null) { return; } SetGUIProperty(GuiProperty.Character_Main_Title, mainAnime.FormattedTitle); charList = mainAnime.Characters; if (dummyCharactersExist != null) { dummyCharactersExist.Visible = charList.Count > 0; } SetGUIProperty(GuiProperty.Character_CharacterCount, charList.Count.ToString(Globals.Culture)); SetGUIProperty(GuiProperty.Title, serMain.SeriesName); string imagePathNoPicture = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png"; foreach (CL_AniDB_Character aniChar in charList) { string imagePath = imagePathNoPicture; if (!string.IsNullOrEmpty(aniChar.GetPosterPath()) && File.Exists(aniChar.GetPosterPath())) { imagePath = aniChar.GetPosterPath(); } GUIListItem item = new GUIListItem(""); item.IconImage = item.IconImageBig = imagePath; item.TVTag = aniChar; item.OnItemSelected += onFacadeItemSelected; m_Facade.Add(item); } if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; CL_AniDB_Character aniChar = m_Facade.SelectedListItem.TVTag as CL_AniDB_Character; if (aniChar != null) { SetCharacterProperties(aniChar); } } }