/* * If the listbox selection is changed and it is not nothing it will underline keywords. */ private void MainForm_SelectedIndexChanged(object sender, EventArgs e) { if (Listbox_SearchCount.getListBox().SelectedIndex > -1) { UnderlineSelectedKeyword(KeywordFrequencies[Listbox_SearchCount.getListBox().SelectedIndex].Keyword.ToLower()); } }
/* * Loops through the KeywordFrequencies list, adding each one to the Listbox with the * number of times it appears next to it. */ private void AddKeywordsToListbox() { KeywordFrequencies = SortListByFrequency(KeywordFrequencies); Listbox_SearchCount.getListBox().Items.Clear(); foreach (KeywordFrequency keyword in KeywordFrequencies) { Listbox_SearchCount.getListBox().Items.Add(keyword.Keyword + " (" + keyword.Frequency + ")"); } }
public MainForm() { InitializeComponent(); // Event whenever the text is changed, to know when the email has been edited by the user RichTextbox_MainText.getTextbox().TextChanged += new EventHandler(MainForm_RichTextbox_TextChanged); Listbox_SearchCount.getListBox().SelectedIndexChanged += new EventHandler(MainForm_SelectedIndexChanged); }
/* * Removes the red font on the keywords and clears the listbox of items. * Sets the previous email text to the current email text. */ private void MainForm_RichTextbox_TextChanged(object sender, EventArgs e) { if (RichTextbox_MainText.getTextbox().Text != PrevMainText) { Listbox_SearchCount.getListBox().Items.Clear(); SetMainTextDefaultColour(); PrevMainText = RichTextbox_MainText.getTextbox().Text; } }
/* * Clears the text in the keywords textbox. */ private void Button_ClearKeywords_Click(object sender, EventArgs e) { Textbox_Keywords.getTextbox().Text = String.Empty; Listbox_SearchCount.getListBox().Items.Clear(); SetMainTextDefaultColour(); }
/* * Clears the text in the email textbox. */ private void Button_ClearMainText_Click(object sender, EventArgs e) { RichTextbox_MainText.getTextbox().Text = String.Empty; Listbox_SearchCount.getListBox().Items.Clear(); }