private void MenuItemNew_Click(object sender, RoutedEventArgs e) { AddPlaylist addUI = new AddPlaylist(); addUI.Owner = this; addUI.Controller = Controller; addUI.ShowDialog(); if (Controller.isAdded) { Controller.isAdded = false; Loading(); } }
public void editListViewItem(ListViewItem item) { foreach (PlaylistModel playlist in playlists) { if (playlist.PlaylistName == item.Text) { AddPlaylist form = new AddPlaylist(playlist, directories); form.ShowDialog(); playlist.PlaylistName = form.playlistName; item.Text = form.playlistName; playlist.MediaFiles.RemoveRange(0, playlist.MediaFiles.Count); foreach (MediaFileModel file in form.addPlaylist) { playlist.MediaFiles.Add(file); } item.Selected = true; _form.dataGridView1.Refresh(); Json.saveToJson(@".\playlists.json", playlists); } } }
public void createPlaylist() { AddPlaylist pForm = new AddPlaylist(directories); pForm.ShowDialog(); ListViewItem playlist = new ListViewItem(pForm.playlistName, _form.listViewLibrary.Groups[1]); PlaylistModel plist = new PlaylistModel(pForm.playlistName, new List <MediaFileModel>()); playlist.Selected = true; foreach (MediaFileModel file in pForm.addPlaylist) { plist.MediaFiles.Add(file); } playlists.Add(plist); _form.listViewLibrary.Items.Add(playlist); _form.dataGridView1.DataSource = plist.MediaFiles; Json.saveToJson(@".\playlists.json", playlists); }