Beispiel #1
0
 public PlaylistsService(
     IDependencyResolverContainer container,
     IRadioWebService radioWebService)
 {
     this.container       = container;
     this.radioWebService = radioWebService;
 }
 public RadioEditPopupViewPresenter(
     ISearchService searchService,
     IRadioWebService radioWebService,
     RadioPlaylist radioPlaylist)
 {
     this.searchService   = searchService;
     this.radioWebService = radioWebService;
     this.radioPlaylist   = radioPlaylist;
     this.SaveCommand     = new DelegateCommand(this.Save, this.CanSave);
     this.CancelCommand   = new DelegateCommand(this.Cancel);
     this.Title           = radioPlaylist.Title;
 }
Beispiel #3
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);
 }
Beispiel #4
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 RadioStationsService(
            IRadioWebService radioWebService,
            IRadioStationsRepository radioStationsRepository,
            ISongsRepository songsRepository,
            INotificationService notificationService,
            IApplicationResources applicationResources,
            IEventAggregator eventAggregator,
            ILogManager logManager)
        {
            this.radioWebService         = radioWebService;
            this.radioStationsRepository = radioStationsRepository;
            this.songsRepository         = songsRepository;
            this.notificationService     = notificationService;
            this.applicationResources    = applicationResources;
            this.eventAggregator         = eventAggregator;

            this.logger = logManager.CreateLogger("RadioStationsService");
        }
        internal CurrentPlaylistPageViewPresenter(
            IApplicationResources resources,
            IPlayQueueService playQueueService,
            ISongsService metadataEditService,
            ISongsCachingService cachingService,
            IApplicationStateService stateService,
            INavigationService navigationService,
            IRadioWebService radioWebService,
            SongsBindingModel songsBindingModel)
        {
            this.resources           = resources;
            this.playQueueService    = playQueueService;
            this.metadataEditService = metadataEditService;
            this.cachingService      = cachingService;
            this.stateService        = stateService;
            this.navigationService   = navigationService;
            this.radioWebService     = radioWebService;
            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 > 0);
            this.UnPinCommand      = new DelegateCommand(this.UnPin, () => this.BindingModel.SelectedItems.Count > 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.ProviderSongId, args.CurrentSong.ProviderSongId, StringComparison.Ordinal));
                        if (currentSong != null)
                        {
                            await this.View.ScrollIntoCurrentSongAsync(currentSong);
                        }
                    }
                }
            });
        }
Beispiel #7
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(); });
        }
Beispiel #8
0
 public GoogleMusicSynchronizationService(
     ILogManager logManager,
     ISettingsService settingsService,
     IPlaylistsWebService playlistsWebService,
     ISongsWebService songsWebService,
     IRadioWebService radioWebService,
     IUserPlaylistsRepository userPlaylistsRepository,
     ISongsRepository songsRepository,
     IRadioStationsRepository radioStationsRepository,
     IConfigWebService configWebService)
 {
     this.logger                  = logManager.CreateLogger("GoogleMusicSynchronizationService");
     this.settingsService         = settingsService;
     this.playlistsWebService     = playlistsWebService;
     this.songsWebService         = songsWebService;
     this.radioWebService         = radioWebService;
     this.userPlaylistsRepository = userPlaylistsRepository;
     this.songsRepository         = songsRepository;
     this.radioStationsRepository = radioStationsRepository;
     this.configWebService        = configWebService;
 }