mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-20 13:23:13 -07:00
Reset Calculator Type in Calculator ViewModel when mode change to not Calculator mode
This commit is contained in:
parent
9e90389a14
commit
a0d2f84513
2 changed files with 14 additions and 0 deletions
|
@ -125,6 +125,14 @@ bool ApplicationViewModel::TryRecoverFromNavigationModeFailure()
|
||||||
void ApplicationViewModel::OnModeChanged()
|
void ApplicationViewModel::OnModeChanged()
|
||||||
{
|
{
|
||||||
assert(NavCategory::IsValidViewMode(m_mode));
|
assert(NavCategory::IsValidViewMode(m_mode));
|
||||||
|
if (NavCategory::IsValidViewMode(m_PreviousMode) && NavCategory::IsCalculatorViewMode(m_PreviousMode) && !NavCategory::IsCalculatorViewMode(m_mode))
|
||||||
|
{
|
||||||
|
if (m_CalculatorViewModel)
|
||||||
|
{
|
||||||
|
m_CalculatorViewModel->SetCalculatorType(m_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (NavCategory::IsCalculatorViewMode(m_mode))
|
if (NavCategory::IsCalculatorViewMode(m_mode))
|
||||||
{
|
{
|
||||||
if (!m_CalculatorViewModel)
|
if (!m_CalculatorViewModel)
|
||||||
|
|
|
@ -1205,6 +1205,12 @@ void StandardCalculatorViewModel::SetCalculatorType(ViewMode targetState)
|
||||||
ResetDisplay();
|
ResetDisplay();
|
||||||
SetPrecision(ProgrammerModePrecision);
|
SetPrecision(ProgrammerModePrecision);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
IsStandard = false;
|
||||||
|
IsScientific = false;
|
||||||
|
IsProgrammer = false;
|
||||||
|
ResetDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue