/// <summary> /// Attempts to save the favourite with the user inputted name. /// Does not work with empty name, name containing commas or duplicate name. /// </summary> private void NameFavourite() { String name = favouriteName.Text; if (!name.Equals("") && !name.Contains(",")) //Favourite name can't store comma because it is stored in a csv { TabUserControl.AddFavourite(name, url); parentWindow.Close(); } }
/// <summary> /// Removes the selected items the user has chosen from the favourites list when they click the delete button /// </summary> private void button1_Click(object sender, EventArgs e) { List <string> removeList = new List <string>(); foreach (int ind in favouriteListBox.CheckedIndices) { removeList.Add(favouriteListBox.Items[ind].ToString()); } TabUserControl.RemoveFavourites(removeList); thisWindow.Close(); }