Exemplo n.º 1
0
        private static IEnumerable <char> getChars(FilterBar FilterBar, FilterType FilterType)
        {
            switch (FilterType)
            {
            case FilterType.Playlist:
                return(from pl in Database.GetPlaylists(FilterBar.GetTracksWithoutFiltering(FilterType.Playlist, false))
                       group pl by Char.ToUpperInvariant(pl[0])
                       into g
                       select g.Key);

            case FilterType.Artist:
                return(from t in FilterBar.GetTracksWithoutFiltering(FilterType.Artist, false)
                       where t.MainGroupNoThe.Length > 0
                       group t by Char.ToUpperInvariant(t.MainGroupNoThe[0])
                       into g
                       select g.Key);

            case FilterType.Album:
                return(from t in FilterBar.GetTracksWithoutFiltering(FilterType.Album, false)
                       where t.Album.Length > 0
                       group t by Char.ToUpperInvariant(t.Album[0])
                       into g
                       select g.Key);

            case FilterType.Genre:
                return(from t in FilterBar.GetTracksWithoutFiltering(FilterType.Genre, false)
                       where t.Genre.Length > 0
                       group t by Char.ToUpperInvariant(t.Genre[0])
                       into g
                       select g.Key);

            case FilterType.Year:
                return(from t in FilterBar.GetTracksWithoutFiltering(FilterType.Year, false)
                       group t by t.DecadeChar
                       into g
                       select g.Key);

            case FilterType.Grouping:
                return(from t in FilterBar.GetTracksWithoutFiltering(FilterType.Grouping, false)
                       where t.Grouping.Length > 0
                       group t by Char.ToUpperInvariant(t.Grouping[0])
                       into g
                       select g.Key);

            default:
                return(new List <char>());
            }
        }
Exemplo n.º 2
0
        public void LoadFilterValues()
        {
            try
            {
                List <string> filterValues = null;

                FilterType Type = filterBar.CurrentFilterType;

                Track t = controller.UsersMostInterestingTrack;

                string hint = String.Empty;

                switch (Type)
                {
                case FilterType.Playlist:
                    filterValues = filterBar.GetPlaylistFilterValues();
                    break;

                case FilterType.Album:
                    filterValues = Database.GetAlbums(filterBar.GetTracksWithoutFiltering(Type, true));
                    if (t != null)
                    {
                        hint = t.Album;
                    }
                    break;

                case FilterType.Artist:
                    filterValues = Database.GetMainGroups(filterBar.GetTracksWithoutFiltering(Type, true));
                    if (t != null)
                    {
                        hint = t.MainGroup;
                    }
                    break;

                case FilterType.Genre:
                    filterValues = Database.GetGenres(filterBar.GetTracksWithoutFiltering(Type, true));
                    if (t != null)
                    {
                        hint = t.Genre;
                    }
                    break;

                case FilterType.Year:
                    filterValues = Database.GetYears(filterBar.GetTracksWithoutFiltering(Type, true));
                    if (t != null)
                    {
                        hint = t.YearString;
                    }
                    break;

                case FilterType.Grouping:
                    filterValues = Database.GetGroupings(filterBar.GetTracksWithoutFiltering(Type, true));
                    if (t != null)
                    {
                        hint = t.Grouping;
                    }
                    break;
                }

                filterValueList.LoadFilterValues(Type, filterValues, filterBar.CurrentFilterIsActive ? filterBar.CurrentFilterValue : String.Empty, hint);
            }
            catch { }
        }