//Potential for improvement, currently deletes by rewriting over entire favourite file private void deleteBtn_Click(object sender, EventArgs e) { List <string> readText = Favourites.getFaves().ToList(); try { readText.RemoveAt((readText.Count - 1) - favesDisplay.SelectedIndex); }catch (Exception noFaveToDelete) { return; } Favourites.clearFavouritesFile(); Favourites.setFavouritesFile(readText); favesDisplay.Items.RemoveAt(favesDisplay.SelectedIndex); //potentially delegate??? Seemed useless at time as I couldn't imagine ever adding more functionality to this event browse.populateFavourites(); }
private void clearFavouritesMenu_Click(object sender, EventArgs e) { favesMenu.DropDownItems.Clear(); Favourites.clearFavouritesFile(); }