コード例 #1
0
        public void ChangeSort(TrackSort sort)
        {
            _settingsUtility.Write(ApplicationSettingsConstants.SongSort, sort, SettingsStrategy.Roam);
            ViewSource = new CollectionViewSource {
                IsSourceGrouped = sort != TrackSort.DateAdded
            };

            switch (sort)
            {
            case TrackSort.AtoZ:
                ViewSource.Source = _libraryCollectionService.TracksByTitle;
                break;

            case TrackSort.DateAdded:
                ViewSource.Source = _libraryCollectionService.TracksByDateAdded;
                break;

            case TrackSort.Artist:
                ViewSource.Source = _libraryCollectionService.TracksByArtist;
                break;

            case TrackSort.Album:
                ViewSource.Source = _libraryCollectionService.TracksByAlbum;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(sort), sort, null);
            }
        }
コード例 #2
0
        public void ChangeSort(TrackSort sort)
        {
            _settingsUtility.Write(ApplicationSettingsConstants.SongSort, sort, SettingsStrategy.Roam);
            ViewSource = new CollectionViewSource { IsSourceGrouped = sort != TrackSort.DateAdded };

            switch (sort)
            {
                case TrackSort.AtoZ:
                    ViewSource.Source = _libraryCollectionService.TracksByTitle;
                    break;
                case TrackSort.DateAdded:
                    ViewSource.Source = _libraryCollectionService.TracksByDateAdded;
                    break;
                case TrackSort.Artist:
                    ViewSource.Source = _libraryCollectionService.TracksByArtist;
                    break;
                case TrackSort.Album:
                    ViewSource.Source = _libraryCollectionService.TracksByAlbum;
                    break;
                default:
                    throw new ArgumentOutOfRangeException(nameof(sort), sort, null);
            }
        }