public override void Execute(object sender, HandledEventArgs e) { var trackItem = _buffers.CurrentList.CurrentItem as TrackBufferItem; if (trackItem == null) { return; } var dialog = new AddToPlaylistWindow(); dialog.ShowDialog(); if (dialog.DialogResult != DialogResult.OK) { return; } IntPtr playlistPointer = IntPtr.Zero; if (dialog.ShouldAddNewPlaylist) { var newPlaylistPointer = spotify.CreateNewPlaylist(dialog.NewPlaylistName); if (newPlaylistPointer == IntPtr.Zero) { MessageBox.Show(StringStore.PlaylistNotCreated, StringStore.UnexpectedErrorOccurred, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } playlistPointer = newPlaylistPointer; } else { playlistPointer = dialog.ExistingPlaylistPointer; } var response = spotify.AddTrackToPlaylist(trackItem.Model.TrackPtr, playlistPointer); if (!response.IsError) { output.OutputMessageWithDelay(StringStore.TrackAdded, 1000); } else { MessageBox.Show(response.Message, StringStore.UnableToAddTrackToPlaylist, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e) { var image = e.AddedItems[0] as ComboBoxItem; string currentOperation = image.Content.ToString(); { } var ttp = sender as ComboBox; Audio audio = null; if (image != null && ttp.Tag is Audio) { //cartID = (image.Tag as Audio).UID; audio = (Audio)ttp.Tag; } if (audio != null) { Global_Log.audio = audio; selectedIndexValue = datagrid.SelectedIndex; { } playAllSong = new List <Audio>(); foreach (Audio item in datagrid.Items) { playAllSong.Add(item); } if (currentOperation == "Update") { Track_Metadata addMusic = new Track_Metadata(); //Global_Log.audio = audio; addMusic.updateSong(); } else if (currentOperation == "Delete") { Global_Log.playBack.DeleteSong(audio.ID); } else if (currentOperation == "Add to Playlist") { //Add_To_Playlist add_To_Playlist = new Add_To_Playlist(); //add_To_Playlist.ShowDialog(); AddToPlaylistWindow add_To_Playlist = new AddToPlaylistWindow(); add_To_Playlist.ShowDialog(); } else if (currentOperation == "Play") { //datagrid Global_Log.allSongTrack = true; int listcount = datagrid.Items.Count - 1; int selectedtrackIndex = datagrid.SelectedIndex; if (Global_Log.bottom_Media_Control == null) { Global_Log.bottom_Media_Control = new Bottom_Media_Control.Bottom_Media_Control(); } Global_Log.bottom_Media_Control.playSong(audio.Track, audio.Title, audio.Trim_Start, audio.Trim_End, audio.Intro, audio.EOM); } } LoadAllSong(); }