Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. private List<string> BlockList = new List<string>() { "http://www.google.com", "http://www.google.co.uk", "http://www.bing.com" };
  2.  
  3.  
  4. private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
  5. {
  6. string[] BlockArray = BlockList.ToArray();
  7.  
  8.  
  9.  
  10. for (int i = 0; i < BlockArray.Length; i++)
  11.  
  12. {
  13. if (e.Url.Equals(BlockList[i]))
  14.  
  15. {
  16. e.Cancel = true;
  17. MessageBox.Show("Booyaa Says No!", "NO NO NO", MessageBoxButtons.OK, MessageBoxIcon.Hand); // Block List Error Message
  18. }
  19.  
  20. private void button6_Click_1(object sender, EventArgs e)
  21. {
  22.  
  23.  
  24. string url = textBox2.Text;
  25.  
  26. // Get if the user entered the right password
  27. GetPass pass = new GetPass(password);
  28.  
  29. // Check this with a dialog result
  30. DialogResult result = pass.ShowDialog();
  31.  
  32. if (result == DialogResult.OK)
  33. {
  34. BlockList.Add(url);
  35. MessageBox.Show("Added " + url + " to blocklist.");
  36. textBox2.Clear();
  37.  
  38. }
  39. else
  40. {
  41. MessageBox.Show("Booyaa Says Wrong Password", "Wrong Password", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  42. }
  43.  
  44. }
  45.  
  46. private void button7_Click_1(object sender, EventArgs e)
  47. {
  48.  
  49.  
  50. string url = textBox2.Text;
  51.  
  52. // Get if the user entered the right password
  53. GetPass pass = new GetPass(password);
  54.  
  55. // Check this with a dialog result
  56. DialogResult result = pass.ShowDialog();
  57.  
  58. if (result == DialogResult.OK)
  59. {
  60. BlockList.Remove(url);
  61. MessageBox.Show("Removed " + url + " from blocklist.");
  62. textBox2.Clear();
  63.  
  64. }
  65. else
  66. {
  67. MessageBox.Show("Booyaa Says Wrong Password", "Wrong Password", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  68. }
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement