Beispiel #1
0
        private void button9_Click(object sender, EventArgs e)
        {
            if (state.Operation == null)
            {
                textBox4.Text = textBox3.Text;
            }
            else if (state.Operation.Equals("+"))
            {
                textBox4.Text = (state.FirstNumber + float.Parse(textBox3.Text)).ToString();
            }
            else if (state.Operation.Equals("-"))
            {
                textBox4.Text = (state.FirstNumber - float.Parse(textBox3.Text)).ToString();
            }
            else if (state.Operation.Equals("*"))
            {
                textBox4.Text = (state.FirstNumber * float.Parse(textBox3.Text)).ToString();
            }
            else if (state.Operation.Equals("/"))
            {
                textBox4.Text = (state.FirstNumber / float.Parse(textBox3.Text)).ToString();
            }
            else
            {
                textBox4.Text = textBox3.Text;
            }

            textBox3.Text = "0";
            state         = new CalculatorState();
        }
Beispiel #2
0
 private void button11_Click(object sender, EventArgs e)
 {
     if (!textBox3.Text.Equals(""))
     {
         textBox4.Text = (Math.Log(double.Parse(textBox3.Text), 2)).ToString();
         textBox3.Text = "0";
         state         = new CalculatorState();
     }
 }
Beispiel #3
0
 private void button11_Click(object sender, EventArgs e)
 {
     if(!textBox3.Text.Equals(""))
     {
         textBox4.Text = (Math.Log(double.Parse(textBox3.Text), 2)).ToString();
         textBox3.Text = "0";
         state = new CalculatorState();
     }
 }
Beispiel #4
0
 public Form1()
 {
     InitializeComponent();
     state = new CalculatorState();
 }
Beispiel #5
0
 public CalculatorController(IWindowInfo iwi)
 {
     this.iwi   = iwi;
     this.state = new CalculatorState(18);
     iwi.SetTextBox(this.state.Text);
 }
Beispiel #6
0
        private void button9_Click(object sender, EventArgs e)
        {
            if (state.Operation == null)
            {
                textBox4.Text = textBox3.Text;
            }
            else if (state.Operation.Equals("+"))
            {
                textBox4.Text = (state.FirstNumber + float.Parse(textBox3.Text)).ToString();
            }
            else if (state.Operation.Equals("-"))
            {
                textBox4.Text = (state.FirstNumber - float.Parse(textBox3.Text)).ToString();
            }
            else if (state.Operation.Equals("*"))
            {
                textBox4.Text = (state.FirstNumber * float.Parse(textBox3.Text)).ToString();
            }
            else if(state.Operation.Equals("/"))
            {
                textBox4.Text = (state.FirstNumber / float.Parse(textBox3.Text)).ToString();
            }
            else
            {
                textBox4.Text = textBox3.Text;
            }

            textBox3.Text = "0";
            state = new CalculatorState();
        }
Beispiel #7
0
 public Form1()
 {
     InitializeComponent();
     state = new CalculatorState();
 }