private void CoefValueChanged(object sender, EventArgs e) { var textEdit = sender as TextEdit; if (textEdit == null || !RealNumber.IsSuitable(textEdit.Text)) { return; } switch (textEdit.Name) { case "aCoefTextEdit": _polynom.A = new RealNumber(textEdit.EditValue); break; case "bCoefTextEdit": _polynom.B = new RealNumber(textEdit.EditValue); break; case "cCoefTextEdit": _polynom.C = new RealNumber(textEdit.EditValue); break; } RefreshRoots(); RefreshPolynomValue(); }
private void RefreshPolynomValue() { var x = xValueTextEdit.Text; if (!RealNumber.IsSuitable(x)) { return; } var value = _polynom.GetValue(new RealNumber(x)); polynomValueTextEdit.Text = double.IsNaN(value.Value) ? "" : value.Value.ToString(); }