private void _createPlaylist_Click(object sender, EventArgs e) { using (DialogBox dialogbox = new DialogBox()) { dialogbox.textboxdata = ""; if (dialogbox.ShowDialog() == System.Windows.Forms.DialogResult.OK) { spl.playlistname = dialogbox.textboxdata; datafuncs.createPlaylist(spl, dialogbox.textboxdata); } } listinscope.Clear(); _playlistListView.Items.Add(spl.playlistname); selectedPL = spl; allplaylists.Add(selectedPL); if (spl.whizzyfilelist != null && spl.whizzyfilelist.Count != 0) { spl.whizzyfilelist.Clear(); } ; if (_playlistListView.Items != null) { clearlistview(); } _playlistName.Text = selectedPL.playlistname; isSessionPL = false; }
private void _commentEdit_Click(object sender, EventArgs e) { if (_fileListView.SelectedItems.Count != 0) { Whizzyfile sfile = selectedPL.whizzyfilelist.Find(item => item.Filepath == _fileListView.SelectedItems[0].SubItems[1].Text); using (DialogBox dialogbox = new DialogBox()) { dialogbox.boxTitle = "Edit Comment"; dialogbox.labelText = "Add or edit your comment here"; if (sfile.Filecomment != null) { dialogbox.textboxdata = null; dialogbox.textboxdata = sfile.Filecomment; } if (dialogbox.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (!isSessionPL) { sfile.Filecomment = dialogbox.textboxdata; datafuncs.savePlaylist(selectedPL, selectedPL.playlistname); _fileListView.Items.Clear(); funcs.populateListView(_fileListView, selectedPL); } } } } else { MessageBox.Show("Please select a file edit", "Select file"); } }
private void _saveToPlaylist_Click(object sender, EventArgs e) { bool exists = savefuncs.checkExists(_playlistTextBox.Text); if (exists) { savefuncs.saveFile(spl, _playlistTextBox.Text); } else { using (DialogBox dialogbox = new DialogBox()) { if (dialogbox.ShowDialog() == System.Windows.Forms.DialogResult.OK) { savefuncs.saveFile(spl, dialogbox.textboxdata); } } } }
private void _addCat_Click(object sender, EventArgs e) { using (DialogBox dialogbox = new DialogBox()) { if (dialogbox.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (dialogbox.textboxdata != null || dialogbox.textboxdata != "" || dialogbox.textboxdata != " ") { bool catexist = false; foreach (Category c in allcategories) { if (c.catname == dialogbox.textboxdata) { catexist = true; break; } } if (!catexist) { allcategories.Add(datafuncs.createCategory(dialogbox.textboxdata)); datafuncs.updateCategories(allcategories); DirectoryInfo d = new DirectoryInfo(categories); FileInfo f = new FileInfo(d.FullName + "Categories.json"); if (File.Exists(f.FullName)) { allcategories.AddRange(datafuncs.loadCategories()); } } else { MessageBox.Show("That category already exists"); } } else { MessageBox.Show("Please enter a category name"); } } } datafuncs.loadCategories(); }
private void _saveToPlaylist_Click(object sender, EventArgs e) { var selecteditem = _playlistListView.SelectedItems; bool exists = false; if (!isSessionPL) { if (selecteditem[0] != null) { exists = datafuncs.checkExists(selecteditem[0].Text); } else { exists = datafuncs.checkExists(_playlistName.Text); } } if (exists) { selectedPL = datafuncs.loadPlaylist(playlists + _playlistListView.SelectedItems[0].Text + ".json"); if (selectedPL.whizzyfilelist != null) { foreach (Whizzyfile item in selectedPL.whizzyfilelist) { if (listinscope.Count != 0) { int count = 0; if (item.Filepath == listinscope[count].Filepath) { listinscope.RemoveAt(count); } count++; } } funcs.addListToExistingPlaylist(selectedPL, listinscope); } else { funcs.addListToExistingPlaylist(selectedPL, listinscope); } datafuncs.savePlaylist(selectedPL, _playlistListView.SelectedItems[0].Text); allplaylists.Add(selectedPL); } else { using (DialogBox dialogbox = new DialogBox()) { dialogbox.textboxdata = ""; if (dialogbox.ShowDialog() == System.Windows.Forms.DialogResult.OK) { spl.playlistname = dialogbox.textboxdata; datafuncs.createPlaylist(spl, dialogbox.textboxdata); _playlistName.Text = spl.playlistname; } } selectedPL = spl; if (spl.whizzyfilelist.Count != 0) { spl.whizzyfilelist.Clear(); } ; } isSessionPL = false; funcs.loadPlaylists(_playlistListView, allplaylists); }