예제 #1
0
        public SongsPageViewModel(
            ILibraryCollectionService libraryCollectionService,
            ILibraryService libraryService,
            ISettingsUtility settingsUtility,
            IPlayerService playerService)
        {
            _libraryCollectionService = libraryCollectionService;
            _settingsUtility = settingsUtility;
            _playerService = playerService;
            LibraryService = libraryService;

            SortItems =
                Enum.GetValues(typeof (TrackSort))
                    .Cast<TrackSort>()
                    .Select(sort => new ListBoxItem { Content = sort.GetEnumText(), Tag = sort })
                    .ToList();
            SortChangedCommand = new DelegateCommand<ListBoxItem>(SortChangedExecute);
            ShuffleAllCommand = new DelegateCommand(ShuffleAllExecute);

            var defaultSort = _settingsUtility.Read(ApplicationSettingsConstants.SongSort,
                TrackSort.DateAdded,
                SettingsStrategy.Roam);
            DefaultSort = SortItems.IndexOf(SortItems.FirstOrDefault(p => (TrackSort)p.Tag == defaultSort));
            ChangeSort(defaultSort);
        }
예제 #2
0
        public SongsPageViewModel(
            ILibraryCollectionService libraryCollectionService,
            ILibraryService libraryService,
            ISettingsUtility settingsUtility,
            IPlayerService playerService)
        {
            _libraryCollectionService = libraryCollectionService;
            _settingsUtility          = settingsUtility;
            _playerService            = playerService;
            LibraryService            = libraryService;

            SortItems =
                Enum.GetValues(typeof(TrackSort))
                .Cast <TrackSort>()
                .Select(sort => new ListBoxItem {
                Content = sort.GetEnumText(), Tag = sort
            })
                .ToList();
            SortChangedCommand = new DelegateCommand <ListBoxItem>(SortChangedExecute);
            ShuffleAllCommand  = new DelegateCommand(ShuffleAllExecute);

            var defaultSort = _settingsUtility.Read(ApplicationSettingsConstants.SongSort,
                                                    TrackSort.DateAdded,
                                                    SettingsStrategy.Roam);

            DefaultSort = SortItems.IndexOf(SortItems.FirstOrDefault(p => (TrackSort)p.Tag == defaultSort));
            ChangeSort(defaultSort);
        }
예제 #3
0
        public ArtistsPageViewModel(
            ILibraryCollectionService libraryCollectionService,
            ILibraryService libraryService,
            IPlayerService playerService,
            INavigationService navigationService)
        {
            LibraryService = libraryService;
            _libraryCollectionService = libraryCollectionService;
            _playerService = playerService;
            _navigationService = navigationService;

            ArtistClickCommand = new DelegateCommand<ItemClickEventArgs>(ArtistClickExecute);
            SortChangedCommand = new DelegateCommand<ListBoxItem>(SortChangedExecute);
            ShuffleAllCommand = new DelegateCommand(ShuffleAllExecute);

            SortItems =
                Enum.GetValues(typeof (ArtistSort))
                    .Cast<ArtistSort>()
                    .Select(sort => new ListBoxItem { Content = sort.GetEnumText(), Tag = sort })
                    .ToList();
            ChangeSort(ArtistSort.AtoZ);
        }
예제 #4
0
        public ArtistsPageViewModel(
            ILibraryCollectionService libraryCollectionService,
            ILibraryService libraryService,
            IPlayerService playerService,
            INavigationService navigationService)
        {
            LibraryService            = libraryService;
            _libraryCollectionService = libraryCollectionService;
            _playerService            = playerService;
            _navigationService        = navigationService;

            ArtistClickCommand = new DelegateCommand <ItemClickEventArgs>(ArtistClickExecute);
            SortChangedCommand = new DelegateCommand <ListBoxItem>(SortChangedExecute);
            ShuffleAllCommand  = new DelegateCommand(ShuffleAllExecute);

            SortItems =
                Enum.GetValues(typeof(ArtistSort))
                .Cast <ArtistSort>()
                .Select(sort => new ListBoxItem {
                Content = sort.GetEnumText(), Tag = sort
            })
                .ToList();
            ChangeSort(ArtistSort.AtoZ);
        }