void ResultButton_Click(object sender, EventArgs e) { var line = EnterTextBox.Text; try { var calc = new MyCalc(); var result = calc.ComputeOfTwoValue(line); ExpressionTextBox.Text = EnterTextBox.Text; EnterTextBox.Text = result.ToString(); } catch (Exception exception) { ErrorMessage(exception.Message); } }
void FunctionButton_Click(object sender, EventArgs e) { var button = sender as Button; var line = EnterTextBox.Text; try { var calc = new MyCalc(); var result = calc.ComputeOfOneValue(line, button.Text); EnterTextBox.Clear(); EnterTextBox.Paste(result.ToString()); } catch (Exception exception) { ErrorMessage(exception.Message); } }