mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-13 08:42:53 -07:00
Fix the result in wrong number base while leaving and switching back … (#1654)
* Fix the result in wrong number base while leaving and switching back to Programmer * Rename ResetDisplay() to ResetRadix() * Update related unit test * Fixed the decimal number with point in programmer memory
This commit is contained in:
parent
28a143c07d
commit
ce014908e2
3 changed files with 18 additions and 11 deletions
|
@ -1188,20 +1188,20 @@ void StandardCalculatorViewModel::SetCalculatorType(ViewMode targetState)
|
|||
{
|
||||
case ViewMode::Standard:
|
||||
IsStandard = true;
|
||||
ResetDisplay();
|
||||
ResetRadixAndUpdateMemory(true);
|
||||
SetPrecision(StandardModePrecision);
|
||||
UpdateMaxIntDigits();
|
||||
break;
|
||||
|
||||
case ViewMode::Scientific:
|
||||
IsScientific = true;
|
||||
ResetDisplay();
|
||||
ResetRadixAndUpdateMemory(true);
|
||||
SetPrecision(ScientificModePrecision);
|
||||
break;
|
||||
|
||||
case ViewMode::Programmer:
|
||||
IsProgrammer = true;
|
||||
ResetDisplay();
|
||||
ResetRadixAndUpdateMemory(false);
|
||||
SetPrecision(ProgrammerModePrecision);
|
||||
break;
|
||||
}
|
||||
|
@ -1227,11 +1227,18 @@ String ^ StandardCalculatorViewModel::GetLocalizedStringFormat(String ^ format,
|
|||
return LocalizationStringUtil::GetLocalizedString(format, displayValue);
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::ResetDisplay()
|
||||
void StandardCalculatorViewModel::ResetRadixAndUpdateMemory(bool resetRadix)
|
||||
{
|
||||
AreHEXButtonsEnabled = false;
|
||||
CurrentRadixType = NumberBase::DecBase;
|
||||
m_standardCalculatorManager.SetRadix(RadixType::Decimal);
|
||||
if (resetRadix)
|
||||
{
|
||||
AreHEXButtonsEnabled = false;
|
||||
CurrentRadixType = NumberBase::DecBase;
|
||||
m_standardCalculatorManager.SetRadix(RadixType::Decimal);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_standardCalculatorManager.SetMemorizedNumbersString();
|
||||
}
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::SetPrecision(int32_t precision)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue