private void singular_operation_Click(object sender, EventArgs e)
        {
            Button GenericPressedButton = (Button)sender;
            string singular_operation   = GenericPressedButton.Text;

            switch (singular_operation)
            {
            case "Sqrt":
                result.Text = (CalculationOperations.SquareRoot(Double.Parse(result.Text)).ToString());
                break;

            case "Exp":
                result.Text = (CalculationOperations.Exp(Double.Parse(result.Text)).ToString());
                break;

            case "Abs":
                result.Text = (CalculationOperations.Absolute(Double.Parse(result.Text)).ToString());
                break;

            case "Tan":
                result.Text = (CalculationOperations.Tan(Double.Parse(result.Text)).ToString());
                break;

            case "Sin":
                result.Text = (CalculationOperations.Sin(Double.Parse(result.Text)).ToString());
                break;

            case "Cos":
                result.Text = (CalculationOperations.Cos(Double.Parse(result.Text)).ToString());
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        private void buttonEqual_Click(object sender, EventArgs e)
        {
            switch (operation)
            {
            case "+":
                result.Text = CalculationOperations.Sum(value, Double.Parse(result.Text)).ToString();
                break;

            case "/":
                if (Double.Parse(result.Text) == 0)
                {
                    MessageBox.Show("ERROR: Can not be divided by 0");
                    value = 0;
                }
                else
                {
                    result.Text = CalculationOperations.Division(value, Double.Parse(result.Text)).ToString();
                }
                break;

            case "-":
                result.Text = CalculationOperations.Subtraction(value, Double.Parse(result.Text)).ToString();
                break;

            case "*":
                result.Text = CalculationOperations.Multiplication(value, Double.Parse(result.Text)).ToString();
                break;
            }
            operation         = "";
            operation_pressed = false;
            if (perform_click_call == false)
            {
                //backgroundCalc.Text = "";
                value = Double.Parse(result.Text);
            }
            second_op_first_value = false;
            comma_pressed         = false;
        }