public void Clicking(object sender, EventArgs e) { var firstArgument = Convert.ToDouble(textBoxEntering1.Text); var secondArgument = Convert.ToDouble(textBoxEntering2.Text); var calculator = TwoArgumentsFactory.CreateCalculator(((Button)sender).Name); double result = calculator.ExecuteOperation(firstArgument, secondArgument); labelOut.Text = result.ToString(); }
public void Clicking(object sender, EventArgs e) { try { var firstArgument = Convert.ToDouble(textBoxEntering1.Text); var secondArgument = Convert.ToDouble(textBoxEntering2.Text); var calculator = TwoArgumentsFactory.CreateCalculator(((Button)sender).Name); double result = calculator.ExecuteOperation(firstArgument, secondArgument); labelOut.Text = result.ToString(); } catch (Exception exception) { MessageBox.Show("Возникла ошибка :" + exception.Message); } }