コード例 #1
0
        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();
        }
コード例 #2
0
 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);
     }
 }