当前位置: 首页>>代码示例>>C#>>正文


C# ContextMenu.AddAction方法代码示例

本文整理汇总了C#中System.Windows.Forms.ContextMenu.AddAction方法的典型用法代码示例。如果您正苦于以下问题:C# ContextMenu.AddAction方法的具体用法?C# ContextMenu.AddAction怎么用?C# ContextMenu.AddAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ContextMenu的用法示例。


在下文中一共展示了ContextMenu.AddAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowLayoutMenu

 private ContextMenuAction ShowLayoutMenu(string previousMenu)
 {
     ContextMenu cmenu = new ContextMenu(Translation.ChangeLayout, previousMenu);
       cmenu.AddAction(Translation.ListPosters, () => groupViewMode = GUIFacadeControl.Layout.List);
       cmenu.AddAction(Translation.WideBanners, () => groupViewMode = GUIFacadeControl.Layout.LargeIcons);
       cmenu.AddAction(Translation.Filmstrip, () => groupViewMode = GUIFacadeControl.Layout.Filmstrip);
       if (!m_Facade.IsNullLayout(GUIFacadeControl.Layout.CoverFlow))
     cmenu.AddAction(Translation.Coverflow, () => groupViewMode = GUIFacadeControl.Layout.CoverFlow);
       ContextMenuAction context = cmenu.Show();
       if (context == ContextMenuAction.Exit)
       {
     History level = GetCurrent();
     if (level.Listing is GroupFilterVM && ((GroupFilterVM)level.Listing).Childs.Count == 0)
     {
       settings.LastGroupViewMode = groupViewMode;
       settings.Save();
     }
     LoadFacade();
       }
       return context;
 }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:21,代码来源:MainWindow.cs

示例2: ShowContextMenuTVDB

        private ContextMenuAction ShowContextMenuTVDB(AnimeSeriesVM ser, string previousMenu)
        {
            GUIListItem currentitem = m_Facade.SelectedListItem;
              if (currentitem == null)
            return ContextMenuAction.Exit;

              int tvdbid;
              int season;
              string displayName;

              if (ser.CrossRef_AniDB_TvDBV2.Count > 0 && ser.TvDBSeriesV2.Count > 0 && ser.AniDB_Anime.AniDB_AnimeCrossRefs != null && ser.AniDB_Anime.AniDB_AnimeCrossRefs.TvDBCrossRefExists)
              {
            displayName = ser.AniDB_Anime.AniDB_AnimeCrossRefs.TvDBSeries[0].SeriesName;
            tvdbid = ser.CrossRef_AniDB_TvDBV2[0].TvDBID;
            season = ser.CrossRef_AniDB_TvDBV2[0].TvDBSeasonNumber;
              }
              else
            return ContextMenuAction.PreviousMenu;
              ContextMenu cmenu = new ContextMenu(displayName, previousmenu: previousMenu);
              // ReSharper disable ImplicitlyCapturedClosure
              cmenu.AddAction(Translation.RemoveTVDBAssociation, () => JMMServerVM.Instance.clientBinaryHTTP.RemoveLinkAniDBTvDBForAnime(ser.AniDB_Anime.AnimeID));
              // ReSharper restore ImplicitlyCapturedClosure
              cmenu.Add(string.Format(Translation.SwitchSeason, season.ToString(Globals.Culture)), () =>
              {
            if (ser.CrossRef_AniDB_TvDBV2.Count < 2)
            {
              return ShowSeasonSelectionMenuTvDB(ser, ser.AniDB_Anime.AnimeID, tvdbid, displayName);
            }
            Utils.DialogMsg(Translation.Error, Translation.CannotEditTvDBLink);
            return ContextMenuAction.Continue;
              });
              return cmenu.Show();
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:33,代码来源:MainWindow.cs

示例3: ShowFilterOptions

        private ContextMenuAction ShowFilterOptions(string previousMenu)
        {
            ContextMenu cmenu = new ContextMenu(Translation.FilterOptions, previousMenu);
              string showEps = String.Format(Translation.OnlyShowAvailableEpisodes,
              settings.ShowOnlyAvailableEpisodes ? Translation.On : Translation.Off);
              string hideWatched = String.Format(Translation.HideWatchedEpisodes,
              settings.HideWatchedFiles ? Translation.On : Translation.Off);

              cmenu.AddAction(showEps, () =>
              {
              settings.ShowOnlyAvailableEpisodes = !settings.ShowOnlyAvailableEpisodes;
              LoadFacade();
              settings.Save();
              });
              cmenu.AddAction(hideWatched, () =>
              {
              settings.HideWatchedFiles = !settings.HideWatchedFiles;
              settings.Save();
              LoadFacade();
              });

              return cmenu.Show();
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:23,代码来源:MainWindow.cs

示例4: ShowContextMenuPostProcessing

        private ContextMenuAction ShowContextMenuPostProcessing(string previousMenu)
        {
            GUIListItem currentitem = m_Facade.SelectedListItem;
              if (currentitem == null)
            return ContextMenuAction.Exit;

              AnimeGroupVM grp = currentitem.TVTag as AnimeGroupVM;
              List<AnimeEpisodeVM> episodes = new List<AnimeEpisodeVM>();
              if (grp == null)
              {
            AnimeSeriesVM ser = currentitem.TVTag as AnimeSeriesVM;
            if (ser == null)
            {
              AnimeEpisodeVM ep = currentitem.TVTag as AnimeEpisodeVM;
              episodes.Add(ep);
            }
            else
            {
              foreach (AnimeEpisodeVM ep in ser.AllEpisodes)
              {
            episodes.Add(ep);
              }
            }
              }
              else
              {
            List<AnimeSeriesVM> seriesList = grp.AllSeries;
            foreach (AnimeSeriesVM ser in seriesList)
            {
              foreach (AnimeEpisodeVM ep in ser.AllEpisodes)
              {
            episodes.Add(ep);
              }
            }

              }

              //keep showing the dialog until the user closes it
              string currentMenu = "Associate with a ffdshow raw preset";
              int selectedLabel = 0;
              int intLabel = 0;

              FFDShowHelper ffdshowHelper = new FFDShowHelper();
              List<string> presets = ffdshowHelper.Presets;

              string selectedPreset = ffdshowHelper.findSelectedPresetForMenu(episodes);

              ContextMenu cmenu = new ContextMenu(Translation.AssociateFFDshowPreset, previousmenu: previousMenu);
              cmenu.AddAction(Translation.RemoveOldPresetAssociation, () =>
              {
            ffdshowHelper.deletePreset(episodes);
            Utils.DialogMsg(Translation.Confirmation, Translation.OldPresetRemove);
              });
              foreach (string preset in presets)
              {
            string local = preset;
            cmenu.AddAction(Translation.SetPreset + ": " + preset, () =>
            {
              ffdshowHelper.addPreset(episodes, local);
              Utils.DialogMsg(Translation.Confirmation, string.Format(Translation.PresetAdded, local));
            }, local == selectedPreset);
              }
              return cmenu.Show();
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:64,代码来源:MainWindow.cs

示例5: ShowContextMenuSeries

        private ContextMenuAction ShowContextMenuSeries(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
              if (currentitem == null)
            return ContextMenuAction.Exit;

              AnimeSeriesVM ser = currentitem.TVTag as AnimeSeriesVM;
              if (ser == null)
            return ContextMenuAction.Exit;

              ContextMenu cmenu = new ContextMenu(ser.SeriesName, previousmenu: previousMenu);
              cmenu.AddAction(Translation.SeriesInformation, () => ShowAnimeInfoWindow(ser));
              cmenu.AddAction(Translation.MarkAllAsWatched, () =>
              {
            if (ser.AnimeSeriesID.HasValue)
            {
              JMMServerHelper.SetWatchedStatusOnSeries(true, Int32.MaxValue, ser.AnimeSeriesID.Value);
              Contract_AnimeSeries contract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(ser.AnimeSeriesID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID);
              if (contract != null)
              {
            AnimeSeriesVM serTemp = new AnimeSeriesVM(contract);
            if(serTemp != null)
              Utils.PromptToRateSeriesOnCompletion(serTemp);
              }
              LoadFacade();
            }
              });
              cmenu.AddAction(Translation.MarkAllAsUnwatched, () =>
              {
            if (ser.AnimeSeriesID.HasValue)
            {
              JMMServerHelper.SetWatchedStatusOnSeries(false, Int32.MaxValue, ser.AnimeSeriesID.Value);
              LoadFacade();
            }
              });
              cmenu.AddAction(Translation.RateSeries, () =>
              {
              if (ser == null)
              {
              BaseConfig.MyAnimeLog.Write("Error during rating = series was null!");
              }
              if (ser.AnimeSeriesID.HasValue)
              {
              Utils.PromptToRateSeriesMaually(ser);
              }
              });
              cmenu.Add(Translation.Databases + " ...", () => ShowContextMenuDatabases(ser, ser.SeriesName));
              cmenu.Add(Translation.Images + " ...", () => ShowContextMenuImages(ser.SeriesName));
              cmenu.Add(Translation.EditSeries + " ...", () => ShowContextMenuSeriesEdit(ser.SeriesName));
              // ReSharper disable ImplicitlyCapturedClosure
              cmenu.AddAction(Translation.RandomEpisode, () =>
              // ReSharper restore ImplicitlyCapturedClosure
              {
            RandomWindow_CurrentEpisode = null;
            RandomWindow_CurrentSeries = null;
            RandomWindow_LevelObject = ser;
            RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Series;
            RandomWindow_RandomType = RandomObjectType.Episode;
            GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              cmenu.Add(Translation.PostProcessing + " ...", () => ShowContextMenuPostProcessing(ser.SeriesName));
              return cmenu.Show();
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:63,代码来源:MainWindow.cs

示例6: SearchTheMovieDB

        private ContextMenuAction SearchTheMovieDB(AnimeSeriesVM ser, string searchCriteria, string previousMenu)
        {
            if (searchCriteria.Length == 0)
            return ContextMenuAction.Exit;
              int aniDbid = ser.AniDB_Anime.AnimeID;

              List<MovieDBMovieSearchResultVM> movieDbSeriesSearchResults = new List<MovieDBMovieSearchResultVM>();
              List<Contract_MovieDBMovieSearchResult> movieResults = new List<Contract_MovieDBMovieSearchResult>(JMMServerVM.Instance.clientBinaryHTTP.SearchTheMovieDB(searchCriteria.Trim()));
              foreach (Contract_MovieDBMovieSearchResult movieResult in movieResults)
            movieDbSeriesSearchResults.Add(new MovieDBMovieSearchResultVM(movieResult));

              BaseConfig.MyAnimeLog.Write("Found {0} moviedb results for {1}", movieDbSeriesSearchResults.Count, searchCriteria);

              if (movieDbSeriesSearchResults.Count > 0)
              {
            ContextMenu cmenu = new ContextMenu(Translation.SearchResults, previousmenu: previousMenu);
            foreach (MovieDBMovieSearchResultVM res in movieDbSeriesSearchResults)
            {
              MovieDBMovieSearchResultVM local = res;
              cmenu.AddAction(res.MovieName, () => LinkAniDBToMovieDB(ser, aniDbid, local.MovieID));

            }
            return cmenu.Show();
              }
              this.Alert(Translation.SearchResults, string.Empty, Translation.NoResultsFound);
              return ContextMenuAction.Exit;
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:27,代码来源:MainWindow.cs

示例7: ShowContextMenuTrakt

        /*
        private ContextMenuAction ShowContextMenuTrakt(AnimeSeriesVM ser, string previousMenu)
        {
        GUIListItem currentitem = m_Facade.SelectedListItem;
        if (currentitem == null)
            return ContextMenuAction.Exit;

        string traktId;
        int season;
        string displayName;

        if (ser.AniDB_Anime.AniDB_AnimeCrossRefs != null && ser.AniDB_Anime.AniDB_AnimeCrossRefs.CrossRef_AniDB_Trakt != null
            && ser.AniDB_Anime.AniDB_AnimeCrossRefs.TraktShow != null)
        {
            displayName = ser.AniDB_Anime.AniDB_AnimeCrossRefs.TraktShow.Title;
            traktId = ser.AniDB_Anime.AniDB_AnimeCrossRefs.CrossRef_AniDB_Trakt.TraktID;
            season = ser.AniDB_Anime.AniDB_AnimeCrossRefs.CrossRef_AniDB_Trakt.TraktSeasonNumber;
        }
        else
            return ContextMenuAction.PreviousMenu;

        ContextMenu cmenu = new ContextMenu(displayName, previousmenu: previousMenu);
        // ReSharper disable ImplicitlyCapturedClosure
        cmenu.AddAction(Translation.RemoveTraktAssociation, () => JMMServerVM.Instance.clientBinaryHTTP.RemoveLinkAniDBTrakt(ser.AniDB_Anime.AnimeID));
        // ReSharper restore ImplicitlyCapturedClosure
        cmenu.Add(string.Format(Translation.SwitchSeason, season.ToString(Globals.Culture)), () => ShowSeasonSelectionMenuTrakt(ser, ser.AniDB_Anime.AnimeID, traktId, displayName));
        return cmenu.Show();
        }
        */
        private ContextMenuAction ShowContextMenuMovieDB(AnimeSeriesVM ser, string previousMenu)
        {
            GUIListItem currentitem = m_Facade.SelectedListItem;
              if (currentitem == null)
            return ContextMenuAction.Exit;

              string displayName;

              if (ser.CrossRef_AniDB_MovieDB != null && ser.AniDB_Anime.AniDB_AnimeCrossRefs != null &&
              ser.AniDB_Anime.AniDB_AnimeCrossRefs.MovieDB_Movie != null)
              {
            displayName = ser.AniDB_Anime.AniDB_AnimeCrossRefs.MovieDB_Movie.MovieName;
              }
              else
            return ContextMenuAction.PreviousMenu;
              ContextMenu cmenu = new ContextMenu(displayName, previousMenu);
              cmenu.AddAction(Translation.RemoveMovieDBAssociation, () => JMMServerVM.Instance.clientBinaryHTTP.RemoveLinkAniDBOther(ser.AniDB_Anime.AnimeID, (int)CrossRefType.MovieDB));
              return cmenu.Show();
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:48,代码来源:MainWindow.cs

示例8: ShowContextMenuSeriesInfo

        /*
        private bool ShowContextMenuSeriesInfo(string previousMenu)
        {
          GUIListItem currentitem = this.m_Facade.SelectedListItem;
          if (currentitem == null)
        return true;

          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 = "Series Information";
          while (true)
          {
        dlg.Reset();
        dlg.SetHeading(currentMenu);

        if (previousMenu != string.Empty)
          dlg.Add("<<< " + previousMenu);
        dlg.Add("Characters/Actors");
        dlg.Add("Related Series");

        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:
            ShowCharacterWindow();
            return false;
          case 2:
            ShowRelationsWindow();
            return false;
          default:
            //close menu
            return false;
        }
          }
        }
        */
        private ContextMenuAction ShowContextMenuGroupFilter(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
              if (currentitem == null)
            return ContextMenuAction.Exit;

              GroupFilterVM gf = currentitem.TVTag as GroupFilterVM;
              if (gf == null)
            return ContextMenuAction.Exit;

              ContextMenu cmenu = new ContextMenu(gf.GroupFilterName, previousmenu: previousMenu);
              cmenu.AddAction(Translation.RandomSeries, () =>
              {
            RandomWindow_CurrentEpisode = null;
            RandomWindow_CurrentSeries = null;
            RandomWindow_LevelObject = gf;
            RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
            RandomWindow_RandomType = RandomObjectType.Series;
            GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              cmenu.AddAction(Translation.RandomEpisode, () =>
              {
            RandomWindow_CurrentEpisode = null;
            RandomWindow_CurrentSeries = null;
            RandomWindow_LevelObject = gf;
            RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
            RandomWindow_RandomType = RandomObjectType.Episode;
            GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              return cmenu.Show();
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:78,代码来源:MainWindow.cs

示例9: ShowContextMenuImages

        private ContextMenuAction ShowContextMenuImages(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
              if (currentitem == null)
              return ContextMenuAction.Exit;

              AnimeSeriesVM ser = currentitem.TVTag as AnimeSeriesVM;
              IVM v = GetCurrent().Selected;

              string displayName;
              if (ser == null)
              {
              AnimeGroupVM grp = currentitem.TVTag as AnimeGroupVM;
              if (grp == null)
                  return ContextMenuAction.Exit;

              displayName = grp.GroupName;
              GlobalSeriesID = grp.AllSeries[0].AnimeSeriesID.Value;
              }
              else
              {
              displayName = ser.SeriesName;
              GlobalSeriesID = ser.AnimeSeriesID.Value;
              }

              ContextMenu cmenu = new ContextMenu(displayName, previousmenu: previousMenu);
              cmenu.AddAction(Translation.Fanart, ShowFanartWindow);
              cmenu.AddAction(Translation.Posters, ShowPostersWindow);
              cmenu.AddAction(Translation.WideBanners, ShowWideBannersWindow);
              return cmenu.Show();
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:31,代码来源:MainWindow.cs

示例10: ShowContextMenuEpisode

        private ContextMenuAction ShowContextMenuEpisode(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
              if (currentitem == null)
            return ContextMenuAction.Exit;

              GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
              if (dlg == null)
            return ContextMenuAction.Exit;

              AnimeEpisodeVM episode = currentitem.TVTag as AnimeEpisodeVM;
              if (episode == null)
            return ContextMenuAction.Exit;
              bool isWatched = (episode.IsWatched == 1);

              ContextMenu cmenu = new ContextMenu(episode.EpisodeNumberAndName, previousmenu: previousMenu);
              cmenu.AddAction(isWatched ? Translation.MarkAsUnwatched : Translation.MarkAsWatched, () =>
              {
            BaseConfig.MyAnimeLog.Write("Toggle watched status: {0} - {1}", isWatched, episode);
            episode.ToggleWatchedStatus(!isWatched);
            LoadFacade();
              });
              AnimeSeriesVM ser = GetTopSerie();
              AnimeEpisodeTypeVM e = GetTopEpType();
              enEpisodeType ept = enEpisodeType.Episode;
              if (e != null)
            ept = e.EpisodeType;
              cmenu.AddAction(Translation.MarkAllAsWatched, () =>
              {
              if (ser == null)
              {
              // If we can't get a top series we fallback on what the episode tells us
              BaseConfig.MyAnimeLog.Write("Error during watch state change - series was null!");
              ser = episode.AnimeSeries;
              }

              if (ser?.AnimeSeriesID != null)
              {
              BaseConfig.MyAnimeLog.Write("Marking series as watched: ID -> {0} - Name -> {1}", ser.AnimeSeriesID,
                  ser.SeriesName);

              JMMServerVM.Instance.clientBinaryHTTP.SetWatchedStatusOnSeries(ser.AnimeSeriesID.Value, true,
                  Int32.MaxValue, (int) ept, JMMServerVM.Instance.CurrentUser.JMMUserID);

              if (BaseConfig.Settings.DisplayRatingDialogOnCompletion)
              {
                  Contract_AnimeSeries contract =
                      JMMServerVM.Instance.clientBinaryHTTP.GetSeries(ser.AnimeSeriesID.Value,
                          JMMServerVM.Instance.CurrentUser.JMMUserID);
                  if (contract != null)
                  {
                      ser = new AnimeSeriesVM(contract);
                      if (ser?.AnimeSeriesID != null)
                          ReplaceSerie(ser.AnimeSeriesID.Value, ser);
                      Utils.PromptToRateSeriesOnCompletion(ser);
                  }
              }
              LoadFacade();
              }
              });
              cmenu.AddAction(Translation.MarkAllAsUnwatched, () =>
              {
              if (ser == null)
              {
              // If we can't get a top series we fallback on what the episode tells us
              BaseConfig.MyAnimeLog.Write("Error during watch state change - series was null!");
              ser = episode.AnimeSeries;
              }

              if (ser?.AnimeSeriesID != null)
              {
              BaseConfig.MyAnimeLog.Write("Marking series as un-watched: ID -> {0} - Name -> {1}", ser.AnimeSeriesID,
                  ser.SeriesName);

              JMMServerVM.Instance.clientBinaryHTTP.SetWatchedStatusOnSeries(ser.AnimeSeriesID.Value, false,
                  Int32.MaxValue, (int) ept, JMMServerVM.Instance.CurrentUser.JMMUserID);
              LoadFacade();
              }
              });
              cmenu.AddAction(Translation.MarkAllPreviousAsWatched, () =>
              {
              if (ser == null)
              {
              // If we can't get a top series we fallback on what the episode tells us
              BaseConfig.MyAnimeLog.Write("Error during watch state change - series was null!");
              ser = episode.AnimeSeries;
              }

              if (ser?.AnimeSeriesID != null)
              {
              JMMServerVM.Instance.clientBinaryHTTP.SetWatchedStatusOnSeries(ser.AnimeSeriesID.Value, false,
                  episode.EpisodeNumber - 1, (int)ept, JMMServerVM.Instance.CurrentUser.JMMUserID);

              Contract_AnimeSeries contract =
                  JMMServerVM.Instance.clientBinaryHTTP.GetSeries(ser.AnimeSeriesID.Value,
                      JMMServerVM.Instance.CurrentUser.JMMUserID);
              if (contract != null)
              {
                  ser = new AnimeSeriesVM(contract);
                  if (ser?.AnimeSeriesID != null)
//.........这里部分代码省略.........
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:101,代码来源:MainWindow.cs

示例11: ShowContextMenuGroup

        private ContextMenuAction ShowContextMenuGroup(string previousMenu)
        {
            GUIListItem currentitem = m_Facade.SelectedListItem;
              if (currentitem == null)
              return ContextMenuAction.Exit;
              AnimeGroupVM grp = currentitem.TVTag as AnimeGroupVM;
              if (grp == null)
              return ContextMenuAction.Exit;

              ContextMenu cmenu = new ContextMenu(grp.GroupName, previousmenu: previousMenu);

              if (grp.SubGroups.Count == 0)
              {
              cmenu.AddAction(grp.IsFave == 1 ? Translation.RemoveFromFavorites : Translation.AddToFavorites, () =>
              {
                  grp.IsFave = grp.IsFave == 1 ? 0 : 1;
                  grp.Save();
                  EvaluateVisibility();
              });
              }

              cmenu.AddAction(Translation.MarkAllAsWatched, () =>
              {
              foreach (AnimeSeriesVM ser in grp.AllSeries)
              {
                  if (ser.AnimeSeriesID.HasValue)
                      JMMServerHelper.SetWatchedStatusOnSeries(true, Int32.MaxValue, ser.AnimeSeriesID.Value);
              }
              LoadFacade();
              });
              cmenu.AddAction(Translation.MarkAllAsUnwatched, () =>
              {
              foreach (AnimeSeriesVM ser in grp.AllSeries)
              {
                  if (ser.AnimeSeriesID.HasValue)
                      JMMServerHelper.SetWatchedStatusOnSeries(false, Int32.MaxValue, ser.AnimeSeriesID.Value);
              }
              LoadFacade();
              });
              if (grp.AllSeries.Count == 1)
              {
              cmenu.AddAction(Translation.SeriesInformation, () => ShowAnimeInfoWindow(grp.AllSeries[0]));
              }
              History h = GetCurrent();
              if (h.Listing is GroupFilterVM)
              {
              GroupFilterVM gf = (GroupFilterVM) h.Listing;
              cmenu.Add(Translation.QuickSort + " ...", () =>
              {
                  string sortType = "";
                  GroupFilterSortDirection sortDirection = GroupFilterSortDirection.Asc;
                  if (gf.GroupFilterID.HasValue)
                  {
                      if (GroupFilterQuickSorts.ContainsKey(gf.GroupFilterID.Value))
                          sortDirection = GroupFilterQuickSorts[gf.GroupFilterID.Value].SortDirection;
                      if (!Utils.DialogSelectGFQuickSort(ref sortType, ref sortDirection, gf.GroupFilterName))
                      {
                          if (!GroupFilterQuickSorts.ContainsKey(gf.GroupFilterID.Value))
                              GroupFilterQuickSorts[gf.GroupFilterID.Value] = new QuickSort();
                          GroupFilterQuickSorts[gf.GroupFilterID.Value].SortType = sortType;
                          GroupFilterQuickSorts[gf.GroupFilterID.Value].SortDirection = sortDirection;
                          LoadFacade();
                          return ContextMenuAction.Exit;
                      }
                  }
                  return ContextMenuAction.Continue;
              });
              if ((gf.GroupFilterID.HasValue) && (GroupFilterQuickSorts.ContainsKey(gf.GroupFilterID.Value)))
              {
                  cmenu.AddAction(Translation.RemoveQuickSort, () =>
                  {
                      GroupFilterQuickSorts.Remove(gf.GroupFilterID.Value);
                      LoadFacade();
                  });
              }
              }

              // ReSharper disable ImplicitlyCapturedClosure
              cmenu.AddAction(Translation.RandomSeries, () =>
              // ReSharper restore ImplicitlyCapturedClosure
              {
              RandomWindow_CurrentEpisode = null;
              RandomWindow_CurrentSeries = null;
              RandomWindow_LevelObject = grp;
              RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Group;
              RandomWindow_RandomType = RandomObjectType.Series;
              GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              // ReSharper disable ImplicitlyCapturedClosure
              cmenu.AddAction(Translation.RandomEpisode, () =>
              // ReSharper restore ImplicitlyCapturedClosure
              {
              RandomWindow_CurrentEpisode = null;
              RandomWindow_CurrentSeries = null;
              RandomWindow_LevelObject = grp;
              RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Group;
              RandomWindow_RandomType = RandomObjectType.Episode;
              GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });

//.........这里部分代码省略.........
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:101,代码来源:MainWindow.cs

示例12: SearchTheTvDBMenu

        private ContextMenuAction SearchTheTvDBMenu(AnimeSeriesVM ser, string previousMenu)
        {
            //string searchCriteria = "";
              int aniDBID = ser.AniDB_Anime.AnimeID;
              ContextMenu cmenu = new ContextMenu(Translation.SearchTheTvDB, previousMenu);
              cmenu.Add(Translation.SearchUsing + ": " + ser.AniDB_Anime.FormattedTitle, () => SearchTheTvDB(ser, ser.AniDB_Anime.FormattedTitle, Translation.SearchTheTvDB));
              cmenu.Add(Translation.ManualSearch, () =>
              {
            if (Utils.DialogText(ref searchText, GetID))
              return SearchTheTvDB(ser, searchText, Translation.SearchTheTvDB);
            return ContextMenuAction.Continue;
              });

              List<CrossRef_AniDB_TvDBVMV2> CrossRef_AniDB_TvDBResult = new List<CrossRef_AniDB_TvDBVMV2>();
              List<JMMServerBinary.Contract_Azure_CrossRef_AniDB_TvDB> xrefs = new List<Contract_Azure_CrossRef_AniDB_TvDB>(JMMServerVM.Instance.clientBinaryHTTP.GetTVDBCrossRefWebCache(aniDBID, false));
              if (xrefs != null && xrefs.Count > 0)
              {
            string xrefSummary = string.Empty;
            foreach (JMMServerBinary.Contract_Azure_CrossRef_AniDB_TvDB xref in xrefs)
            {

              CrossRef_AniDB_TvDBVMV2 xrefAzure = new CrossRef_AniDB_TvDBVMV2(xref);
              CrossRef_AniDB_TvDBResult.Add(xrefAzure);
              xrefSummary += Environment.NewLine;
              xrefSummary += string.Format("AniDB {0}:{1} -- TvDB {2}: {3}:{4}",
            xref.AniDBStartEpisodeType, xref.AniDBStartEpisodeNumber, xref.TvDBTitle, xref.TvDBSeasonNumber, xref.TvDBStartEpisodeNumber);
            }

            cmenu.AddAction(Translation.CommunitySays + ": " + xrefSummary, () =>
            {
              string res = JMMServerVM.Instance.clientBinaryHTTP.RemoveLinkAniDBTvDBForAnime(aniDBID);
              if (res.Length > 0)
            Utils.DialogMsg(Translation.Error, res);
              else
              {
            foreach (CrossRef_AniDB_TvDBVMV2 xref in CrossRef_AniDB_TvDBResult)
            {
              LinkAniDBToTVDB(ser, xref.AnimeID, (enEpisodeType)xref.AniDBStartEpisodeType,
                              xref.AniDBStartEpisodeNumber, xref.TvDBID,
                              xref.TvDBSeasonNumber, xref.TvDBStartEpisodeNumber);
            }
              }
            });
              }
              return cmenu.Show();
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:46,代码来源:MainWindow.cs

示例13: SearchTheTvDB

        private ContextMenuAction SearchTheTvDB(AnimeSeriesVM ser, string searchCriteria, string previousMenu)
        {
            if (searchCriteria.Length == 0)
            return ContextMenuAction.Exit;

              int aniDBID = ser.AniDB_Anime.AnimeID;

              List<TVDBSeriesSearchResultVM> TVDBSeriesSearchResults = new List<TVDBSeriesSearchResultVM>();
              List<JMMServerBinary.Contract_TVDBSeriesSearchResult> tvResults = new List<Contract_TVDBSeriesSearchResult>(JMMServerVM.Instance.clientBinaryHTTP.SearchTheTvDB(searchCriteria.Trim()));
              foreach (JMMServerBinary.Contract_TVDBSeriesSearchResult tvResult in tvResults)
            TVDBSeriesSearchResults.Add(new TVDBSeriesSearchResultVM(tvResult));

              BaseConfig.MyAnimeLog.Write("Found {0} tvdb results for {1}", TVDBSeriesSearchResults.Count, searchCriteria);
              if (TVDBSeriesSearchResults.Count > 0)
              {
            ContextMenu cmenu = new ContextMenu(Translation.TVDBSearchResults, previousmenu: previousMenu);
            foreach (TVDBSeriesSearchResultVM res in TVDBSeriesSearchResults)
            {
              TVDBSeriesSearchResultVM local = res;
              string disp = String.Format("{0} ({1}) / {2}", res.SeriesName, res.Language, res.Id);
              cmenu.AddAction(disp, () => LinkAniDBToTVDB(ser, aniDBID, enEpisodeType.Episode, 1, local.SeriesID, 1, 1));
            }
            return cmenu.Show();
              }
              this.Alert(Translation.SearchResults, string.Empty, Translation.NoResultsFound);
              return ContextMenuAction.Exit;
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:27,代码来源:MainWindow.cs

示例14: SearchTheMovieDBMenu

        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();
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:21,代码来源:MainWindow.cs

示例15: ShowOptionsMenu

        /*
        private bool ShowOptionsMenu(string previousMenu)
        {
          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 = "Options";
          while (true)
          {
        dlg.Reset();
        dlg.SetHeading(currentMenu);

        if (previousMenu != string.Empty)
          dlg.Add("<<< " + previousMenu);
        dlg.Add("AniDB >>>");
        dlg.Add("Display >>>");

        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 (!ShowOptionsAniDBMenu(currentMenu))
        //	return false;
        break;
          case 2:
        if (!ShowOptionsDisplayMenu(currentMenu))
          return false;
        break;
          default:
        //close menu
        return false;
        }
          }
        }
        */
        private ContextMenuAction ShowOptionsDisplayMenu(string previousMenu)
        {
            string findFilter = String.Format(Translation.FindOnlyShowMatches,
              settings.FindFilter ? Translation.On : Translation.Off);
              ContextMenu cmenu = new ContextMenu(Translation.DisplayOptions, previousmenu: previousMenu);
              string askBeforeStreaming = String.Format(Translation.AskBeforeStartStreamingPlaybackDialogText,
              settings.AskBeforeStartStreamingPlayback ? Translation.On : Translation.Off);

              cmenu.AddAction(findFilter, () =>
              {
              settings.FindFilter = !settings.FindFilter;
              if (searchTimer.Enabled)
              {
                  SaveOrRestoreFacadeItems(false);
                  DoSearch(m_Facade.SelectedListItemIndex);
              }
              settings.Save();
              });

              cmenu.AddAction(askBeforeStreaming, () =>
              {
              settings.AskBeforeStartStreamingPlayback = !settings.AskBeforeStartStreamingPlayback;
              settings.Save();
              });

              return cmenu.Show();
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:72,代码来源:MainWindow.cs


注:本文中的System.Windows.Forms.ContextMenu.AddAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。