Example #1
0
        //SPECIALS SPECIALS SPECIALS
        private void Click_equals(object sender, EventArgs e)
        {
            if (this.screen.Text.Length > 0 && activeParenthesis == 0)
            {
                if (SafteyNet.LastClosedParenthesis(this.screen.Text) == true || (SafteyNet.LastNumbers(this.screen.Text) == true && usedOperator == true))
                {
                    string result = StringToNum.CalculateEverything(screenText);
                    screenText = result;

                    if (screenText.Length > 12) //max char in screen is 12
                    {
                        result = result.Remove(result[screenText.Length - 13]);
                    }

                    this.screen.Text = result;

                    activeParenthesis = 0;
                    activeDecimals    = false;
                    activePlusMinus   = false;
                    activePower       = false;
                    activeDividePower = false;
                    usedOperator      = false;

                    GrayEquals();
                }
            }
        }
Example #2
0
        private void Click_add(object sender, EventArgs e)
        {
            if (activePower == false && SafteyNet.EmptyString(this.screen.Text) == false)
            {
                if (SafteyNet.LastNumbers(this.screen.Text) == true || SafteyNet.LastClosedParenthesis(this.screen.Text) == true)
                {
                    if (activePlusMinus == true)
                    {
                        this.screen.Text  = SafteyNet.TooLargeScreen(this.screen.Text);
                        screenText       += ")";
                        this.screen.Text += ")";

                        this.screen.Text  = SafteyNet.TooLargeScreen(this.screen.Text);
                        screenText       += "+";
                        this.screen.Text += "+";

                        activePlusMinus = false;
                    }
                    else
                    {
                        this.screen.Text  = SafteyNet.TooLargeScreen(this.screen.Text);
                        screenText       += "+";
                        this.screen.Text += "+";
                    }

                    activeDecimals = false;
                    usedOperator   = true;

                    GrayEquals();
                }
            }
        }
Example #3
0
        private void Click_nine(object sender, EventArgs e)
        {
            if (SafteyNet.EmptyString(this.screen.Text) == true || SafteyNet.LastClosedParenthesis(this.screen.Text) == false)
            {
                this.screen.Text  = SafteyNet.TooLargeScreen(this.screen.Text);
                screenText       += "9";
                this.screen.Text += "9";

                GrayEquals();
            }
        }
Example #4
0
 private void GrayEquals() //changes the color of equals to show if it's usable
 {
     if (this.screen.Text.Length > 0 && activeParenthesis == 0)
     {
         if (SafteyNet.LastClosedParenthesis(this.screen.Text) == true || (SafteyNet.LastNumbers(this.screen.Text) == true && usedOperator == true))
         {
             this.equals.BackColor = System.Drawing.Color.White;
             this.equals.FlatAppearance.MouseDownBackColor = Control.DefaultBackColor;
             this.equals.FlatAppearance.MouseOverBackColor = Control.DefaultBackColor;
         }
         else
         {
             this.equals.BackColor = System.Drawing.Color.LightGray;
             this.equals.FlatAppearance.MouseDownBackColor = System.Drawing.Color.LightGray;
             this.equals.FlatAppearance.MouseOverBackColor = System.Drawing.Color.LightGray;
         }
     }
     else
     {
         this.equals.BackColor = System.Drawing.Color.LightGray;
         this.equals.FlatAppearance.MouseDownBackColor = System.Drawing.Color.LightGray;
         this.equals.FlatAppearance.MouseOverBackColor = System.Drawing.Color.LightGray;
     }
 }