public Settings(KidsPortal kp) { this.kp = kp; InitializeComponent(); FormBorderStyle = FormBorderStyle.None; historyBox.Text = "Time\t\t\tURL\n"; reportBox.Text = "Time\t\t\tURL\n"; }
public void checkTerms(KidsPortal kp) { this.kp = kp; try { kp.browser.Document.ExecCommand("SelectAll", false, null); kp.browser.Document.ExecCommand("SelectAll", false, null); kp.browser.Document.ExecCommand("Copy", false, null); String texts = Clipboard.GetText(); kp.browser.Document.ExecCommand("Unselect", false, null); Clipboard.SetText("Kids Portal - Safest Web Browser for Kids!"); String positive = "", positives = ""; int count = 0; for (int x = 0; x < terms.Length; x++) { if (texts.Split().Contains(terms[x], StringComparer.CurrentCultureIgnoreCase)) { count++; positive += terms[x] + "\n"; positives += terms[x] + " "; } } if (count <= 0) { // MessageBox.Show("This page is safe!\n" + positive, "Kids Portal - Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { kp.browser.Navigate("about:blank"); kp.goHomepage(); MessageBox.Show("The previous page is blocked\n\nIt contains " + count + " prohibited terms:\n" + positive + "\n\nYou're redirected to the homepage.", "Kids Portal - Warning!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); kp.settings.reportBox.Text += DateTime.Now.ToString() + " " + kp.navBar.Text + "\nKeywords: " + positives + "\n"; } } catch (Exception e) { // Does nothing yet... } }