// Find private void button1_Click(object sender, EventArgs e) { if (textBox_findWhat.Text.Length == 0) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_PleaseEnterTheSearchWordFirst"), Program.ResourceManager.GetString("MessageCaption_FindGames")); return; } if (comboBox_searchBy.SelectedIndex < 0) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_PleaseSelectTheSearchByColumnFirst"), Program.ResourceManager.GetString("MessageCaption_FindGames")); return; } TextSearchCondition textCondition = TextSearchCondition.None; NumberSearchCondition numberCondition = NumberSearchCondition.None; bool isNumber = false; switch (comboBox_searchBy.SelectedItem.ToString()) { case "Size": case "Played": case "Play Time": case "Board Mapper": case "Rating": isNumber = true; break; } if (!isNumber) { switch (comboBox_condition.SelectedIndex) { case 0: textCondition = TextSearchCondition.Contains; break; case 1: textCondition = TextSearchCondition.DoesNotContain; break; case 2: textCondition = TextSearchCondition.Is; break; case 3: textCondition = TextSearchCondition.IsNot; break; case 4: textCondition = TextSearchCondition.StartWith; break; case 5: textCondition = TextSearchCondition.DoesNotStartWith; break; case 6: textCondition = TextSearchCondition.EndWith; break; case 7: textCondition = TextSearchCondition.DoesNotEndWith; break; } } else { switch (comboBox_condition.SelectedIndex) { case 0: numberCondition = NumberSearchCondition.Equal; break; case 1: numberCondition = NumberSearchCondition.DoesNotEqual; break; case 2: numberCondition = NumberSearchCondition.Larger; break; case 3: numberCondition = NumberSearchCondition.EuqalLarger; break; case 4: numberCondition = NumberSearchCondition.Smaller; break; case 5: numberCondition = NumberSearchCondition.EqualSmaller; break; } } // Raise the event ! if (SearchRequest != null) { SearchRequest(this, new SearchRequestArgs(textBox_findWhat.Text, comboBox_searchBy.SelectedItem.ToString(), isNumber, textCondition, numberCondition, checkBox_caseSensitive.Checked)); } }
public SearchRequestArgs(string searchWhat, string searchColumn, bool isNumber, TextSearchCondition conditionForText, NumberSearchCondition conditionForNumber, bool caseSensitive) { this.SearchWhat = searchWhat; this.SearchColumn = searchColumn; this.IsNumber = isNumber; this.TextCondition = conditionForText; this.NumberCondition = conditionForNumber; this.CaseSensitive = caseSensitive; }