Ejemplo n.º 1
0
        private void addBtn_Click(object sender, EventArgs e)
        {
            var allSongs = _service.GetAllSongs(_dataStorage.CurrentSelectedPartyId).ToList();
            var isAdded  = false;

            allSongs.ForEach(track =>
            {
                if (track.songURL.Equals(_lastTrackUri))
                {
                    isAdded = true;
                }
            });
            if (isAdded)
            {
                return;
            }

            if (_currentTrack != null)
            {
                _service.AddSongInPartyPlaylist(_dataStorage.CurrentSelectedPartyId, _lastTrackUri, 0);
                getSongsBtn_Click(sender, e);
            }
            else if (searchResultLB.SelectedIndex >= 0)
            {
                _service.AddSongInPartyPlaylist(_dataStorage.CurrentSelectedPartyId, _uris[searchResultLB.SelectedIndex], 0);
                getSongsBtn_Click(sender, e);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add a song to the party's playlist
        /// </summary>
        private void AddSong()
        {
            if (SearchResultLB.SelectedIndex < 0)
            {
                return;
            }

            var selectedSearchUri = _searchUriList[SearchResultLB.SelectedIndex];
            var freshPlaylist     = _service.GetAllSongs(_dataStorage.CurrentSelectedPartyId).ToList();
            var isAdded           = false;

            freshPlaylist.ForEach(song =>
            {
                if (song.songURL.Equals(selectedSearchUri))
                {
                    isAdded = true;
                }
            });

            if (isAdded)
            {
                return;
            }

            _service.AddSongInPartyPlaylist(_dataStorage.CurrentSelectedPartyId, selectedSearchUri, 0);
        }