Example #1
0
        private void Button_Click(object sender, EventArgs e)
        {
            double firstValue = Convert.ToDouble(input1.Text);
            double lastValue  = Convert.ToDouble(input2.Text);
            ITwoArgumentsOperation calculator = TwoArgumentsCalculatorsFactory.CreateCalculator(((Button)sender).Name);
            double result = calculator.Calculate(firstValue, lastValue);



            Answer.Text = result.ToString();
        }
Example #2
0
 private void Button_Click(object sender, EventArgs e)
 {
     try
     {
         double firstValue = Convert.ToDouble(input1.Text);
         double lastValue  = Convert.ToDouble(input2.Text);
         ITwoArgumentsOperation calculator = TwoArgumentsCalculatorsFactory.CreateCalculator(((Button)sender).Name);
         double result = calculator.Calculate(firstValue, lastValue);
         Answer.Text = result.ToString();
     }
     catch (Exception exc)
     {
         MessageBox.Show("Ошибка: " + exc.Message);
     }
 }