Example #1
0
        private void OnAddToPlaylistClick(object sender, RoutedEventArgs e)
        {
            NewsFeedViewModel viewModel = (NewsFeedViewModel)this.DataContext;

            if (viewModel != null)
            {
                NewsFeedItem newsFeedItem = viewModel.GetCurrentNewsFeedItem();
                if (!newsFeedItem.Added)
                {
                    AddToPlaylistEventArgs eventArgs = new AddToPlaylistEventArgs(AddToPlaylistEvent, newsFeedItem.Album);
                    RaiseEvent(eventArgs);

                    newsFeedItem.Added = true;
                }
            }
        }
Example #2
0
        private void OnNewsFeedAddToPlaylist(object sender, RoutedEventArgs e)
        {
            AddToPlaylistEventArgs playlistArgs = (AddToPlaylistEventArgs)e;
            string   discoveryPlaylistName      = "Sound Atlas - Discovery";
            Playlist discoveryPlaylist          = this.PlaylistView.ViewModel.Playlists.Where(playlist => playlist.Name.Equals(discoveryPlaylistName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

            if (discoveryPlaylist == null)
            {
                //TODO: Prompt users.

                //Create the playlist in Spotify first.
                Playlist newPlaylist = SpotifyClientService.Client.CreatePlaylist(discoveryPlaylistName, SpotifyClientService.User.Id);

                this.NavigationControl.OnCreatePlaylist(newPlaylist);
            }
            else
            {
                this.NavigationControl.SelectPlaylist(discoveryPlaylist);
            }

            this.PlaylistView.ViewModel.AddAlbum(playlistArgs.Album);

            this.NewsFeedPopup.SetNotificationText(String.Format("{0} has been added to the {1} playlist.", playlistArgs.Album.Name, discoveryPlaylistName));
        }
        private void OnAddToPlaylistClick(object sender, RoutedEventArgs e)
        {
            NewsFeedViewModel viewModel = (NewsFeedViewModel)this.DataContext;

            if (viewModel != null)
            {
                NewsFeedItem newsFeedItem = viewModel.GetCurrentNewsFeedItem();
                if (!newsFeedItem.Added)
                {
                    AddToPlaylistEventArgs eventArgs = new AddToPlaylistEventArgs(AddToPlaylistEvent, newsFeedItem.Album);
                    RaiseEvent(eventArgs);

                    newsFeedItem.Added = true;
                }
            }
        }