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

@ -903,21 +903,6 @@ void StandardCalculatorViewModel::OnClearMemoryCommand(Object ^ parameter)
Announcement = CalculatorAnnouncement::GetMemoryClearedAnnouncement(m_localizedMemoryCleared);
}
void StandardCalculatorViewModel::OnPinUnpinCommand(Object ^ parameter)
{
SetViewPinnedState(!IsViewPinned());
}
bool StandardCalculatorViewModel::IsViewPinned()
{
return m_IsCurrentViewPinned;
}
void StandardCalculatorViewModel::SetViewPinnedState(bool pinned)
{
IsCurrentViewPinned = pinned;
}
ButtonInfo StandardCalculatorViewModel::MapCharacterToButtonId(char16 ch)
{
ButtonInfo result;
@ -1476,15 +1461,6 @@ void StandardCalculatorViewModel::Recalculate(bool fromHistory)
}
}
CommandType StandardCalculatorViewModel::GetSelectedTokenType(_In_ unsigned int tokenPosition)
{
const pair<wstring, int>& token = m_tokens->at(tokenPosition);
unsigned int tokenCommandIndex = token.second;
const shared_ptr<IExpressionCommand>& tokenCommand = m_commands->at(tokenCommandIndex);
return tokenCommand->GetCommandType();
}
bool StandardCalculatorViewModel::IsOpnd(Command command)
{
static constexpr Command opnd[] = { Command::Command0, Command::Command1, Command::Command2, Command::Command3, Command::Command4, Command::Command5,
@ -1626,26 +1602,6 @@ void StandardCalculatorViewModel::SwitchAngleType(NumbersAndOperatorsEnum num)
OnButtonPressed(num);
}
NumbersAndOperatorsEnum StandardCalculatorViewModel::ConvertIntegerToNumbersAndOperatorsEnum(unsigned int parameter)
{
NumbersAndOperatorsEnum angletype;
switch (parameter)
{
case 321:
angletype = NumbersAndOperatorsEnum::Degree;
break;
case 322:
angletype = NumbersAndOperatorsEnum::Radians;
break;
case 323:
angletype = NumbersAndOperatorsEnum::Grads;
break;
default:
angletype = NumbersAndOperatorsEnum::Degree;
};
return angletype;
}
void StandardCalculatorViewModel::UpdateOperand(int pos, String ^ text)
{
pair<wstring, int> p = m_tokens->at(pos);