public void AddTrack(Track track, int Position = -1) { var item = track.GetListViewItem(PlaylistView); if (Position >= 0 && Position < PlaylistView.Items.Count) { Tracks.Insert(Position, track); PlaylistView.Items.Insert(Position, item); } else { Tracks.Add(track); PlaylistView.Items.Add(item); } }
public void Play(int Index) { if (Index >= Tracks.Count || Index < 0) { return; } Track track = Tracks[Index]; if (track.IsOnline || track.IsOffline) { track.Download(); PlaylistView.Items[Index] = track.GetListViewItem(PlaylistView); MainWindow.SavePlaylists(); } musicPlayer.CurrentTab = this; musicPlayer.CurrentTrack = track; musicPlayer.Stop(); musicPlayer.Load(track, this); musicPlayer.Play(); //RemoveTrack(Index); }