mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-16 02:02:51 -07:00
* 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
45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#include "pch.h"
|
|
#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;
|
|
using namespace GraphControl;
|
|
|
|
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 ^, Variable ^> ^ variables)
|
|
{
|
|
Variables->Clear();
|
|
for (auto variablePair : variables)
|
|
{
|
|
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 });
|
|
});
|
|
Variables->Append(variable);
|
|
}
|
|
}
|
|
|
|
void GraphingCalculatorViewModel::SetSelectedEquation(EquationViewModel ^ equation)
|
|
{
|
|
SelectedEquation = equation;
|
|
}
|
|
}
|