mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-24 06:55:19 -07:00
Fix decimal bug
Fix bug that causes the decimal option to be disabled when switching from Currency to another conversion category.
This commit is contained in:
parent
78cd6d52da
commit
332bdfdc71
1 changed files with 11 additions and 2 deletions
|
@ -174,6 +174,8 @@ void UnitConverterViewModel::ResetCategory()
|
||||||
m_isInputBlocked = false;
|
m_isInputBlocked = false;
|
||||||
SetSelectedUnits();
|
SetSelectedUnits();
|
||||||
|
|
||||||
|
UpdateIsDecimalEnabled();
|
||||||
|
|
||||||
IsCurrencyLoadingVisible = m_IsCurrencyCurrentCategory && !m_isCurrencyDataLoaded;
|
IsCurrencyLoadingVisible = m_IsCurrencyCurrentCategory && !m_isCurrencyDataLoaded;
|
||||||
IsDropDownEnabled = m_Units->GetAt(0) != EMPTY_UNIT;
|
IsDropDownEnabled = m_Units->GetAt(0) != EMPTY_UNIT;
|
||||||
|
|
||||||
|
@ -693,7 +695,8 @@ void UnitConverterViewModel::RefreshCurrencyRatios()
|
||||||
auto that(this);
|
auto that(this);
|
||||||
auto refreshTask = create_task([that] { return that->m_model->RefreshCurrencyRatios().get(); });
|
auto refreshTask = create_task([that] { return that->m_model->RefreshCurrencyRatios().get(); });
|
||||||
refreshTask.then(
|
refreshTask.then(
|
||||||
[that](const pair<bool, wstring>& refreshResult) {
|
[that](const pair<bool, wstring>& refreshResult)
|
||||||
|
{
|
||||||
bool didLoad = refreshResult.first;
|
bool didLoad = refreshResult.first;
|
||||||
wstring timestamp = refreshResult.second;
|
wstring timestamp = refreshResult.second;
|
||||||
|
|
||||||
|
@ -870,7 +873,13 @@ void UnitConverterViewModel::UpdateCurrencyFormatter()
|
||||||
|
|
||||||
void UnitConverterViewModel::UpdateIsDecimalEnabled()
|
void UnitConverterViewModel::UpdateIsDecimalEnabled()
|
||||||
{
|
{
|
||||||
if (!IsCurrencyCurrentCategory || CurrencyFormatterFrom == nullptr)
|
if (!IsCurrencyCurrentCategory)
|
||||||
|
{
|
||||||
|
IsDecimalEnabled = true; // Always have decimal enabled if we aren't in a currency category.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CurrencyFormatterFrom == nullptr)
|
||||||
return;
|
return;
|
||||||
IsDecimalEnabled = CurrencyFormatterFrom->FractionDigits > 0;
|
IsDecimalEnabled = CurrencyFormatterFrom->FractionDigits > 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue