Persist variable settings after graph is plotted (#1055)

* Allow copying graph as image

* Persist variables

* Revert "Allow copying graph as image"

This reverts commit 4fc9d798bc.

* fix binding bug

* undo cert change

* fix animation

* remove extra lines

* remove overrides

* undo key comment
This commit is contained in:
Pepe Rivera 2020-03-17 11:27:00 -07:00 committed by GitHub
parent 1b72ecb6b3
commit 28dbdb3d94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 125 additions and 50 deletions

View file

@ -10,6 +10,7 @@ using namespace Platform::Collections;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml::Data;
using namespace GraphControl;
namespace CalculatorApp::ViewModel
{
@ -24,12 +25,12 @@ namespace CalculatorApp::ViewModel
{
}
void GraphingCalculatorViewModel::UpdateVariables(IMap<String ^, double> ^ variables)
void GraphingCalculatorViewModel::UpdateVariables(IMap<String ^, Variable ^> ^ variables)
{
Variables->Clear();
for (auto var : variables)
for (auto variablePair : variables)
{
auto variable = ref new VariableViewModel(var->Key, var->Value);
auto variable = ref new VariableViewModel(variablePair->Key, variablePair->Value);
variable->VariableUpdated += ref new EventHandler<VariableChangedEventArgs>([this, variable](Object ^ sender, VariableChangedEventArgs e) {
VariableUpdated(variable, VariableChangedEventArgs{ e.variableName, e.newValue });
});