protected override void OnShowContextMenu()
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
            if (currentitem == null) return;

            if (currentitem.TVTag.GetType() == typeof(RecommendationVM))
            {
                RecommendationVM rec = currentitem.TVTag as RecommendationVM;
                if (rec != null)
                {
                    ContextMenu cmenu = new ContextMenu(rec.Recommended_DisplayName);
                    cmenu.AddAction(Translation.DontShowThisAnime, () =>
                    {
                        int recType = 1;
                        if (dummyModeDownload != null && dummyModeDownload.Visible)
                            recType = 2;

                        JMMServerVM.Instance.clientBinaryHTTP.IgnoreAnime(rec.RecommendedAnimeID, recType, JMMServerVM.Instance.CurrentUser.JMMUserID);

                        LoadData();
                    });
                    cmenu.AddAction(Translation.BookmarkThisAnime, () =>
                    {
                        BookmarkedAnimeVM bookmark = new BookmarkedAnimeVM();
                        bookmark.AnimeID = rec.RecommendedAnimeID;
                        bookmark.Downloading = 0;
                        bookmark.Notes = "";
                        bookmark.Priority = 1;
                        if (bookmark.Save())
                            Utils.DialogMsg(Translation.Sucess, Translation.BookmarkCreated);
                    });
                    cmenu.AddAction(Translation.CreateSeriesForAnime, () =>
                    {
                        JMMServerBinary.Contract_AnimeSeries_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.CreateSeriesFromAnime(
                                rec.RecommendedAnimeID, null, JMMServerVM.Instance.CurrentUser.JMMUserID);
                        if (string.IsNullOrEmpty(resp.ErrorMessage))
                            Utils.DialogMsg(Translation.Sucess, Translation.SeriesCreated);
                        else
                            Utils.DialogMsg(Translation.Error, resp.ErrorMessage);
                    });
                    cmenu.Show();
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnShowContextMenu()
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
            if (currentitem == null) return;

            if (currentitem.TVTag.GetType() == typeof(RecommendationVM))
            {
                RecommendationVM rec = currentitem.TVTag as RecommendationVM;
                if (rec != null)
                {
                    GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                    if (dlg == null)
                        return;

                    dlg.Reset();
                    dlg.SetHeading(rec.Recommended_DisplayName);
                    dlg.Add("Don't Show This Anime (Ignore)");
                    dlg.Add("Bookmark this Anime");
                    dlg.Add("Create Series for Anime");

                    dlg.DoModal(GUIWindowManager.ActiveWindow);

                    switch (dlg.SelectedLabel)
                    {
                        case 0:

                            int recType = 1;
                            if (dummyModeDownload != null && dummyModeDownload.Visible)
                                recType = 2;

                            JMMServerVM.Instance.clientBinaryHTTP.IgnoreAnime(rec.RecommendedAnimeID, recType,
                                JMMServerVM.Instance.CurrentUser.JMMUserID);

                            LoadData();
                            break;

                        case 1:

                            BookmarkedAnimeVM bookmark = new BookmarkedAnimeVM();
                            bookmark.AnimeID = rec.RecommendedAnimeID;
                            bookmark.Downloading = 0;
                            bookmark.Notes = "";
                            bookmark.Priority = 1;
                            if (bookmark.Save())
                            {
                                Utils.DialogMsg("Success", "Bookmark Created");
                            }

                            break;

                        case 2:

                            JMMServerBinary.Contract_AnimeSeries_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.CreateSeriesFromAnime(
                                rec.RecommendedAnimeID, null, JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (string.IsNullOrEmpty(resp.ErrorMessage))
                                Utils.DialogMsg("Success", "Series Created");
                            else
                                Utils.DialogMsg("Error", resp.ErrorMessage);

                            break;

                    }
                }
            }
        }
Exemplo n.º 3
0
        protected override void OnShowContextMenu()
        {
            try
            {
                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dlg == null)
                    return;

                dlg.Reset();
                dlg.SetHeading("Calendar");
                dlg.Add("Search for Torrents");
                dlg.Add("Bookmark this Anime");
                dlg.Add("Create Series for Anime");
                dlg.DoModal(GUIWindowManager.ActiveWindow);

                switch (dlg.SelectedId)
                {
                    case 1:

                        AniDB_AnimeVM anime2 = null;
                        if ((anime2 = this.m_Facade.SelectedListItem.TVTag as AniDB_AnimeVM) != null)
                        {
                            DownloadHelper.SearchAnime(anime2);
                        }

                        break;

                    case 2:

                        AniDB_AnimeVM anime3 = null;
                        if ((anime3 = this.m_Facade.SelectedListItem.TVTag as AniDB_AnimeVM) != null)
                        {
                            BookmarkedAnimeVM bookmark = new BookmarkedAnimeVM();
                            bookmark.AnimeID = anime3.AnimeID;
                            bookmark.Downloading = 0;
                            bookmark.Notes = "";
                            bookmark.Priority = 1;
                            if (bookmark.Save())
                            {
                                Utils.DialogMsg("Success", "Bookmark Created");
                            }
                        }

                        break;

                    case 3:

                        AniDB_AnimeVM anime4 = null;
                        if ((anime4 = this.m_Facade.SelectedListItem.TVTag as AniDB_AnimeVM) != null)
                        {
                            JMMServerBinary.Contract_AnimeSeries_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.CreateSeriesFromAnime(
                                anime4.AnimeID, null, JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (string.IsNullOrEmpty(resp.ErrorMessage))
                                Utils.DialogMsg("Success", "Series Created");
                            else
                                Utils.DialogMsg("Error", resp.ErrorMessage);
                        }

                        break;
                }
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("Error in menu: {0}", ex);
            }
        }