コード例 #1
0
        // Invoked when = is entered.
        void OnCalculated(EquationAnswer answer, double number)
        {
            string equationMessage = string.Format("{0} {1} {2} {3} ",
                                                   Equation.Instance.Operand1, Equation.Instance.Operation.Symbol, Equation.Instance.Operand2, Constants.EqualsSign);

            textBox.Text = equationMessage;
        }
コード例 #2
0
        void EquationCalculated(EquationAnswer answer, double number)
        {
            // If the outcome is a division by 0, use an error text.
            // Otherwise use the answer.
            switch (answer)
            {
            case EquationAnswer.DivideBy0:
                SetNumber(Constants.DividedByZero);
                break;

            default:
                SetNumber(number.ToString());
                break;
            }
        }
コード例 #3
0
        // Invoked every time a calculation or rounding is performed.
        void CopyToClipboard(EquationAnswer answer, double number)
        {
            if (answer == EquationAnswer.DivideBy0)
            {
                // If it's a division by 0, do not copy anything to clipboard but reset the textbox.
                NumberEvents.CopiedToClipboard(string.Empty);
                return;
            }


            string validAnswer = number.ToString();

            // Copy the number to the clipboard and show a message that a number has been copied.
            Clipboard.SetText(validAnswer);
            NumberEvents.CopiedToClipboard(validAnswer);

            //OutputEvents.UpdateClipboardMessage(String.Format(Constants.CopyToClipboard, result));

            //Need to save the copied value so it won't be pasted back into the calculator.
            lastPastedValue = validAnswer;
        }
コード例 #4
0
 public static void EquationCalculated(EquationAnswer answer, double number) => OnEquationCalculated?.Invoke(answer, number);