Ejemplo n.º 1
0
        /// <summary>
        /// To change the current expression depending on the pressed operation and the state of the buttons
        /// </summary>
        private string NewCurrentExpression()
        {
            if (buttonsState.EqualBtnPressed)
            {
                buttonsState.NumberPadBtnPressed_Change(true);
                buttonsState.AdditionalOperationBtnPressed_Change(false);
                buttonsState.EqualBtnPressed_Change(false);

                return(NumberStandardization.Standardization(calculate.CalcPercentage(NumberStandardization.Standardization(currentData.CurrentNumber), currentData.CurrentExpression.Remove(currentData.CurrentExpression.Length - 3, 3)).ToString()));
            }
            else
            {
                if (currentData.CurrentExpression != string.Empty)
                {
                    if (buttonsState.AdditionalOperationBtnPressed)
                    {
                        return(ChangeTheSetOfRecentAdditionalOperations(currentData.CurrentExpression));
                    }
                    else
                    {
                        return(currentData.CurrentExpression + NumberStandardization.Standardization(calculate.CalcPercentage(NumberStandardization.Standardization(currentData.CurrentNumber), currentData.CurrentExpression.Remove(currentData.CurrentExpression.Length - 3, 3)).ToString()));
                    }
                }
                else
                {
                    return(currentData.CurrentExpression + NumberStandardization.Standardization(calculate.CalcPercentage(NumberStandardization.Standardization(currentData.CurrentNumber), ((int)Digits.Zero).ToString()).ToString()));
                }
            }
        }
 /// <summary>
 /// To change the current expression depending on the pressed operation and the state of the buttons
 /// </summary>
 private string NewCurrentExpression(BasicMathOperations pressedOperation)
 {
     //If the expression was calculated and "=" was pressed again
     if (buttonsState.EqualBtnPressed && (pressedOperation == BasicMathOperations.Equal) && Common.MathSignCheck(currentData.CurrentExpression))
     {
         return(NumberStandardization.Standardization(currentData.CurrentNumber) + CopyLastOperation(currentData.CurrentExpression.Remove(currentData.CurrentExpression.Length - 3, 3)) + SetSelectedBasicMathOperation(pressedOperation));
     }
     else if (pressedOperation == BasicMathOperations.Sqr)
     {
         return(SetSelectedBasicMathOperation(pressedOperation) + NumberStandardization.StandardizationSqr(currentData.CurrentNumber));
     }
     else if (pressedOperation == BasicMathOperations.Sqrt)
     {
         return(SetSelectedBasicMathOperation(pressedOperation) + NumberStandardization.StandardizationSqr(currentData.CurrentNumber));
     }
     else if (pressedOperation == BasicMathOperations.PartOfTheWhole)
     {
         return(SetSelectedBasicMathOperation(pressedOperation) + NumberStandardization.StandardizationSqr(currentData.CurrentNumber));
     }
     else if (buttonsState.NumberPadBtnPressed)
     {
         return(currentData.CurrentExpression + NumberStandardization.Standardization(currentData.CurrentNumber) + SetSelectedBasicMathOperation(pressedOperation));
     }
     //Сhanging the basic math operation sign
     else
     {
         return(ChangeOperation(currentData.CurrentExpression, SetSelectedBasicMathOperation(pressedOperation)));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// To change the current expression depending on the pressed operation and the state of the buttons
 /// </summary>
 private string NewCurrentExpression(BasicMathOperations pressedOperation)
 {
     //If the expression was calculated and "=" was pressed again
     if (buttonsState.EqualBtnPressed && (pressedOperation == BasicMathOperations.Equal) && Common.MathSignCheck(currentData.CurrentExpression))
     {
         return(NumberStandardization.Standardization(currentData.CurrentNumber) + CopyLastOperation(currentData.CurrentExpression.Remove(currentData.CurrentExpression.Length - 3, 3)) + SetSelectedBasicMathOperation(pressedOperation));
     }
     //If the number and additional operation were pressed
     else if (buttonsState.NumberPadBtnPressed && buttonsState.AdditionalOperationBtnPressed)
     {
         return(currentData.CurrentExpression + SetSelectedBasicMathOperation(pressedOperation));
     }
     //If a number was pressed, but not an additional operation
     else if (buttonsState.NumberPadBtnPressed && !buttonsState.AdditionalOperationBtnPressed)
     {
         return(currentData.CurrentExpression + NumberStandardization.Standardization(currentData.CurrentNumber) + SetSelectedBasicMathOperation(pressedOperation));
     }
     //Сhanging the basic math operation sign
     else
     {
         return(ChangeOperation(currentData.CurrentExpression, SetSelectedBasicMathOperation(pressedOperation)));
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// To change the current expression depending on the pressed operation and the state of the buttons
 /// </summary>
 private string NewCurrentExpression(AdditionalOperations pressedOperation)
 {
     //If an additional operation is not used for the first time
     if (buttonsState.AdditionalOperationBtnPressed)
     {
         return(ChangeTheSetOfRecentAdditionalOperations(currentData.CurrentExpression, SetSelectedAdditionalOperation(pressedOperation)));
     }
     else
     {
         return(currentData.CurrentExpression + SetSelectedAdditionalOperation(pressedOperation) + '(' + NumberStandardization.Standardization(currentData.CurrentNumber) + ')');
     }
 }