Example #1
0
        //Operator State
        private void DigitPeriod_Button_MouseClick(object sender, MouseEventArgs e)
        {
            string input = DigitPeriod_Button.Text;

            CalculatorState.getInstance().nextState(1, input);
            textBox1.Text = CalculationState.getInstance().display();
        }
 protected void readOp(String input)
 {
     if (op == "")
     {
         op = input;
         isOperand1Complete = true;
         if (isCalculationComplete)
         {
             operand2 = "0";
             isCalculationComplete = false;
             isOperand2Complete    = false;
         }
     }
     else
     {
         if (!isCalculationComplete && isCalculationButtonPressed)
         {
             CalculatorState.getInstance().nextState(3, null);
         }
         op = input;
         isOperand1Complete = true;
         if (isCalculationComplete)
         {
             operand2 = "0";
             isCalculationComplete = false;
             isOperand2Complete    = false;
         }
     }
 }
Example #3
0
        //Special Functions
        private void SQRTButton_MouseClick(object sender, MouseEventArgs e)
        {
            string input = SQRTButton.Text;

            CalculatorState.getInstance().nextState(4, input);
            textBox1.Text = SpecialOperationState.getInstance().display();
        }
Example #4
0
        private void Digit7_Button_Click(object sender, EventArgs e)
        {
            string input = Digit7_Button.Text;

            CalculatorState.getInstance().nextState(1, input);
            textBox1.Text = CalculationState.getInstance().clearScreen();
            textBox1.Text = CalculationState.getInstance().display();
        }
Example #5
0
 private void ClearButton_MouseClick(object sender, MouseEventArgs e)
 {
     CalculatorState.getInstance().nextState(6, null);
     textBox1.Text = ClearState.getInstance().display();
 }
Example #6
0
 private void ClearAll_MouseClick(object sender, MouseEventArgs e)
 {
     CalculatorState.getInstance().nextState(5, null);
     textBox1.Text = ClearEverythingState.getInstance().display();
 }
Example #7
0
 private void BackspaceButton_MouseClick(object sender, MouseEventArgs e)
 {
     CalculatorState.getInstance().nextState(0, null);
     textBox1.Text = BackspaceState.getInstance().display();
 }