mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-31 03:50:02 -07:00
Add variable editing (#581)
This commit is contained in:
parent
a418777f02
commit
46f11c7c72
12 changed files with 519 additions and 6 deletions
|
@ -2,17 +2,37 @@
|
|||
#include "GraphingCalculatorViewModel.h"
|
||||
|
||||
using namespace CalculatorApp::ViewModel;
|
||||
using namespace Platform;
|
||||
using namespace Platform::Collections;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
|
||||
namespace CalculatorApp::ViewModel
|
||||
{
|
||||
GraphingCalculatorViewModel::GraphingCalculatorViewModel()
|
||||
: m_IsDecimalEnabled{ true }
|
||||
, m_Equations{ ref new Vector< EquationViewModel^ >() }
|
||||
, m_Variables{ ref new Vector< VariableViewModel^ >() }
|
||||
{
|
||||
}
|
||||
|
||||
void GraphingCalculatorViewModel::OnButtonPressed(Object^ parameter)
|
||||
{
|
||||
}
|
||||
|
||||
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 });
|
||||
});
|
||||
Variables->Append(variable);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue