private void HandleDigitCommand(DigitCommand digitCommand) { // Scenarios // If accumulator has zero and digit is zero then ignore. // If accumulator has zero and digit is non zero, then replace // Else append var cpu = this.Calculator.CPU; if (cpu.Accumulator.ToString() == "0" && digitCommand.Digit == 0) { return; } if (cpu.Accumulator.ToString() == "0" && digitCommand.Digit != 0) { cpu.Accumulator.SetValue(digitCommand.Digit); } else { cpu.Accumulator.Append(digitCommand.Digit.ToString()); } }
private void RaiseAllCanExecute() { DigitCommand.RaiseCanExecuteChanged(); ClearCommand.RaiseCanExecuteChanged(); SubmitCommand.RaiseCanExecuteChanged(); }