private void Button_Click(object sender, RoutedEventArgs e) { var button = sender as Button; int digit = -1; object tag = (sender as Button).Tag; if (int.TryParse(button.Content.ToString(), out digit)) { calc.AddDigit(digit); } else { switch (tag) { case "decimal": calc.AddDecimalPoint(); break; case "evaluate": calc.Compute(); break; case "addition": calc.AddOperation(Operation.Add); break; case "substraction": calc.AddOperation(Operation.Sub); break; case "multiplication": calc.AddOperation(Operation.Mul); break; case "division": calc.AddOperation(Operation.Div); break; case "degree": calc.AddOperation(Operation.Pow); break; case "reverse": calc.AddOperation(Operation.Drob); break; case "radical": calc.AddOperation(Operation.Sqrt); break; case "Cos": calc.AddOperation(Operation.Cos); break; case "Sin": calc.AddOperation(Operation.Sin); break; case "clear": calc.Clear(); break; case "reset": calc.Reset(); break; case "earse": calc.Earse(); break; } } }