Пример #1
0
        private bool SearchTheMovieDBMenu(AnimeSeriesVM ser, string previousMenu)
        {
            int aniDBID = ser.AniDB_Anime.AnimeID;

            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            if (dlg == null)
                return true;

            //keep showing the dialog until the user closes it
            int selectedLabel = 0;
            string currentMenu = "Search The MovieDB";
            while (true)
            {
                dlg.Reset();
                dlg.SetHeading(currentMenu);

                if (previousMenu != string.Empty)
                    dlg.Add("<<< " + previousMenu);
                dlg.Add("Search using:   " + ser.AniDB_Anime.FormattedTitle);
                dlg.Add("Manual Search");

                CrossRef_AniDB_OtherResultVM CrossRef_AniDB_OtherResult = null;
                JMMServerBinary.Contract_CrossRef_AniDB_OtherResult xref = JMMServerVM.Instance.clientBinaryHTTP.GetOtherAnimeCrossRefWebCache(aniDBID, (int)CrossRefType.MovieDB);
                if (xref != null)
                {
                    CrossRef_AniDB_OtherResult = new CrossRef_AniDB_OtherResultVM(xref);
                    dlg.Add("Community Says:   " + CrossRef_AniDB_OtherResult.CrossRefID.ToString());
                }

                dlg.SelectedLabel = selectedLabel;
                dlg.DoModal(GUIWindowManager.ActiveWindow);
                selectedLabel = dlg.SelectedLabel;

                int selection = selectedLabel + ((previousMenu == string.Empty) ? 1 : 0);
                switch (selection)
                {
                    case 0:
                        //show previous
                        return true;
                    case 1:
                        if (!SearchTheMovieDB(ser, ser.AniDB_Anime.FormattedTitle, currentMenu))
                            return false;
                        break;
                    case 2:
                        {
                            string searchText = ser.AniDB_Anime.FormattedTitle;
                            if (Utils.DialogText(ref searchText, GetID))
                            {
                                if (!SearchTheMovieDB(ser, searchText, currentMenu))
                                    return false;
                            }
                        }
                        break;
                    case 3:
                        LinkAniDBToMovieDB(ser, CrossRef_AniDB_OtherResult.AnimeID, int.Parse(CrossRef_AniDB_OtherResult.CrossRefID));
                        return false;
                    default:
                        //close menu
                        return false;
                }
            }
        }
        private ContextMenuAction SearchTheMovieDBMenu(AnimeSeriesVM ser, string previousMenu)
        {
            int aniDBID = ser.AniDB_Anime.AnimeID;
              ContextMenu cmenu = new ContextMenu(Translation.SearchTheMovieDB, previousMenu);
              cmenu.Add(Translation.SearchUsing + ": " + ser.AniDB_Anime.FormattedTitle, () => SearchTheMovieDB(ser, ser.AniDB_Anime.FormattedTitle, Translation.SearchTheMovieDB));
              cmenu.Add(Translation.ManualSearch, () =>
              {
            searchText = ser.AniDB_Anime.FormattedTitle;
            if (Utils.DialogText(ref searchText, GetID))
              return SearchTheMovieDB(ser, ser.AniDB_Anime.FormattedTitle, Translation.SearchTheMovieDB);
            return ContextMenuAction.Continue;
              });
              Contract_CrossRef_AniDB_OtherResult xref = JMMServerVM.Instance.clientBinaryHTTP.GetOtherAnimeCrossRefWebCache(aniDBID, (int)CrossRefType.MovieDB);
              if (xref != null)
              {

            CrossRef_AniDB_OtherResultVM crossrossRefAniDbOtherResult = new CrossRef_AniDB_OtherResultVM(xref);
            cmenu.AddAction(Translation.CommunitySays + ": " + crossrossRefAniDbOtherResult.CrossRefID, () => LinkAniDBToMovieDB(ser, crossrossRefAniDbOtherResult.AnimeID, Int32.Parse(crossrossRefAniDbOtherResult.CrossRefID)));
              }
              return cmenu.Show();
        }