private void equalButton_Click(object sender, RoutedEventArgs e) { double newNumber; if (double.TryParse(resultLabel.Content.ToString(), out newNumber)) { switch (selectedOperator) { case SelectedOperator.Addition: result = SimpleMath.Add(lastNumber, newNumber); break; case SelectedOperator.Substraction: result = SimpleMath.Subs(lastNumber, newNumber); break; case SelectedOperator.Multiplication: result = SimpleMath.Mult(lastNumber, newNumber); break; case SelectedOperator.Division: result = SimpleMath.Div(lastNumber, newNumber); break; } //assign result resultLabel.Content = result.ToString(); } }