Esempio n. 1
0
        private void EqualsButton_Click(object sender, RoutedEventArgs e)
        {
            // throw new NotImplementedException();
            double newNumber;

            if (double.TryParse(resultLabel.Content.ToString(), out newNumber))
            {
                switch (selectedOperator)
                {
                case SelectedOperator.Division:
                    result = SimpleMath.Division(lastNumber, newNumber);
                    break;

                case SelectedOperator.Product:
                    result = SimpleMath.Product(lastNumber, newNumber);
                    break;

                case SelectedOperator.Addition:
                    result = SimpleMath.Addition(lastNumber, newNumber);
                    break;

                case SelectedOperator.Subtraction:
                    result = SimpleMath.Subtraction(lastNumber, newNumber);
                    break;
                }
            }

            resultLabel.Content = result.ToString();
        }