private void OnCalculatorClick(object sender, System.Windows.RoutedEventArgs e) { if (e.OriginalSource is Button button) { if (button.DataContext is Operation operation) { if (operation.Type == OperationType.Equal) { operationPerformer.Calculate(values, operationTypes); } else { operationTypes.Add(operation.Type); } } else { values.Add(button.Content.ToString()); } } }