Esempio n. 1
0
 private void AddSongToPlaylist(object sender, RoutedEventArgs e)
 {
     if (PlaylistComboBox.SelectedValue != null)
     {
         playlist   pl = PlaylistComboBox.SelectedValue as playlist;
         SongPicker sp = new SongPicker(new List <artist>(artists.AsEnumerable()));
         sp.ShowDialog();
         if (sp.DialogResult == true)
         {
             var songs = sp.Songs;
             if (songs != null && songs.Count > 0)
             {
                 string PostContent = "";
                 foreach (song s in songs)
                 {
                     if (!pl.Songs.Contains(s))
                     {
                         PostContent += "uid=" + s.UID + "&";
                         pl.Songs.Add(s);
                     }
                 }
                 PostContent = PostContent.Substring(0, PostContent.Length - 1);
                 makeRequest("nores=add&post=" + pl.Name, true, PostContent);
             }
         }
     }
 }
Esempio n. 2
0
        private void AddPlaylist(object sender, MouseButtonEventArgs e)
        {
            player.stop();
            currentSong = null;
            player_changeState();
            song_change();
            playlist Playlist = ((playlist)((TreeViewItem)sender).DataContext);

            playlist.Clear();
            playlist.AddRange(Playlist.Songs);
            NotifyPropertyChanged("Playlist");
        }
Esempio n. 3
0
 private void ChangePlaylist(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         m_selectetPlaylist = e.AddedItems[0] as playlist;
     }
     else
     {
         m_selectetPlaylist = null;
     }
     NotifyPropertyChanged("SelectedPlaylist");
     NotifyPropertyChanged("PlaylistSelected");
 }
Esempio n. 4
0
 private void InsertPlaylist(object sender, RoutedEventArgs e)
 {
     if (PlaylistComboBox.SelectedValue != null)
     {
         player.stop();
         currentSong = null;
         player_changeState();
         song_change();
         playlist Playlist = PlaylistComboBox.SelectedValue as playlist;
         playlist.Clear();
         playlist.AddRange(Playlist.Songs);
         NotifyPropertyChanged("Playlist");
     }
 }
Esempio n. 5
0
        private void DelPlaylist(object sender, RoutedEventArgs e)
        {
            if (PlaylistComboBox.SelectedValue != null)
            {
                playlist pl = PlaylistComboBox.SelectedValue as playlist;
                makeRequest("api=pl&delete", true, "pl=" + pl.Name);

                PlaylistsList.Remove(pl);
                NotifyPropertyChanged("PlaylistsList");

                PlaylistComboBox.SelectedValue = null;
                m_selectetPlaylist             = null;
                NotifyPropertyChanged("SelectedPlaylist");
                NotifyPropertyChanged("PlaylistSelected");
            }
        }
Esempio n. 6
0
 private void DelSongFromPlaylist(object sender, RoutedEventArgs e)
 {
     if (PlaylistComboBox.SelectedValue != null && PlaylistSongs.SelectedItems != null && PlaylistSongs.SelectedItems.Count > 0)
     {
         playlist    pl    = PlaylistComboBox.SelectedValue as playlist;
         List <song> songs = new List <song>(PlaylistSongs.SelectedItems.Cast <song>());
         // TODO:
         string PostContent = "pl=" + pl.Name + "&";
         foreach (song Song in songs)
         {
             PostContent += "uid=" + Song.UID + "&";
             pl.Songs.Remove(Song);
         }
         PostContent = PostContent.Substring(0, PostContent.Length - 1);
         makeRequest("api=pl&delete=track", true, PostContent);
         NotifyPropertyChanged("SelectedPlaylist");
     }
 }