コード例 #1
0
        // This method is used for adding and calculating the Pi and E number
        private void AddPiE(string value)
        {
            // Check if there is operator or not and then adding value to number 1 or 2
            int index = @operator == null ? 0 : 1;

            // Jump into the CheckerActivity class to check the input
            if (CheckerActivity.IsInputValid(numbers, index, value))
            {
                numbers[index] = value;
                Calculate();
            }

            UpdateCalculatorText();
        }
コード例 #2
0
        // This method is used for adding numbers or decimal point to the text view
        private void AddDigitOrDecimalPoint(string value)
        {
            // Check if there is operator or not and then adding value to number 1 or 2
            int index = @operator == null ? 0 : 1;

            // Jump into the CheckerActivity class to check the input
            if (CheckerActivity.IsInputValid(numbers, index, value))
            {
                // Check if user press equal or not
                // If user pressed equal and entered new number,
                // it will automaticall replace the old number to the new one
                if (this._justPressEqual)
                {
                    numbers[index] = value;
                }
                else
                {
                    numbers[index] += value;
                }
            }

            UpdateCalculatorText();
        }