protected PlaylistsPageViewPresenterBase(
            IApplicationResources resources,
            IPlaylistsService playlistsService,
            INavigationService navigationService,
            IPlayQueueService playQueueService,
            ISongsCachingService cachingService,
            IApplicationStateService stateService,
            IRadioStationsService radioStationsService,
            ISettingsService settingsService)
        {
            this.resources            = resources;
            this.playlistsService     = playlistsService;
            this.navigationService    = navigationService;
            this.playQueueService     = playQueueService;
            this.cachingService       = cachingService;
            this.stateService         = stateService;
            this.radioStationsService = radioStationsService;
            this.settingsService      = settingsService;

            Func <bool> canExecute = () => this.BindingModel.SelectedItems.Count > 0 &&
                                     this.BindingModel.SelectedItems.All(x => (x.Playlist.PlaylistType == PlaylistType.UserPlaylist && !((UserPlaylist)x.Playlist).IsShared));

            this.PlayCommand       = new DelegateCommand(this.Play);
            this.QueueCommand      = new DelegateCommand(this.Queue, canExecute);
            this.DownloadCommand   = new DelegateCommand(this.Download, canExecute);
            this.UnPinCommand      = new DelegateCommand(this.UnPin, canExecute);
            this.StartRadioCommand = new DelegateCommand(this.StartRadio, () => this.BindingModel != null && this.BindingModel.SelectedItems.Count == 1);
        }
 public PlaylistsPageViewPresenter(
     IApplicationResources resources,
     IPlaylistsService playlistsService,
     INavigationService navigationService,
     IPlayQueueService playQueueService,
     ISongsCachingService cachingService,
     IApplicationStateService stateService)
     : base(resources, playlistsService, navigationService, playQueueService, cachingService, stateService)
 {
 }
Exemple #3
0
 public InitialSynchronization(
     ILogManager logManager,
     IGoogleMusicSynchronizationService synchronizationService,
     ISongsCachingService songsCachingService,
     IAlbumArtCacheService albumArtCacheService)
 {
     this.dbContext = new DbContext();
     this.logger    = logManager.CreateLogger("InitialSynchronization");
     this.synchronizationService = synchronizationService;
     this.songsCachingService    = songsCachingService;
     this.albumArtCacheService   = albumArtCacheService;
 }
        internal CurrentPlaylistPageViewPresenter(
            IApplicationResources resources,
            IPlayQueueService playQueueService,
            ISongsService metadataEditService,
            ISongsCachingService cachingService,
            IApplicationStateService stateService,
            INavigationService navigationService,
            IRadioStationsService radioStationsService,
            ISettingsService settingsService,
            SongsBindingModel songsBindingModel)
        {
            this.resources            = resources;
            this.playQueueService     = playQueueService;
            this.metadataEditService  = metadataEditService;
            this.cachingService       = cachingService;
            this.stateService         = stateService;
            this.navigationService    = navigationService;
            this.radioStationsService = radioStationsService;
            this.settingsService      = settingsService;
            this.BindingModel         = songsBindingModel;

            this.playQueueService.QueueChanged += async(sender, args) => await this.Dispatcher.RunAsync(this.UpdateSongs);

            //this.SaveAsPlaylistCommand = new DelegateCommand(this.SaveAsPlaylist, () => this.BindingModel.Songs.Count > 0);
            this.RemoveSelectedSongCommand = new DelegateCommand(this.RemoveSelectedSong, () => this.BindingModel.SelectedItems.Count > 0);
            this.AddToPlaylistCommand      = new DelegateCommand(this.AddToPlaylist, () => this.BindingModel.SelectedItems.Count > 0);
            this.RateSongCommand           = new DelegateCommand(this.RateSong);
            this.DownloadCommand           = new DelegateCommand(this.Download, () => this.BindingModel.SelectedItems.Count(x => !x.Metadata.UnknownSong) > 0);
            this.UnPinCommand      = new DelegateCommand(this.UnPin, () => this.BindingModel.SelectedItems.Count(x => !x.Metadata.UnknownSong) > 0);
            this.StartRadioCommand = new DelegateCommand(this.StartRadio, () => this.BindingModel != null && this.BindingModel.SelectedItems.Count == 1);

            this.playQueueService.StateChanged += async(sender, args) => await this.Dispatcher.RunAsync(async() =>
            {
                if (this.BindingModel.SelectedItems.Count == 0)
                {
                    if (this.BindingModel.Songs != null && args.CurrentSong != null)
                    {
                        var currentSong = this.BindingModel.Songs.FirstOrDefault(x => string.Equals(x.Metadata.SongId, args.CurrentSong.SongId, StringComparison.Ordinal));
                        if (currentSong != null)
                        {
                            await this.View.ScrollIntoCurrentSongAsync(currentSong);
                        }
                    }
                }
            });
        }
Exemple #5
0
 public RadioPageViewPresenter(
     IApplicationResources resources,
     IPlaylistsService playlistsService,
     INavigationService navigationService,
     IPlayQueueService playQueueService,
     ISongsCachingService cachingService,
     IApplicationStateService stateService,
     IRadioWebService radioWebService)
     : base(resources, playlistsService, navigationService, playQueueService, cachingService, stateService)
 {
     this.resources            = resources;
     this.navigationService    = navigationService;
     this.playQueueService     = playQueueService;
     this.radioWebService      = radioWebService;
     this.EditRadioNameCommand = new DelegateCommand(this.EditRadioName, () => this.BindingModel.SelectedItems.Count == 1);
     this.DeleteRadioCommand   = new DelegateCommand(this.DeleteRadio, () => this.BindingModel.SelectedItems.Count > 0);
 }
 public UserPlaylistsPageViewPresenter(
     IApplicationResources resources,
     INavigationService navigationService,
     IPlayQueueService playQueueService,
     IPlaylistsService playlistsService,
     IUserPlaylistsService userPlaylistsService,
     ISongsCachingService cachingService,
     IApplicationStateService stateService)
     : base(resources, playlistsService, navigationService, playQueueService, cachingService, stateService)
 {
     this.resources              = resources;
     this.userPlaylistsService   = userPlaylistsService;
     this.stateService           = stateService;
     this.AddPlaylistCommand     = new DelegateCommand(this.AddPlaylist);
     this.EditPlaylistCommand    = new DelegateCommand(this.EditPlaylist, () => this.BindingModel.SelectedItems.Count == 1);
     this.DeletePlaylistsCommand = new DelegateCommand(this.DeletePlaylists, () => this.BindingModel.SelectedItems.Count > 0);
 }
Exemple #7
0
        public PlaylistPageViewPresenterBase(IDependencyResolverContainer container)
        {
            this.playQueueService    = container.Resolve <IPlayQueueService>();
            this.metadataEditService = container.Resolve <ISongsService>();
            this.playlistsService    = container.Resolve <IPlaylistsService>();
            this.resources           = container.Resolve <IApplicationResources>();
            this.cachingService      = container.Resolve <ISongsCachingService>();
            this.stateService        = container.Resolve <IApplicationStateService>();
            this.radioWebService     = container.Resolve <IRadioWebService>();
            this.navigationService   = container.Resolve <INavigationService>();

            this.QueueCommand         = new DelegateCommand(this.Queue, () => this.BindingModel != null && this.BindingModel.SongsBindingModel.SelectedItems.Count > 0);
            this.AddToPlaylistCommand = new DelegateCommand(this.AddToPlaylist, () => this.BindingModel != null && this.BindingModel.SongsBindingModel.SelectedItems.Count > 0);
            this.DownloadCommand      = new DelegateCommand(this.Download, () => this.BindingModel != null && this.BindingModel.SongsBindingModel.SelectedItems.Count > 0);
            this.UnPinCommand         = new DelegateCommand(this.UnPin, () => this.BindingModel != null && this.BindingModel.SongsBindingModel.SelectedItems.Count > 0);
            this.RateSongCommand      = new DelegateCommand(this.RateSong);
            this.StartRadioCommand    = new DelegateCommand(this.StartRadio, () => this.BindingModel != null && this.BindingModel.SongsBindingModel.SelectedItems.Count == 1);
        }
 public RadioPageViewPresenter(
     IApplicationResources resources,
     IPlaylistsService playlistsService,
     INavigationService navigationService,
     IPlayQueueService playQueueService,
     ISongsCachingService cachingService,
     IApplicationStateService stateService,
     IRadioStationsService radioStationsService,
     ISettingsService settingsService)
     : base(resources, playlistsService, navigationService, playQueueService, cachingService, stateService, radioStationsService, settingsService)
 {
     this.resources            = resources;
     this.navigationService    = navigationService;
     this.playQueueService     = playQueueService;
     this.radioStationsService = radioStationsService;
     this.EditRadioNameCommand = new DelegateCommand(this.EditRadioName, () => this.BindingModel.SelectedItems.Count == 1);
     this.DeleteRadioCommand   = new DelegateCommand(this.DeleteRadio, () => this.BindingModel.SelectedItems.Count > 0 && this.BindingModel.SelectedItems.All(x => !string.IsNullOrEmpty(x.Playlist.Id)));
 }
        public StartPageViewPresenter(
            IApplicationResources resources,
            ISettingsService settingsService,
            IAuthentificationService authentificationService,
            INavigationService navigationService,
            IPlayQueueService playQueueService,
            IPlaylistsService playlistsService,
            IMainFrameRegionProvider mainFrameRegionProvider,
            IGoogleMusicSessionService sessionService,
            ISearchService searchService,
            ISongsCachingService cachingService,
            IApplicationStateService stateService)
        {
            this.resources               = resources;
            this.settingsService         = settingsService;
            this.authentificationService = authentificationService;
            this.playQueueService        = playQueueService;
            this.navigationService       = navigationService;
            this.playlistsService        = playlistsService;
            this.mainFrameRegionProvider = mainFrameRegionProvider;
            this.sessionService          = sessionService;
            this.searchService           = searchService;
            this.cachingService          = cachingService;
            this.stateService            = stateService;

            Func <bool> canExecute = () => this.BindingModel.SelectedItems.Count > 0 &&
                                     this.BindingModel.SelectedItems.All(x =>
                                                                         x.Playlist.PlaylistType != PlaylistType.Radio ||
                                                                         (x.Playlist.PlaylistType == PlaylistType.UserPlaylist && !((UserPlaylist)x.Playlist).IsShared));

            this.PlayCommand     = new DelegateCommand(this.Play);
            this.QueueCommand    = new DelegateCommand(this.Queue, canExecute);
            this.DownloadCommand = new DelegateCommand(this.Download, canExecute);
            this.UnPinCommand    = new DelegateCommand(this.UnPin, canExecute);

            this.sessionService.SessionCleared += async(sender, args) =>
            {
                await this.DeinitializeAsync();

                this.ShowAuthentificationPopupView();
            };
        }
Exemple #10
0
        protected PlaylistsPageViewPresenterBase(
            IApplicationResources resources,
            IPlaylistsService playlistsService,
            INavigationService navigationService,
            IPlayQueueService playQueueService,
            ISongsCachingService cachingService,
            IApplicationStateService stateService)
        {
            this.resources         = resources;
            this.playlistsService  = playlistsService;
            this.navigationService = navigationService;
            this.playQueueService  = playQueueService;
            this.cachingService    = cachingService;
            this.stateService      = stateService;

            this.PlayCommand     = new DelegateCommand(this.Play);
            this.QueueCommand    = new DelegateCommand(this.Queue, () => this.BindingModel.SelectedItems.Count > 0);
            this.DownloadCommand = new DelegateCommand(this.Download, () => this.BindingModel.SelectedItems.Count > 0);
            this.UnPinCommand    = new DelegateCommand(this.UnPin, () => this.BindingModel.SelectedItems.Count > 0);
        }
Exemple #11
0
        public PlayQueueService(
            ILogManager logManager,
            IMediaElementContainer mediaElement,
            ISettingsService settingsService,
            ISongsCachingService songsCachingService,
            ICurrentSongPublisherService publisherService,
            IGoogleMusicSessionService sessionService,
            IPlaylistsService playlistsService,
            IRadioWebService radioWebService,
            IEventAggregator eventAggregator)
        {
            this.logger              = logManager.CreateLogger("PlayQueueService");
            this.mediaElement        = mediaElement;
            this.settingsService     = settingsService;
            this.songsCachingService = songsCachingService;
            this.publisherService    = publisherService;
            this.playlistsService    = playlistsService;
            this.radioWebService     = radioWebService;
            this.eventAggregator     = eventAggregator;
            this.currentQueueIndex   = -1;

            this.IsRepeatAll = this.settingsService.GetValue("IsRepeatAllEnabled", defaultValue: false);
            this.IsShuffled  = this.settingsService.GetValue("IsShuffleEnabled", defaultValue: false);

            this.State = QueueState.Unknown;

            this.mediaElement.MediaEnded += async(sender, args) =>
            {
                if (this.CanSwitchToNext())
                {
                    await this.NextSongAsync();
                }
                else
                {
                    this.State = QueueState.Stopped;
                }
            };

            sessionService.SessionCleared += async(sender, args) => { await ClearQueueAsync(); };
            eventAggregator.GetEvent <ReloadSongsEvent>().Subscribe(async(e) => { await ClearQueueAsync(); });
        }
        public OfflineCacheViewPresenter(
            IApplicationStateService stateService,
            IAlbumArtCacheService albumArtCacheService,
            ISongsCachingService songsCachingService,
            OfflineCacheViewBindingModel bindingModel,
            ISongsCachingService cachingService,
            IGoogleMusicSessionService sessionService)
        {
            this.stateService         = stateService;
            this.albumArtCacheService = albumArtCacheService;
            this.songsCachingService  = songsCachingService;
            this.cachingService       = cachingService;
            this.sessionService       = sessionService;
            this.BindingModel         = bindingModel;

            this.BindingModel.IsLoading = true;

            this.ClearAlbumArtsCacheCommand = new DelegateCommand(this.ClearAlbumArtsCache, () => this.sessionService.GetSession().IsAuthenticated&& !this.BindingModel.IsLoading);
            this.ClearSongsCacheCommand     = new DelegateCommand(this.ClearSongsCache, () => this.sessionService.GetSession().IsAuthenticated&& !this.BindingModel.IsLoading);
            this.CancelTaskCommand          = new DelegateCommand(this.CancelTask, (e) => this.sessionService.GetSession().IsAuthenticated&& !this.BindingModel.IsLoading);
            this.StartDownloadCommand       = new DelegateCommand(this.StartDownload, () => this.sessionService.GetSession().IsAuthenticated&& !this.BindingModel.IsLoading && this.stateService.IsOnline() && !this.cachingService.IsDownloading() && !this.BindingModel.IsQueueEmpty);
        }
        internal ArtistPageViewPresenter(
            IApplicationResources resources,
            IPlayQueueService playQueueService,
            INavigationService navigationService,
            IPlaylistsService playlistsService,
            IAlbumsRepository albumsRepository,
            ISongsCachingService cachingService,
            IApplicationStateService stateService)
        {
            this.resources         = resources;
            this.playQueueService  = playQueueService;
            this.navigationService = navigationService;
            this.playlistsService  = playlistsService;
            this.albumsRepository  = albumsRepository;
            this.cachingService    = cachingService;
            this.stateService      = stateService;
            this.PlayCommand       = new DelegateCommand(this.Play);
            this.ShowAllCommand    = new DelegateCommand(this.ShowAll);

            this.QueueCommand    = new DelegateCommand(this.Queue, () => this.BindingModel.SelectedItems.Count > 0);
            this.DownloadCommand = new DelegateCommand(this.Download, () => this.BindingModel.SelectedItems.Count > 0);
            this.UnPinCommand    = new DelegateCommand(this.UnPin, () => this.BindingModel.SelectedItems.Count > 0);
        }
        public StartPageViewPresenter(
            IApplicationResources resources,
            ISettingsService settingsService,
            IAuthentificationService authentificationService,
            INavigationService navigationService,
            IPlayQueueService playQueueService,
            IPlaylistsService playlistsService,
            IMainFrameRegionProvider mainFrameRegionProvider,
            IGoogleMusicSessionService sessionService,
            ISearchService searchService,
            ISongsCachingService cachingService,
            IApplicationStateService stateService)
        {
            this.resources               = resources;
            this.settingsService         = settingsService;
            this.authentificationService = authentificationService;
            this.playQueueService        = playQueueService;
            this.navigationService       = navigationService;
            this.playlistsService        = playlistsService;
            this.mainFrameRegionProvider = mainFrameRegionProvider;
            this.sessionService          = sessionService;
            this.searchService           = searchService;
            this.cachingService          = cachingService;
            this.stateService            = stateService;

            this.PlayCommand     = new DelegateCommand(this.Play);
            this.QueueCommand    = new DelegateCommand(this.Queue, () => this.BindingModel.SelectedItems.Count > 0);
            this.DownloadCommand = new DelegateCommand(this.Download, () => this.BindingModel.SelectedItems.Count > 0);
            this.UnPinCommand    = new DelegateCommand(this.UnPin, () => this.BindingModel.SelectedItems.Count > 0);

            this.sessionService.SessionCleared += async(sender, args) =>
            {
                await this.DeinitializeAsync();

                this.ShowAuthentificationPopupView();
            };
        }