Ejemplo n.º 1
0
        private void TrigonometricFunctionBtnCommandExecute(TrigonometricFunctionCommandParameter commandParameter)
        {
            UserInteractionType userOperationType = !_isShiftEnabled ? commandParameter.UserInteractionType : commandParameter.InverseUserInteractionType;

            string trigonometricFunctionText   = !_isShiftEnabled ? commandParameter.TrigonometricFunctionText : commandParameter.InverseTrigonometricFunctionText;
            string leftParenthesisOperatorText = Operators.GetOperatorText(OperatorType.LeftParenthesis);

            if (_calculatorStorageService.LastUserInteractionType == UserInteractionType.EqualBtnPressed)
            {
                SeriesOfComputerTextBoxValue = string.Empty;
            }

            if (_calculatorStorageService.LastUserInteractionType == UserInteractionType.AnsBtnPressed ||
                _calculatorStorageService.LastUserInteractionType == UserInteractionType.EFunctionBtnPressed ||
                _calculatorStorageService.LastUserInteractionType == UserInteractionType.ModOperatorBtnPressed ||
                _calculatorStorageService.LastUserInteractionType == UserInteractionType.FactOperatorBtnPressed ||
                _calculatorStorageService.LastUserInteractionType == UserInteractionType.SquareOfXNumberBtnPressed ||
                _calculatorStorageService.LastUserInteractionType == UserInteractionType.RightParenthesisBtnPressed)
            {
                string mulOperatorText = Operators.GetOperatorText(OperatorType.Multiplication);

                _calculatorStorageService.AddOperatorToStack(mulOperatorText, OperatorType.Multiplication);

                SeriesOfComputerTextBoxValue = $"{SeriesOfComputerTextBoxValue.Trim()} {mulOperatorText}";
            }

            _calculatorStorageService.AddLeftParenthesisOperatorToStack(leftParenthesisOperatorText);
            _calculatorStorageService.AddFunctionToStack(trigonometricFunctionText);

            SeriesOfComputerTextBoxValue = $"{SeriesOfComputerTextBoxValue.Trim()} {trigonometricFunctionText} {leftParenthesisOperatorText}";
            NumberTextBoxValue           = default(int).ToString();

            _calculatorStorageService.SetLastUserInteractionType(userOperationType);
        }
Ejemplo n.º 2
0
 private async void Uwu_TabletModeEvent(object sender, UserInteractionType e)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         txt.Text = e.ToString();
     });
 }
        public FunctionCommandParameter(UserInteractionType userInteractionType, FunctionType functionType)
        {
            UserInteractionType = userInteractionType;

            FunctionType = functionType;
            FunctionText = Functions.GetFunctionText(functionType);
        }
Ejemplo n.º 4
0
        public CalculatorStorageService()
        {
            _stack = new Stack();
            Queue  = new Queue <string>();

            Ans = 0;
            LeftParenthesisNumber = 0;

            LastUserInteractionType = UserInteractionType.Unknown;
        }
        public FunctionAndOperatorCommandParameter(UserInteractionType functionUserInteractionType, UserInteractionType operatorUserInteractionType, FunctionType functionType, OperatorType operatorType)
        {
            FunctionUserInteractionType = functionUserInteractionType;
            OperatorUserInteractionType = operatorUserInteractionType;

            FunctionType = functionType;
            OperatorType = operatorType;

            FunctionText = Functions.GetFunctionText(functionType);
            OperatorText = Operators.GetOperatorText(operatorType);
        }
Ejemplo n.º 6
0
        public TrigonometricFunctionCommandParameter(UserInteractionType userInteractionType, UserInteractionType inverseUserInteractionType,
                                                     TrigonometricFunctionType trigonometricFunctionType, TrigonometricFunctionType inverseTrigonometricFunctionType)
        {
            UserInteractionType        = userInteractionType;
            InverseUserInteractionType = inverseUserInteractionType;

            TrigonometricFunctionType        = trigonometricFunctionType;
            InverseTrigonometricFunctionType = inverseTrigonometricFunctionType;

            TrigonometricFunctionText        = Functions.GetTrigonometricFunctionText(trigonometricFunctionType);
            InverseTrigonometricFunctionText = Functions.GetTrigonometricFunctionText(inverseTrigonometricFunctionType);
        }
 public OperatorCommandParameter(UserInteractionType userInteractionType, OperatorType operatorType)
 {
     UserInteractionType = userInteractionType;
     OperatorType        = operatorType;
     OperatorText        = Operators.GetOperatorText(operatorType);
 }
 public OperandCommandParameter(UserInteractionType userInteractionType, int operandValue)
 {
     UserInteractionType = userInteractionType;
     OperandValue        = operandValue;
 }
Ejemplo n.º 9
0
 public void SetLastUserInteractionType(UserInteractionType userInteractionType)
 {
     LastUserInteractionType = userInteractionType;
 }