コード例 #1
0
        public ArtistPanoramaViewModel(SynoItem artist, IEnumerable <AlbumViewModel> albums, int activePanelIndex, ISearchService searchService, IEventAggregator eventAggregator, IPageSwitchingService pageSwitchingService, INotificationService notificationService)
        {
            if (searchService == null)
            {
                throw new ArgumentNullException("searchService");
            }

            if (eventAggregator == null)
            {
                throw new ArgumentNullException("eventAggregator");
            }

            if (pageSwitchingService == null)
            {
                throw new ArgumentNullException("pageSwitchingService");
            }

            if (artist == null)
            {
                throw new ArgumentNullException("artist");
            }
            if (albums == null)
            {
                throw new ArgumentNullException("albums");
            }

            PlayLastCommand           = new DelegateCommand(OnPlayLast);
            PlayCommand               = new DelegateCommand(OnPlay);
            CurrentArtistItemIndex    = activePanelIndex;
            _searchService            = searchService;
            this._notificationService = notificationService;

            // TODO : Use IoC or Factory or whatever, but something to be able to inject our own implementation
            _panoramaItemSwitchingService = new PanoramaItemSwitchingService();

            _panoramaItemSwitchingService.ActiveItemChangeRequested += (s, e) => CurrentArtistItemIndex = e.NewItemIndex;
            _eventAggregator      = eventAggregator;
            _pageSwitchingService = pageSwitchingService;
            this.ArtistAlbums     = new ObservableCollection <AlbumViewModel>();
            foreach (var albumViewModel in albums)
            {
                this.ArtistAlbums.Add(albumViewModel);
            }

            this.ArtistAlbums.CollectionChanged += StartMonitoringElements;
            foreach (var album in this.ArtistAlbums)
            {
                album.PropertyChanged += UpdateBusyness;
            }

            ShowPlayQueueCommand = new DelegateCommand(OnShowPlayQueue);
            _artist    = artist;
            ArtistName = _artist.Title;
        }
コード例 #2
0
        public ArtistPanoramaViewModel(SynoItem artist, IEnumerable<AlbumViewModel> albums, int activePanelIndex, ISearchService searchService, IEventAggregator eventAggregator, IPageSwitchingService pageSwitchingService, INotificationService notificationService)
        {
            if (searchService == null)
            {
                throw new ArgumentNullException("searchService");
            }

            if (eventAggregator == null)
            {
                throw new ArgumentNullException("eventAggregator");
            }

            if (pageSwitchingService == null)
            {
                throw new ArgumentNullException("pageSwitchingService");
            }

            if (artist == null)
            {
                throw new ArgumentNullException("artist");
            }
            if (albums == null)
            {
                throw new ArgumentNullException("albums");
            }

            PlayLastCommand = new DelegateCommand(OnPlayLast);
            PlayCommand = new DelegateCommand(OnPlay);
            CurrentArtistItemIndex = activePanelIndex;
            _searchService = searchService;
            this._notificationService = notificationService;

            // TODO : Use IoC or Factory or whatever, but something to be able to inject our own implementation
            _panoramaItemSwitchingService = new PanoramaItemSwitchingService();

            _panoramaItemSwitchingService.ActiveItemChangeRequested += (s, e) => CurrentArtistItemIndex = e.NewItemIndex;
            _eventAggregator = eventAggregator;
            _pageSwitchingService = pageSwitchingService;
            this.ArtistAlbums = new ObservableCollection<AlbumViewModel>();
            foreach (var albumViewModel in albums)
            {
                this.ArtistAlbums.Add(albumViewModel);
            }

            this.ArtistAlbums.CollectionChanged += StartMonitoringElements;
            foreach (var album in this.ArtistAlbums)
            {
                album.PropertyChanged += UpdateBusyness;
            }

            ShowPlayQueueCommand = new DelegateCommand(OnShowPlayQueue);
            _artist = artist;
            ArtistName = _artist.Title;
        }