public static void PromptToRateSeriesOnCompletion(AnimeSeriesVM ser) { try { if (!BaseConfig.Settings.DisplayRatingDialogOnCompletion) { return; } // if the user doesn't have all the episodes return if (ser.MissingEpisodeCount > 0) { return; } // only prompt the user if the series has finished airing // and the user has watched all the episodes if (!ser.AniDB_Anime.FinishedAiring || ser.UnwatchedEpisodeCount > 0) { return; } // don't prompt if the user has already rated this AniDB_VoteVM UserVote = ser.AniDB_Anime.UserVote; if (UserVote != null) { return; } decimal rating = Utils.PromptAniDBRating(ser.AniDB_Anime.FormattedTitle); if (rating > 0) { JMMServerVM.Instance.clientBinaryHTTP.VoteAnime(ser.AniDB_ID, rating, (int)VoteType.AnimePermanent); } } catch (Exception ex) { BaseConfig.MyAnimeLog.Write(ex.ToString()); } }
protected override void OnShowContextMenu() { try { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } int mnuUpdate = -1; int mnuSearch = -1; int mnuVotePerm = -1; int mnuVoteTemp = -1; int mnuVoteRevoke = -1; int curMenu = -1; AniDB_VoteVM userVote = MainAnime.UserVote; dlg.Reset(); dlg.SetHeading(MainAnime.FormattedTitle); dlg.Add("Update Series Info From AniDB"); curMenu++; mnuUpdate = curMenu; dlg.Add("Search for Torrents"); curMenu++; mnuSearch = curMenu; if (userVote == null && JMMServerVM.Instance.CurrentUser.IsAniDBUserBool) { dlg.Add("Permanent Vote"); curMenu++; mnuVotePerm = curMenu; dlg.Add("Temporary Vote"); curMenu++; mnuVoteTemp = curMenu; } if (userVote != null && JMMServerVM.Instance.CurrentUser.IsAniDBUserBool) { dlg.Add("Revoke Vote"); curMenu++; mnuVoteRevoke = curMenu; } dlg.DoModal(GUIWindowManager.ActiveWindow); int selectedLabel = dlg.SelectedLabel; if (selectedLabel == mnuUpdate) { MainWindow.ServerHelper.UpdateAnime(MainAnime.AnimeID); setGUIProperty("AnimeInfo.DownloadStatus", "Waiting on server..."); } if (selectedLabel == mnuSearch) { DownloadHelper.SearchAnime(MainAnime); } if (selectedLabel == mnuVotePerm) { decimal rating = Utils.PromptAniDBRating(MainAnime.FormattedTitle); if (rating > 0) { JMMServerVM.Instance.clientBinaryHTTP.VoteAnime(MainAnime.AnimeID, rating, (int)VoteType.AnimePermanent); LoadInfo(); SetSkinProperties(); InfoPage(); } } if (selectedLabel == mnuVoteTemp) { decimal ratingTemp = Utils.PromptAniDBRating(MainAnime.FormattedTitle); if (ratingTemp > 0) { JMMServerVM.Instance.clientBinaryHTTP.VoteAnime(MainAnime.AnimeID, ratingTemp, (int)VoteType.AnimeTemporary); LoadInfo(); SetSkinProperties(); InfoPage(); } } if (selectedLabel == mnuVoteRevoke) { JMMServerVM.Instance.clientBinaryHTTP.VoteAnimeRevoke(MainAnime.AnimeID); LoadInfo(); SetSkinProperties(); InfoPage(); } } catch (Exception ex) { BaseConfig.MyAnimeLog.Write("Error in menu: {0}", ex); } }