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, IRadioStationsService radioStationsService, ISettingsService settingsService) : base(resources, playlistsService, navigationService, playQueueService, cachingService, stateService, radioStationsService, settingsService) { }
public RadioEditPopupViewPresenter( ISearchService searchService, IRadioStationsService radioStationsService, Radio radio) { this.searchService = searchService; this.radioStationsService = radioStationsService; this.radio = radio; this.SaveCommand = new DelegateCommand(this.Save, this.CanSave); this.CancelCommand = new DelegateCommand(this.Cancel); this.Title = radio.Title; }
public PlaylistsService( IDependencyResolverContainer container, IRadioStationsService radioStationsService, IUserPlaylistsService userPlaylistsService, IApplicationResources applicationResources, ISettingsService settingsService) { this.container = container; this.radioStationsService = radioStationsService; this.userPlaylistsService = userPlaylistsService; this.applicationResources = applicationResources; this.settingsService = settingsService; }
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); } } } }); }
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 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.radioStationsService = container.Resolve <IRadioStationsService>(); this.navigationService = container.Resolve <INavigationService>(); this.settingsService = container.Resolve <ISettingsService>(); 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(x => !x.Metadata.UnknownSong) > 0); this.UnPinCommand = new DelegateCommand(this.UnPin, () => this.BindingModel != null && this.BindingModel.SongsBindingModel.SelectedItems.Count(x => !x.Metadata.UnknownSong) > 0); this.RateSongCommand = new DelegateCommand(this.RateSong); this.StartRadioCommand = new DelegateCommand(this.StartRadio, () => this.BindingModel != null && this.BindingModel.SongsBindingModel.SelectedItems.Count == 1); }
public PlayQueueService( ILogManager logManager, IMediaElementContainer mediaElement, ISettingsService settingsService, ISongsCachingService songsCachingService, ICurrentSongPublisherService publisherService, IGoogleMusicSessionService sessionService, IPlaylistsService playlistsService, IRadioStationsService radioStationsService, IEventAggregator eventAggregator) { this.logger = logManager.CreateLogger("PlayQueueService"); this.mediaElement = mediaElement; this.settingsService = settingsService; this.songsCachingService = songsCachingService; this.publisherService = publisherService; this.playlistsService = playlistsService; this.radioStationsService = radioStationsService; 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 UserPlaylistsPageViewPresenter( IApplicationResources resources, INavigationService navigationService, IPlayQueueService playQueueService, IPlaylistsService playlistsService, IUserPlaylistsService userPlaylistsService, 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.userPlaylistsService = userPlaylistsService; this.stateService = stateService; this.AddPlaylistCommand = new DelegateCommand(this.AddPlaylist); this.EditPlaylistCommand = new DelegateCommand(this.EditPlaylist, () => this.BindingModel.SelectedItems.Count == 1 && !((UserPlaylist)this.BindingModel.SelectedItems[0].Playlist).IsShared); this.DeletePlaylistsCommand = new DelegateCommand(this.DeletePlaylists, () => this.BindingModel.SelectedItems.Count > 0); }