jCalc/Calculator.xaml.cs
/// <summary>
/// Apply current pending operation, update displayEntry with results, 
/// add new pending operation
/// </summary>
/// <param name="op">New pending operation</param>
Apply current pending operation, update displayEntry with results,
add new pending operation
Apply current pending operation update displayEntry with results add new pending operation
public void ApplyOperation(Operation op)
        {
            if (op != Operation.NONE && !IsEntryClear())
            {
                if (pendingOperationLocked)
                {
                    AddToTicker(displayEntry + op.GetDescription()[0]);
                    Process(Convert.ToDouble(displayEntry));
                    ReplaceEntry(currentResult.ToString());
                    pendingOperation = op;
                }
                else
                {
                    ReplaceTickerOperation(op.GetDescription()[0]);
                    pendingOperation = op;      
                }
                pendingOperationLocked = false;
            }
        }
public void ApplyOperation ( Operation op ) { if ( op != Operation . NONE && ! IsEntryClear ( ) ) { if ( pendingOperationLocked ) { AddToTicker ( displayEntry + op . GetDescription ( ) [ 0 ] ) ; Process ( Convert . ToDouble ( displayEntry ) ) ; ReplaceEntry ( currentResult . ToString ( ) ) ; pendingOperation = op ; } else { ReplaceTickerOperation ( op . GetDescription ( ) [ 0 ] ) ; pendingOperation = op ; } pendingOperationLocked = false ; } }
Apply current pending operation, update displayEntry with results,
add new pending operation
Apply current pending operation update displayEntry with results add new pending operation
// Apply only if operation is set AND a value other than 0 is in the entry // Pending operation is locked: must apply pending and set new operation // Pending operation can be changed: do not apply current pending operation
op
Operation
New pending operation
New pending operation