Ejemplo 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);
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void Search(object sender, TextChangedEventArgs e)
 {
     if (artists != null && sender.GetType() == typeof(TextBox))
     {
         TextBox box = sender as TextBox;
         if (box.Text != null && !string.IsNullOrWhiteSpace(box.Text))
         {
             SongPicker sp = new SongPicker(new List <artist>(artists.AsEnumerable()), box.Text);
             sp.ShowDialog();
             if (sp.DialogResult == true)
             {
                 List <song> songs = sp.Songs;
                 playlist.AddRange(songs);
                 NotifyPropertyChanged("Playlist");
             }
             box.Text = "";
         }
     }
 }