mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-21 22:03:11 -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;
|
||||
SetSelectedUnits();
|
||||
|
||||
UpdateIsDecimalEnabled();
|
||||
|
||||
IsCurrencyLoadingVisible = m_IsCurrencyCurrentCategory && !m_isCurrencyDataLoaded;
|
||||
IsDropDownEnabled = m_Units->GetAt(0) != EMPTY_UNIT;
|
||||
|
||||
|
@ -693,7 +695,8 @@ void UnitConverterViewModel::RefreshCurrencyRatios()
|
|||
auto that(this);
|
||||
auto refreshTask = create_task([that] { return that->m_model->RefreshCurrencyRatios().get(); });
|
||||
refreshTask.then(
|
||||
[that](const pair<bool, wstring>& refreshResult) {
|
||||
[that](const pair<bool, wstring>& refreshResult)
|
||||
{
|
||||
bool didLoad = refreshResult.first;
|
||||
wstring timestamp = refreshResult.second;
|
||||
|
||||
|
@ -870,7 +873,13 @@ void UnitConverterViewModel::UpdateCurrencyFormatter()
|
|||
|
||||
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;
|
||||
IsDecimalEnabled = CurrencyFormatterFrom->FractionDigits > 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue