mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-13 00:32:52 -07:00
Remove saved commands from CalculatorManager (#1230)
This commit is contained in:
parent
79bd149b12
commit
c37f540265
5 changed files with 1 additions and 152 deletions
|
@ -1655,66 +1655,6 @@ void StandardCalculatorViewModel::UpdateOperand(int pos, String ^ text)
|
|||
}
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::UpdateCommandsInRecordingMode()
|
||||
{
|
||||
shared_ptr<vector<int>> commands = make_shared<vector<int>>();
|
||||
bool isDecimal = false;
|
||||
bool isNegative = false;
|
||||
bool isExpMode = false;
|
||||
bool ePlusMode = false;
|
||||
bool eMinusMode = false;
|
||||
|
||||
for (const auto savedCommand : m_standardCalculatorManager.GetSavedCommands())
|
||||
{
|
||||
const Command val = static_cast<Command>(savedCommand);
|
||||
if (val == Command::CommandSIGN)
|
||||
{
|
||||
isNegative = true;
|
||||
continue;
|
||||
}
|
||||
else if ((val >= Command::Command0 && val <= Command::Command9))
|
||||
{
|
||||
}
|
||||
else if (val == Command::CommandPNT)
|
||||
{
|
||||
isDecimal = true;
|
||||
}
|
||||
else if (val == Command::CommandEXP)
|
||||
{
|
||||
isExpMode = true;
|
||||
}
|
||||
else if (isExpMode && !ePlusMode && (val == Command::CommandMPLUS))
|
||||
{
|
||||
ePlusMode = true;
|
||||
continue;
|
||||
}
|
||||
else if (isExpMode && !eMinusMode && (val == Command::CommandMMINUS))
|
||||
{
|
||||
eMinusMode = true;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset all vars
|
||||
isDecimal = false;
|
||||
isNegative = false;
|
||||
isExpMode = false;
|
||||
ePlusMode = false;
|
||||
eMinusMode = false;
|
||||
commands->clear();
|
||||
continue;
|
||||
}
|
||||
commands->push_back(static_cast<int>(val));
|
||||
}
|
||||
|
||||
if (!commands->empty())
|
||||
{
|
||||
shared_ptr<IOpndCommand> sp = make_shared<COpndCommand>(commands, isNegative, isDecimal, isExpMode);
|
||||
m_commands->push_back(sp);
|
||||
}
|
||||
Recalculate();
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::OnMaxDigitsReached()
|
||||
{
|
||||
if (m_localizedMaxDigitsReachedAutomationFormat == nullptr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue