Beispiel #1
0
        private void EquBtn_Click(object sender, EventArgs e)
        {
            this.InputBox.Text = checkForVariables();
            INode root = Parser.ParseString(this.InputBox.Text);

            this.lastResoult   = root.GetResult();
            this.InputBox.Text = this.lastResoult.ToString();
        }
Beispiel #2
0
 private void InputKeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         string res  = checkForVariables();
         INode  root = Parser.ParseString(res);
         this.lastResoult   = root.GetResult();
         this.InputBox.Text = this.lastResoult.ToString();
     }
 }
Beispiel #3
0
        private void InputBox_KeyPress_1(object sender, KeyPressEventArgs e)
        {
            if (Char.IsDigit(e.KeyChar) || this.listOfOperators.Contains(e.KeyChar) || this.variablesNames.Contains(e.KeyChar) || e.KeyChar == ')' || e.KeyChar == '(')
            {
                e.Handled           = true;
                this.InputBox.Text += e.KeyChar;
            }
            else if ((e.KeyChar == '\n' || e.KeyChar == '\r') && this.InputBox.Text.Length > 0)
            {
                string t = this.checkForVariables();
                INode  n = Parser.ParseString(t);
                this.lastResoult   = n.GetResult();
                this.InputBox.Text = this.lastResoult.ToString();
            }
            else if (e.KeyChar == '\b' && this.InputBox.Text.Length > 0)
            {
                this.InputBox.Text = this.InputBox.Text.Remove(this.InputBox.Text.Length - 1, 1);
            }


            e.Handled = true;
        }