private void Button_Click_1(object sender, RoutedEventArgs e) { string find = findBox.Text.Trim(); if (find == "") { System.Windows.MessageBox.Show("Введите слово для поиска"); } else { int lev = (int.TryParse(LevInt.Text, out lev)) ? lev : 0; Stopwatch t = new Stopwatch(); t.Start(); bool finded = false; foreach (string seachword in list) { int levn = FindLevn.Distance(find, seachword); if (levn <= lev) { this.listBox.Items.Add(seachword); } finded = true; } if (finded == false) { System.Windows.MessageBox.Show("Такого слова нет"); } t.Stop(); this.findTime.Content = t.Elapsed.ToString(); } }
public static List <FindRes> ArrayThreadTask(object paramObj) { SeachInfo param = (SeachInfo)paramObj; string wordUpper = param.wordPattern.Trim().ToUpper(); List <FindRes> Result = new List <FindRes>(); foreach (string str in param.tempList) { int dist = FindLevn.Distance(str.ToUpper(), wordUpper); if (dist <= param.maxDist) { FindRes temp = new FindRes() { word = str, dist = dist, ThreadNum = param.ThreadNum }; Result.Add(temp); } } return(Result); }