Example #1
0
        private void ClickEqual(object sender, RoutedEventArgs e)
        {
            result  += " " + operation + " " + txbResult.Text;
            isResult = true;

            if (txbPrevious.Text.Length == 0)
            {
                ClickClearAll(sender, e);
            }
            else if (divisionByZero())
            {
                txbResult.Text   = "Cannot divide by 0";
                txbPrevious.Text = "";
                result           = "";
                operation        = "";
                isDot            = false;
                isFirstOperation = true;
            }
            else
            {
                txbPrevious.Text = "";
                isDot            = false;
                isFirstOperation = true;

                result = Calculation.toRPN(this.LocalizationControll(result));
                Stack <string> stack = new Stack <string>();
                stack = Calculation.ConvertToStack(result);

                txbResult.Text = Calculation.evalRPN(stack).ToString();
            }
        }