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
@ -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)
|
||||
|
@ -283,7 +283,7 @@ namespace CalculatorApp
|
||||
void Recalculate(bool fromHistory = false);
|
||||
bool IsOperator(CalculationManager::Command cmdenum);
|
||||
void SetMemorizedNumbersString();
|
||||
void ResetDisplay();
|
||||
void ResetRadixAndUpdateMemory(bool resetRadix);
|
||||
|
||||
void SetPrecision(int32_t precision);
|
||||
void UpdateMaxIntDigits()
|
||||
|
@ -42,7 +42,7 @@ namespace CalculatorUnitTests
|
||||
viewModel->IsStandard = true;
|
||||
viewModel->IsScientific = false;
|
||||
viewModel->IsProgrammer = false;
|
||||
viewModel->ResetDisplay();
|
||||
viewModel->ResetRadixAndUpdateMemory(true);
|
||||
viewModel->SetPrecision(StandardModePrecision);
|
||||
}
|
||||
else if (mode == 1)
|
||||
@ -50,7 +50,7 @@ namespace CalculatorUnitTests
|
||||
viewModel->IsScientific = true;
|
||||
viewModel->IsProgrammer = false;
|
||||
viewModel->IsStandard = false;
|
||||
viewModel->ResetDisplay();
|
||||
viewModel->ResetRadixAndUpdateMemory(true);
|
||||
viewModel->SetPrecision(ScientificModePrecision);
|
||||
}
|
||||
else if (mode == 2)
|
||||
@ -58,7 +58,7 @@ namespace CalculatorUnitTests
|
||||
viewModel->IsProgrammer = true;
|
||||
viewModel->IsScientific = false;
|
||||
viewModel->IsStandard = false;
|
||||
viewModel->ResetDisplay();
|
||||
viewModel->ResetRadixAndUpdateMemory(false);
|
||||
viewModel->SetPrecision(ProgrammerModePrecision);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user