Propose minor code-cleanups (#241)
Description of the changes: Remove unnecessary 'else', 'continue' statements How changes were validated: Manual.
This commit is contained in:
parent
b8b0fdf86b
commit
965e36cc5d
@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
@ -202,13 +202,11 @@ void UnitConverterViewModel::BuildUnitList(const vector<UCM::Unit>& modelUnitLis
|
||||
m_Units->Clear();
|
||||
for (const UCM::Unit& modelUnit : modelUnitList)
|
||||
{
|
||||
if (modelUnit.isWhimsical)
|
||||
if (!modelUnit.isWhimsical)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
m_Units->Append(ref new Unit(modelUnit));
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Units->Size == 0)
|
||||
{
|
||||
@ -643,11 +641,9 @@ String^ UnitConverterViewModel::Serialize()
|
||||
String^ serializedData = ref new String(wstring(out.str()).c_str());
|
||||
return serializedData;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void UnitConverterViewModel::Deserialize(Platform::String^ state)
|
||||
{
|
||||
@ -879,14 +875,11 @@ void UnitConverterViewModel::UpdateInputBlocked(_In_ const wstring& currencyInpu
|
||||
{
|
||||
// currencyInput is in en-US and has the default decimal separator, so this is safe to do.
|
||||
auto posOfDecimal = currencyInput.find(L'.');
|
||||
m_isInputBlocked = false;
|
||||
if (posOfDecimal != wstring::npos && IsCurrencyCurrentCategory)
|
||||
{
|
||||
m_isInputBlocked = (posOfDecimal + static_cast<size_t>(m_currencyMaxFractionDigits) + 1 == currencyInput.length());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_isInputBlocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
NumbersAndOperatorsEnum UnitConverterViewModel::MapCharacterToButtonId(
|
||||
@ -988,7 +981,7 @@ void UnitConverterViewModel::OnPaste(String^ stringToPaste, ViewMode mode)
|
||||
}
|
||||
|
||||
// Negate is only allowed if it's the first legal character, which is handled above.
|
||||
if (NumbersAndOperatorsEnum::None != op && NumbersAndOperatorsEnum::Negate != op)
|
||||
if (NumbersAndOperatorsEnum::Negate != op)
|
||||
{
|
||||
UCM::Command cmd = CommandFromButtonId(op);
|
||||
m_model->SendCommand(cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user