private void Button_Click(object sender, RoutedEventArgs e) { try { if (this.btnStart.Content as string == _CANCEL) { Extractor.CancelSearch(); this.btnStart.Content = _START; return; } if (this.tbIn.Text.Length == 0 || this.tbSearchPattern.Text.Length == 0) { MessageBox.Show("Please fill in the input fields"); return; } this.pbProgress.Value = this.pbProgress.Minimum; this.tbOut.Clear(); StringComparison stringComparison = (StringComparison)Enum.Parse(typeof(StringComparison), this.cbStringComparison.SelectedItem.ToString()); string dropdownValue = this.cbSearchType.SelectedItem.ToString(); Extractor.SearchType searchType = (Extractor.SearchType)Enum.Parse(typeof(Extractor.SearchType), dropdownValue); dropdownValue = this.cbTrim.SelectedItem.ToString(); Extractor.TrimSetting trimSetting = (Extractor.TrimSetting)Enum.Parse(typeof(Extractor.TrimSetting), dropdownValue); dropdownValue = this.cbRegexOptions.SelectedItem.ToString(); RegexOptions regexOptions = (RegexOptions)Enum.Parse(typeof(RegexOptions), dropdownValue); dropdownValue = this.cbSplit.SelectedItem.ToString(); Extractor.SplitSettings splitSettings = (Extractor.SplitSettings)Enum.Parse(typeof(Extractor.SplitSettings), dropdownValue); Extractor.SearchParameters searchParameters = new Extractor.SearchParameters(stringComparison, searchType, trimSetting, regexOptions, splitSettings); this.btnStart.Content = _CANCEL; string[] split = this.tbIn.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); if (System.IO.File.Exists(split[0])) { ChangeTitle(true, true); Extractor.StartSearchFiles(split, this.tbSearchPattern.Text, searchParameters, this.OnUpdate); } else { ChangeTitle(true, false); Extractor.StartSearch(this.tbIn.Text, this.tbSeparators.Text, this.tbSearchPattern.Text, searchParameters, this.OnUpdate); } } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace); } }