Ejemplo n.º 1
0
 public static void ClearLastSymbol(this DisplayNumber displayNumber)
 {
     if (displayNumber.HasComma)
     {
         if (!string.IsNullOrEmpty(displayNumber.FractionalPart))
         {
             displayNumber.FractionalPart = displayNumber.FractionalPart.Substring(0, displayNumber.FractionalPart.Length - 1);
         }
         else
         {
             displayNumber.HasComma = false;
         }
     }
     else
     {
         var integerPartLength = displayNumber.IntegerPart.Length;
         if (integerPartLength > 1)
         {
             displayNumber.IntegerPart = displayNumber.IntegerPart.Substring(0, integerPartLength - 1);
         }
         else
         {
             displayNumber.Reset();
         }
     }
 }
Ejemplo n.º 2
0
        private void ApplyNumber(char symbol)
        {
            if (_displayNumber.IsDefault())
            {
                _displayNumber.IntegerPart = string.Empty;
            }

            if (_isLastActionAnBinaryOperation || _isLastActionAnEquation)
            {
                _displayNumber.Reset();
                _displayNumber.IntegerPart = string.Empty;
            }

            if (!_displayNumber.HasComma)
            {
                _displayNumber.IntegerPart += symbol;
            }
            else
            {
                _displayNumber.FractionalPart += symbol;
            }
        }