private void ViewByDropDown_SelectedIndexChanged(object sender, EventArgs e) { ResetViewForm(); switch (viewByDropDown.SelectedIndex) { case 0: queryLabel.Text = "Enter a shrine name below:"; AutoCompleteTextBox(queryInputTextBox, _shrineNames); break; case 1: queryLabel.Text = "Enter a region below:"; AutoCompleteTextBox(queryInputTextBox, _regions); break; case 2: SetViewTypeCompletionControls(); queryLabel.Text = "Enter a shrine type below:"; typeCompletionSelection.Items.Add("Blessing"); typeCompletionSelection.Items.Add("Combat"); typeCompletionSelection.Items.Add("Puzzle"); break; case 3: SetViewTypeCompletionControls(); queryLabel.Text = "Select search-by option from dropdown list below: "; typeCompletionSelection.Items.Add("Yes"); typeCompletionSelection.Items.Add("No"); break; case 4: queryLabel.Text = "Search for ____ in Shrine notes: "; DisplayData.ShowNotes(_allShrines, viewDetailBox); break; default: throw new Exception("How did this happen? There are only 5 View-By selections..."); } }
private void QueryInputTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode != Keys.Enter) { return; } _queryInput = queryInputTextBox.Text; if (_shrineNames.Contains(_queryInput)) { DisplayData.ShowShrineInfo(_queryInput, _allShrines, viewDetailBox); } else if (_regions.Contains(_queryInput)) { DisplayData.ShowShrinesInARegion(_queryInput, _allShrines, viewDetailBox); } else { DisplayData.ShowNotes(_queryInput, _allShrines, viewDetailBox); } }