void searchHouseButton_Click(object sender, EventArgs e) { SetDefaultResults(); IndexFinder indF = new IndexFinder(inputBox.Text); indF.WordFoundEvent += ResultsInput; indF.FindAllIndexes(inputBox.Text, "house"); indF.WordFoundEvent -= ResultsInput; }
//Here is the Method that is being executed on searchHouseButton_click private void SearchHouse()//object a) { this.Enabled = false; sb.Clear(); sb.Insert(sb.Length, "The word house appeared at positions: "); SetDefaultResults(); IndexFinder indF = new IndexFinder(this.inputBox.Text); indF.WordFoundEvent += ResultsInput; indF.FindAllIndexes(this.inputBox.Text, "house"); this.Enabled = true; //Calls an event when the local progress bars are done/full EventArgs parasiteArgs = null; longResultBox.Text = sb.ToString(); //unsubscribes so that on second button press we dont stack the labes and textboxes with += text indF.WordFoundEvent -= ResultsInput; OnProgressBarUpdated(parasiteArgs); }