public void Search(object x) { StartEnd se = (StartEnd)x; if (se.start == 0) { Number += se.end; } else { while (se.end != 0) { if (se.start > se.end) { se.start -= se.end; } else { se.end -= se.start; } } Number += se.start; } }
private void CmdFind_OnClick(object sender, RoutedEventArgs e) { if (!(int.TryParse(txtStart.Text, out firstnumber)) || !(int.TryParse(txtStop.Text, out secondnumber)) || secondnumber < 0 || firstnumber < 0) { MessageBox.Show("Введите целые числа БОЛЬШЕ 0"); } else { cmdFind.IsEnabled = false; cmdFind.Content = "Подождите"; } StartEnd se = new StartEnd(firstnumber, secondnumber); Thread thread = new Thread(Search); thread.Start(se); }