CalcViewModel code cleaning (#754)

* move KeyboardShortcutManager, ValidationConverter and ViewState to Calculator
* remove dead code listed in #753
* remove Microsoft.UI.Xaml nuget package from CalcViewModel
This commit is contained in:
Rudy Huyn
2020-01-07 13:59:51 -08:00
committed by Matt Cooley
parent 712bdb1b7c
commit 2d177e5160
31 changed files with 77 additions and 378 deletions

View File

@@ -478,21 +478,11 @@ void UnitConverterViewModel::OnButtonPressed(Platform::Object ^ parameter)
static constexpr UCM::Command OPERANDS[] = { UCM::Command::Zero, UCM::Command::One, UCM::Command::Two, UCM::Command::Three, UCM::Command::Four,
UCM::Command::Five, UCM::Command::Six, UCM::Command::Seven, UCM::Command::Eight, UCM::Command::Nine };
if (find(begin(OPERANDS), end(OPERANDS), command) != end(OPERANDS))
{
if (m_isInputBlocked)
{
return;
}
if (m_IsCurrencyCurrentCategory)
{
StartConversionResultTimer();
}
}
m_model->SendCommand(command);
if (m_isInputBlocked)
{
return;
}
m_model->SendCommand(command);
TraceLogger::GetInstance()->LogConverterInputReceived(Mode);
}
@@ -998,18 +988,6 @@ bool UnitConverterViewModel::UnitsAreValid()
return UnitFrom != nullptr && !UnitFrom->Abbreviation->IsEmpty() && UnitTo != nullptr && !UnitTo->Abbreviation->IsEmpty();
}
void UnitConverterViewModel::StartConversionResultTimer()
{
auto that(this);
m_conversionResultTaskHelper = make_unique<ConversionResultTaskHelper>(CONVERSION_FINALIZED_DELAY_IN_MS, [that]() {
if (that->UnitsAreValid())
{
String ^ valueFrom = that->m_Value1Active ? that->m_Value1 : that->m_Value2;
String ^ valueTo = that->m_Value1Active ? that->m_Value2 : that->m_Value1;
}
});
}
String ^ SupplementaryResult::GetLocalizedAutomationName()
{
auto format = AppResourceProvider::GetInstance()->GetResourceString("SupplementaryUnit_AutomationName");