Пример #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);
        }