private void EnteringSystem(Button newPressedButton) { if ((CalculatorTextBox.Text == "0") || (isOperationSignPressed)) { CalculatorTextBox.Clear(); } ActiveOperation(); Button button = (Button)newPressedButton; CalculatorTextBox.Text = CalculatorTextBox.Text + button.Text; if (isOperationSignPressed) { NotActiveOperation(); ButtonResult.Enabled = true; } }
private void ButtonClear_Click(object sender, EventArgs e) { Button firstPressedButton = (Button)sender; Button secondPressedButton = (Button)sender; if (operation != string.Empty) { CalculatorTextBox.Text = CalculatorTextBox.Text + secondPressedButton.Text; CalculatorTextBox.Clear(); ButtonResult.Enabled = false; NotActiveOperation(); } else if (operation == string.Empty) { CalculatorTextBox.Text = CalculatorTextBox.Text + firstPressedButton.Text; CalculatorTextBox.Clear(); ButtonResult.Enabled = false; NotActiveOperation(); } }