/** Deletes all the categories that the user has selected from * Program.categories. */ private void button1_Click(object sender, EventArgs e) { foreach (Category cat in checkedListBox1.CheckedItems) { Program.categories.Remove(cat); } this.Close(); WhitelistForm frm = new WhitelistForm(); frm.Show(); }
//Whichever item on the menu toolbar is clicked it does the appropriate action private void menu_strip_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { switch (e.ClickedItem.Name) { case "history": { if (historyResults.Count == 0) { MessageBox.Show("No history"); return; } HistoryForm historyForm = new HistoryForm(); historyForm.loadResults(historyResults); historyForm.Show(); break; } case "whitelist": { WhitelistForm whitelist = new WhitelistForm(); whitelist.Show(); break; } case "privacy": { PrivacyForm privacy = new PrivacyForm(); privacy.Show(); break; } case "dashboard": { Program.OpenUrl("https://consultationplus.herokuapp.com"); break; } case "about": { Program.OpenUrl("https://reflect.ucl.ac.uk/uclcomp00162020team33/"); break; } case "help": { break; } } }
/** Just creates a new Category object and adds it to Program.categories. */ private void button1_Click(object sender, EventArgs e) { List <string> sites_to_include = new List <string>(); foreach (string site in checkedListBox1.CheckedItems) { // add all the sites that were ticked from the whitelist. sites_to_include.Add(site); } Program.CreateCategory(textBox1.Text, sites_to_include); WhitelistForm frm5 = new WhitelistForm(); this.Close(); frm5.Show(); }