Exemple #1
0
 /// <summary>
 /// the event handler for the button with one arguments
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OneArgument(object sender, EventArgs e)
 {
     try
     {
         var nameButton    = ((Button)sender).Name;
         var calculate     = FactoryOneArgument.CreatCalculator(nameButton);
         var firstArgument = Convert.ToDouble(FirstValue.Text);
         Result.Text = calculate.Calculate(firstArgument).ToString();
     }
     catch (Exception exp)
     {
         MessageBox.Show(exp.Message);
     }
 }
Exemple #2
0
 private void OneArgument(object sender, EventArgs e)
 {
     try
     {
         double argument = Convert.ToDouble(textBox1.Text);
         double result   = 0.0;
         IOneArgumentsCalculator calculator = FactoryOneArgument.CreateCalculate(((Button)sender).Name);
         result        = calculator.Calculate(argument);
         textBox3.Text = result.ToString();
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }