Example #1
0
        private void equalButton_Click(object sender, RoutedEventArgs e)
        {
            double secNum = 0;

            if (double.TryParse(resultLabel.Content.ToString(), out secNum))
            {
                switch (op)
                {
                case Operator.Addition:
                {
                    result = Arithmetic.Add(lastNum, secNum);
                    break;
                }

                case Operator.Division:
                {
                    result = Arithmetic.Div(lastNum, secNum);
                    break;
                }

                case Operator.Multiplication:
                {
                    result = Arithmetic.Mult(lastNum, secNum);
                    break;
                }

                case Operator.Subtraction:
                {
                    result = Arithmetic.Sub(lastNum, secNum);
                    break;
                }
                }
                resultLabel.Content = result.ToString();
            }
        }