private void undaterange(object sender, RoutedEventArgs e) { TextBox textBox = sender as TextBox; if (textBox != input) { string str = input.Text; StringToValue exp = new StringToValue(str); int i = 0; foreach (TextBox t1 in listBox2.Items) { i++; if (t1 == textBox) { break; } } try { double temp = Convert.ToDouble(textBox.Text); double td = ((slidersList[i - 1].Value - 5) * temp) / 5; valuesList[i - 1].Content = td; variableCollection.vlist[i - 1].value = td; exp.setVariables(variableCollection); result.Content = exp.getValue(); } catch (FormatException ee) { MessageBox.Show("只能输入数字或者数字过大"); } } }
private void threads(object c, EventArgs e) { try { int count = CountToAnimation; slidersList[count - 1].Value = ProcessToanimation; double td = (slidersList[count - 1].Value - 5) * Convert.ToDouble(rangesList[count - 1].Text); td = td / 5; valuesList[count - 1].Content = td; variableCollection.vlist[count - 1].value = td; exp.setVariables(variableCollection); try { result.Content = exp.getValue(); } catch (UserException ue) { result.Content = ue.Message; } ProcessToanimation += 0.025; if (ProcessToanimation >= 10) { slidersList[count - 1].Value = 6; double ts = (slidersList[count - 1].Value - 5) * Convert.ToDouble(rangesList[count - 1].Text) / 5; valuesList[count - 1].Content = ts; variableCollection.vlist[count - 1].value = ts; exp.setVariables(variableCollection); try { result.Content = exp.getValue(); } catch (UserException ue) { result.Content = ue.Message; } (c as System.Windows.Threading.DispatcherTimer).Stop(); } } catch (Exception e1) { } }
private void undateslide(object sender, RoutedEventArgs e) { string str = input.Text; StringToValue exp = new StringToValue(str); Slider s = sender as Slider; int i = 0; foreach (Slider s1 in listBox3.Items) { i++; if (s1 == s) { break; } } try { if (i <= listBox4.Items.Count) { double td = (slidersList[i - 1].Value - 5) * Convert.ToDouble(rangesList[i - 1].Text); td = td / 5; valuesList[i - 1].Content = td; variableCollection.vlist[i - 1].value = td; exp.setVariables(variableCollection); try { result.Content = exp.getValue(); } catch (UserException ue) { result.Content = ue.Message; } //MessageBox.Show(exp.getValue().ToString()); } } catch (Exception e1) { //MessageBox.Show(e1.ToString()); } }