예제 #1
0
        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;
            }
        }
예제 #2
0
        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();
            }
        }