GraphControl: refactoring and optimizations (#831)

* GraphControl cleaning

* replace textbox value after submission

* rebase

* rebase

* rebase

* Add filters

* rebase!

* rebase
This commit is contained in:
Rudy Huyn 2019-12-13 16:33:08 -08:00 committed by Eric Wong
parent da38b5a015
commit 534139d67d
33 changed files with 1169 additions and 1393 deletions

View file

@ -15,27 +15,30 @@ namespace CalculatorApp::ViewModel
{
GraphingCalculatorViewModel::GraphingCalculatorViewModel()
: m_IsDecimalEnabled{ true }
, m_Equations{ ref new Vector< EquationViewModel^ >() }
, m_Variables{ ref new Vector< VariableViewModel^ >() }
, m_Equations{ ref new Vector<EquationViewModel ^>() }
, m_Variables{ ref new Vector<VariableViewModel ^>() }
{
}
void GraphingCalculatorViewModel::OnButtonPressed(Object^ parameter)
void GraphingCalculatorViewModel::OnButtonPressed(Object ^ parameter)
{
}
void GraphingCalculatorViewModel::UpdateVariables(IMap<String^, double>^ variables)
void GraphingCalculatorViewModel::UpdateVariables(IMap<String ^, double> ^ variables)
{
Variables->Clear();
for (auto var : variables)
{
auto variable = ref new VariableViewModel(var->Key, var->Value);
variable->VariableUpdated += ref new EventHandler<VariableChangedEventArgs>([this, variable](Object^ sender, VariableChangedEventArgs e)
{
VariableUpdated(variable, VariableChangedEventArgs{ e.variableName, e.newValue });
});
variable->VariableUpdated += ref new EventHandler<VariableChangedEventArgs>([this, variable](Object ^ sender, VariableChangedEventArgs e) {
VariableUpdated(variable, VariableChangedEventArgs{ e.variableName, e.newValue });
});
Variables->Append(variable);
}
}
void GraphingCalculatorViewModel::SetSelectedEquation(EquationViewModel ^ equation)
{
SelectedEquation = equation;
}
}