private void DeleteSong_Click(object sender, RoutedEventArgs e) { DataRowView selected = musicDataGrid.SelectedItem as DataRowView; if (selected == null) { return; } int songID; if (selected.Row.ItemArray[0].GetType() == typeof(string)) { songID = Int32.Parse(selected.Row.ItemArray[0] as string); } else { songID = (int)selected.Row.ItemArray[0]; } string playlist = playListBox.SelectedItem as string; if (musicLib.PlaylistExists(playlist)) { int songPosition; if (selected.Row.ItemArray[1].GetType() == typeof(string)) { songPosition = Int32.Parse(selected.Row.ItemArray[1] as string); } else { songPosition = (int)selected.Row.ItemArray[1]; } musicLib.RemoveSongFromPlaylist(songPosition, songID, playlist); dataView.Table = musicLib.SongsForPlaylist(playlist); } else if (playlist == "All Music" || playlist == null) { var dw = new DeleteWindow(); var result = dw.ShowDialog(); if (result == true) { musicLib.DeleteSong(songID); } } }
//Метод, вызывает диалог удаления файла public void DeleteFilesDialog() { List <FileSystemInfo> list = new List <FileSystemInfo>(); foreach (var itm in lvFileList.SelectedItems) { if (itm.GetType() != typeof(ParentDirectoryCover)) { CustomFileSystemCover fsi = (CustomFileSystemCover)itm; list.Add(fsi.FileSystemElement); } } DeleteWindow dw = new DeleteWindow(list); dw.ShowDialog(); }
//Метод, вызывает диалог удаления файла public void DeleteFilesDialog() { List<FileSystemInfo> list = new List<FileSystemInfo>(); foreach (var itm in lvFileList.SelectedItems) { if (itm.GetType() != typeof(ParentDirectoryCover)) { CustomFileSystemCover fsi = (CustomFileSystemCover)itm; list.Add(fsi.FileSystemElement); } } DeleteWindow dw = new DeleteWindow(list); dw.ShowDialog(); }
private void Delete(object sender, RoutedEventArgs e) { DeleteWindow deleteWindow = new DeleteWindow(); deleteWindow.ShowDialog(); }