private void OnCalculateValueClick(object sender, EventArgs e) { var exprs = graph.GraphedExpressions; if (exprs.Count == 0) { MessageBox.Show( "You must graph at least one expression before using this command.", "A Linear Expression is Required", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } using (SelectValue form = new SelectValue(graph.Calculator, exprs)) { if (form.ShowDialog() == DialogResult.OK) { graph.ShowLineValue(form.SelectedExpression.Slot, form.SelectedValue); } } }
private void OnCalculateDerivativeClick(object sender, EventArgs e) { var exprs = (from expr in graph.GraphedExpressions where expr.Type == ExpressionType.Linear select (StandardExpression)expr).ToList(); if (exprs.Count == 0) { MessageBox.Show( "You must graph at least one linear expression before using this command.", "A Linear Expression is Required", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } using (SelectValue value = new SelectValue(graph.Calculator, exprs)) { if (value.ShowDialog() == DialogResult.OK) { graph.ShowDerivative(value.SelectedExpression.Slot, value.SelectedValue); } } }