private void EqualsButton_Click(object sender, RoutedEventArgs e) { if (double.TryParse(resultLabel.Content.ToString(), out double newNumber)) { switch (selectedOperator) { case SelectedOperator.Addition: result = SimpleMath.Add(lastNumber, newNumber); break; case SelectedOperator.Subtraction: result = SimpleMath.Subtract(lastNumber, newNumber); break; case SelectedOperator.Multiplication: result = SimpleMath.Mutliply(lastNumber, newNumber); break; case SelectedOperator.Division: result = SimpleMath.Divide(lastNumber, newNumber); break; } } resultLabel.Content = result.ToString(); }