Beispiel #1
0
        private void btnEqual_Click(object sender, RoutedEventArgs e)
        {
            double newNumber;

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

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

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

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

                lblResult.Content = result.ToString();
            }
            TextBoxSecondScreen.Text = "";
        }