示例#1
0
        private bool ShowMovieFiltersMenu()
        {
            var filters = new Dictionary <Filters, bool>();

            filters.Add(Filters.Watched, TraktSettings.PopularMoviesHideWatched);
            filters.Add(Filters.Watchlisted, TraktSettings.PopularMoviesHideWatchlisted);
            filters.Add(Filters.Collected, TraktSettings.PopularMoviesHideCollected);
            filters.Add(Filters.Rated, TraktSettings.PopularMoviesHideRated);

            var selectedItems = GUIUtils.ShowMultiSelectionDialog(Translation.Filters, GUICommon.GetFilterListItems(filters));

            if (selectedItems == null)
            {
                return(false);
            }

            foreach (var item in selectedItems.Where(l => l.Selected == true))
            {
                // toggle state of all selected items
                switch ((Filters)Enum.Parse(typeof(Filters), item.ItemID, true))
                {
                case Filters.Watched:
                    TraktSettings.PopularMoviesHideWatched = !TraktSettings.PopularMoviesHideWatched;
                    break;

                case Filters.Watchlisted:
                    TraktSettings.PopularMoviesHideWatchlisted = !TraktSettings.PopularMoviesHideWatchlisted;
                    break;

                case Filters.Collected:
                    TraktSettings.PopularMoviesHideCollected = !TraktSettings.PopularMoviesHideCollected;
                    break;

                case Filters.Rated:
                    TraktSettings.PopularMoviesHideRated = !TraktSettings.PopularMoviesHideRated;
                    break;
                }
            }

            return(true);
        }