diff --git a/src/CalcManager/CalcManager.vcxproj b/src/CalcManager/CalcManager.vcxproj
index 00803dca..a0ee84ed 100644
--- a/src/CalcManager/CalcManager.vcxproj
+++ b/src/CalcManager/CalcManager.vcxproj
@@ -45,7 +45,7 @@
true
Windows Store
10.0
- 10.0.18970.0
+ 10.0.19019.0
10.0.17134.0
diff --git a/src/CalcViewModel/CalcViewModel.vcxproj b/src/CalcViewModel/CalcViewModel.vcxproj
index 5ca5e036..f506dff2 100644
--- a/src/CalcViewModel/CalcViewModel.vcxproj
+++ b/src/CalcViewModel/CalcViewModel.vcxproj
@@ -42,7 +42,7 @@
14.0
true
Windows Store
- 10.0.18970.0
+ 10.0.19019.0
10.0.17134.0
10.0
@@ -351,6 +351,7 @@
+
diff --git a/src/CalcViewModel/CalcViewModel.vcxproj.filters b/src/CalcViewModel/CalcViewModel.vcxproj.filters
index 3251ab94..3414655e 100644
--- a/src/CalcViewModel/CalcViewModel.vcxproj.filters
+++ b/src/CalcViewModel/CalcViewModel.vcxproj.filters
@@ -220,6 +220,9 @@
DataLoaders
+
+ Common
+
diff --git a/src/CalcViewModel/GraphingCalculator/EquationViewModel.cpp b/src/CalcViewModel/GraphingCalculator/EquationViewModel.cpp
index c09ff768..ae9b63f9 100644
--- a/src/CalcViewModel/GraphingCalculator/EquationViewModel.cpp
+++ b/src/CalcViewModel/GraphingCalculator/EquationViewModel.cpp
@@ -1,14 +1,324 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
#include "pch.h"
#include "EquationViewModel.h"
+#include "CalcViewModel\Common\LocalizationSettings.h"
+#include "CalcViewModel\GraphingCalculatorEnums.h"
+using namespace CalculatorApp::Common;
+using namespace Graphing;
+using namespace Platform;
+using namespace Platform::Collections;
+using namespace std;
using namespace Windows::UI;
using namespace Windows::UI::Xaml;
+using namespace Windows::Foundation::Collections;
namespace CalculatorApp::ViewModel
{
- EquationViewModel::EquationViewModel()
- : m_LineColor{ nullptr }, m_KeyGraphFeaturesVisibility{ ::Visibility::Collapsed }
- , m_Expression{ "" }
+ GridDisplayItems::GridDisplayItems()
+ : m_Expression{ "" }
+ , m_Direction{ "" }
{
}
+
+ KeyGraphFeaturesItem::KeyGraphFeaturesItem()
+ : m_Title{ "" }
+ , m_DisplayItems{ ref new Vector() }
+ , m_GridItems{ ref new Vector() }
+ , m_IsText{ false }
+ {
+ }
+
+ EquationViewModel::EquationViewModel()
+ : m_LineColor{ nullptr }
+ , m_Expression{ "" }
+ , m_IsAnalysisUpdated{ false }
+ , m_Domain{ "" }
+ , m_Range{ "" }
+ , m_XIntercept{ "" }
+ , m_YIntercept{ "" }
+ , m_Parity{ -1 }
+ , m_PeriodicityDirection{ -1 }
+ , m_PeriodicityExpression{ "" }
+ , m_Minima{ ref new Vector() }
+ , m_Maxima{ ref new Vector() }
+ , m_InflectionPoints{ ref new Vector() }
+ , m_Monotonicity{ ref new Map() }
+ , m_VerticalAsymptotes{ ref new Vector() }
+ , m_HorizontalAsymptotes{ ref new Vector() }
+ , m_ObliqueAsymptotes{ ref new Vector() }
+ , m_TooComplexFeatures{ -1 }
+ , m_AnalysisError{ 0 }
+ , m_AnalysisErrorVisible{ false }
+ , m_KeyGraphFeaturesItems{ ref new Vector() }
+ , m_resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() }
+ {
+ }
+
+ void EquationViewModel::OnPropertyChanged(String ^ propertyName)
+ {
+ if (propertyName == L"IsAnalysisUpdated")
+ {
+ OnIsAnalysisUpdatedChanged();
+ }
+ }
+
+ void EquationViewModel::OnIsAnalysisUpdatedChanged()
+ {
+ if (IsAnalysisUpdated)
+ {
+ if (AnalysisError != 0)
+ {
+ AnalysisErrorVisible = true;
+ if (AnalysisError == static_cast(AnalysisErrorType::AnalysisCouldNotBePerformed))
+ {
+ AnalysisErrorString = m_resourceLoader->GetString(L"KGFAnalysisCouldNotBePerformed");
+ }
+ else if (AnalysisError == static_cast(AnalysisErrorType::AnalysisNotSupported))
+ {
+ AnalysisErrorString = m_resourceLoader->GetString(L"KGFAnalysisNotSupported");
+ }
+ return;
+ }
+ KeyGraphFeaturesItems->Clear();
+ SetKeyGraphFeaturesItems(m_resourceLoader->GetString(L"Domain"), Domain, m_resourceLoader->GetString(L"KGFDomainNone"));
+ SetKeyGraphFeaturesItems(m_resourceLoader->GetString(L"Range"), Range, m_resourceLoader->GetString(L"KGFRangeNone"));
+ SetKeyGraphFeaturesItems(m_resourceLoader->GetString(L"XIntercept"), XIntercept, m_resourceLoader->GetString(L"KGFXInterceptNone"));
+ SetKeyGraphFeaturesItems(m_resourceLoader->GetString(L"YIntercept"), YIntercept, m_resourceLoader->GetString(L"KGFYInterceptNone"));
+ SetKeyGraphFeaturesItems(m_resourceLoader->GetString(L"Minima"), Minima, m_resourceLoader->GetString(L"KGFMinimaNone"));
+ SetKeyGraphFeaturesItems(m_resourceLoader->GetString(L"Maxima"), Maxima, m_resourceLoader->GetString(L"KGFMaximaNone"));
+ SetKeyGraphFeaturesItems(
+ m_resourceLoader->GetString(L"InflectionPoints"), InflectionPoints, m_resourceLoader->GetString(L"KGFInflectionPointsNone"));
+ SetKeyGraphFeaturesItems(
+ m_resourceLoader->GetString(L"VerticalAsymptotes"), VerticalAsymptotes, m_resourceLoader->GetString(L"KGFVerticalAsymptotesNone"));
+ SetKeyGraphFeaturesItems(
+ m_resourceLoader->GetString(L"HorizontalAsymptotes"), HorizontalAsymptotes, m_resourceLoader->GetString(L"KGFHorizontalAsymptotesNone"));
+ SetKeyGraphFeaturesItems(
+ m_resourceLoader->GetString(L"ObliqueAsymptotes"), ObliqueAsymptotes, m_resourceLoader->GetString(L"KGFObliqueAsymptotesNone"));
+ SetParityStringProperty();
+ SetPeriodicityStringProperty();
+ SetMonotoncityStringProperty();
+ SetTooComplexFeaturesErrorProperty();
+
+ AnalysisErrorVisible = false;
+ IsAnalysisUpdated = false;
+ }
+ }
+
+ void EquationViewModel::SetKeyGraphFeaturesItems(String ^ title, String ^ expression, String ^ errorString)
+ {
+ KeyGraphFeaturesItem ^ item = ref new KeyGraphFeaturesItem();
+ item->Title = title;
+ if (expression != L"")
+ {
+ item->DisplayItems->Append(expression);
+ item->IsText = false;
+ }
+ else
+ {
+ item->DisplayItems->Append(errorString);
+ item->IsText = true;
+ }
+ KeyGraphFeaturesItems->Append(item);
+ }
+
+ void EquationViewModel::SetKeyGraphFeaturesItems(String ^ title, IObservableVector ^ expressionVector, String ^ errorString)
+ {
+ KeyGraphFeaturesItem ^ item = ref new KeyGraphFeaturesItem();
+ item->Title = title;
+ if (expressionVector->Size != 0)
+ {
+ for (auto expression : expressionVector)
+ {
+ item->DisplayItems->Append(expression);
+ }
+ item->IsText = false;
+ }
+ else
+ {
+ item->DisplayItems->Append(errorString);
+ item->IsText = true;
+ }
+ KeyGraphFeaturesItems->Append(item);
+ }
+
+ void EquationViewModel::SetParityStringProperty()
+ {
+ KeyGraphFeaturesItem ^ parityItem = ref new KeyGraphFeaturesItem();
+ parityItem->Title = m_resourceLoader->GetString(L"Parity");
+ switch (Parity)
+ {
+ case 0:
+ parityItem->DisplayItems->Append(m_resourceLoader->GetString(L"KGFParityUnknown"));
+ break;
+ case 1:
+ parityItem->DisplayItems->Append(m_resourceLoader->GetString(L"KGFParityOdd"));
+ break;
+ case 2:
+ parityItem->DisplayItems->Append(m_resourceLoader->GetString(L"KGFParityEven"));
+ break;
+ case 3:
+ parityItem->DisplayItems->Append(m_resourceLoader->GetString(L"KGFParityNeither"));
+ break;
+ default:
+ parityItem->DisplayItems->Append(m_resourceLoader->GetString(L"KGFParityUnknown"));
+
+ }
+ parityItem->IsText = true;
+
+ KeyGraphFeaturesItems->Append(parityItem);
+ }
+
+ void EquationViewModel::SetPeriodicityStringProperty()
+ {
+ KeyGraphFeaturesItem ^ periodicityItem = ref new KeyGraphFeaturesItem();
+ periodicityItem->Title = m_resourceLoader->GetString(L"Periodicity");
+ switch (PeriodicityDirection)
+ {
+ case 0:
+ // Periodicity is not supported or is too complex to calculate.
+ // Return out of this function without adding periodicity to KeyGraphFeatureItems.
+ // SetTooComplexFeaturesErrorProperty will set the too complex error when periodicity is supported and unknown
+ return;
+ case 1:
+ if (PeriodicityExpression == L"")
+ {
+ periodicityItem->DisplayItems->Append(m_resourceLoader->GetString(L"KGFPeriodicityUnknown"));
+ periodicityItem->IsText = true;
+ }
+ else
+ {
+ periodicityItem->DisplayItems->Append(PeriodicityExpression);
+ periodicityItem->IsText = false;
+ }
+ break;
+ case 2:
+ periodicityItem->DisplayItems->Append(m_resourceLoader->GetString(L"KGFPeriodicityNotPeriodic"));
+ periodicityItem->IsText = false;
+ break;
+ default:
+ periodicityItem->DisplayItems->Append(m_resourceLoader->GetString(L"KGFPeriodicityError"));
+ periodicityItem->IsText = true;
+ }
+
+ KeyGraphFeaturesItems->Append(periodicityItem);
+ }
+
+ void EquationViewModel::SetMonotoncityStringProperty()
+ {
+ KeyGraphFeaturesItem ^ monotonicityItem = ref new KeyGraphFeaturesItem();
+ monotonicityItem->Title = m_resourceLoader->GetString(L"Monotonicity");
+ if (Monotonicity->Size != 0)
+ {
+ for (auto item : Monotonicity)
+ {
+ GridDisplayItems ^ gridItem = ref new GridDisplayItems();
+ gridItem->Expression = item->Key;
+
+ auto monotonicityType = item->Value->Data();
+ switch (*monotonicityType)
+ {
+ case '0':
+ gridItem->Direction = m_resourceLoader->GetString(L"KGFMonotonicityUnknown");
+ break;
+ case '1':
+ gridItem->Direction = m_resourceLoader->GetString(L"KGFMonotonicityIncreasing");
+ break;
+ case '2':
+ gridItem->Direction = m_resourceLoader->GetString(L"KGFMonotonicityDecreasing");
+ break;
+ case '3':
+ gridItem->Direction = m_resourceLoader->GetString(L"KGFMonotonicityConstant");
+ break;
+ default:
+ gridItem->Direction = m_resourceLoader->GetString(L"KGFMonotonicityError");
+ break;
+ }
+
+ monotonicityItem->GridItems->Append(gridItem);
+ }
+ monotonicityItem->IsText = false;
+ }
+ else
+ {
+ monotonicityItem->DisplayItems->Append(m_resourceLoader->GetString(L"KGFMonotonicityError"));
+ monotonicityItem->IsText = true;
+ }
+
+ KeyGraphFeaturesItems->Append(monotonicityItem);
+ }
+
+ void EquationViewModel::SetTooComplexFeaturesErrorProperty()
+ {
+ if (TooComplexFeatures <= 0)
+ {
+ return;
+ }
+
+ Platform::String ^ separator = ref new String(LocalizationSettings::GetInstance().GetListSeparator().c_str());
+
+ wstring error;
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::Domain) == KeyGraphFeaturesFlag::Domain)
+ {
+ error.append((m_resourceLoader->GetString(L"Domain") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::Range) == KeyGraphFeaturesFlag::Range)
+ {
+ error.append((m_resourceLoader->GetString(L"Range") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::Zeros) == KeyGraphFeaturesFlag::Zeros)
+ {
+ error.append((m_resourceLoader->GetString(L"XIntercept") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::YIntercept) == KeyGraphFeaturesFlag::YIntercept)
+ {
+ error.append((m_resourceLoader->GetString(L"YIntercept") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::Parity) == KeyGraphFeaturesFlag::Parity)
+ {
+ error.append((m_resourceLoader->GetString(L"Parity") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::Periodicity) == KeyGraphFeaturesFlag::Periodicity)
+ {
+ error.append((m_resourceLoader->GetString(L"Periodicity") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::Minima) == KeyGraphFeaturesFlag::Minima)
+ {
+ error.append((m_resourceLoader->GetString(L"Minima") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::Maxima) == KeyGraphFeaturesFlag::Maxima)
+ {
+ error.append((m_resourceLoader->GetString(L"Maxima") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::InflectionPoints) == KeyGraphFeaturesFlag::InflectionPoints)
+ {
+ error.append((m_resourceLoader->GetString(L"InflectionPoints") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::VerticalAsymptotes) == KeyGraphFeaturesFlag::VerticalAsymptotes)
+ {
+ error.append((m_resourceLoader->GetString(L"VerticalAsymptotes") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::HorizontalAsymptotes) == KeyGraphFeaturesFlag::HorizontalAsymptotes)
+ {
+ error.append((m_resourceLoader->GetString(L"HorizontalAsymptotes") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::ObliqueAsymptotes) == KeyGraphFeaturesFlag::ObliqueAsymptotes)
+ {
+ error.append((m_resourceLoader->GetString(L"ObliqueAsymptotes") + separator + L" ")->Data());
+ }
+ if ((TooComplexFeatures & KeyGraphFeaturesFlag::MonotoneIntervals) == KeyGraphFeaturesFlag::MonotoneIntervals)
+ {
+ error.append((m_resourceLoader->GetString(L"Monotonicity") + separator + L" ")->Data());
+ }
+
+ KeyGraphFeaturesItem ^ tooComplexItem = ref new KeyGraphFeaturesItem();
+ tooComplexItem->DisplayItems->Append(m_resourceLoader->GetString(L"KGFTooComplexFeaturesError"));
+ tooComplexItem->DisplayItems->Append(ref new String(error.substr(0, (error.length() - (separator->Length() + 1))).c_str()));
+ tooComplexItem->IsText = true;
+
+ KeyGraphFeaturesItems->Append(tooComplexItem);
+ }
+
}
diff --git a/src/CalcViewModel/GraphingCalculator/EquationViewModel.h b/src/CalcViewModel/GraphingCalculator/EquationViewModel.h
index ce0d37e9..8f7a0db0 100644
--- a/src/CalcViewModel/GraphingCalculator/EquationViewModel.h
+++ b/src/CalcViewModel/GraphingCalculator/EquationViewModel.h
@@ -1,17 +1,96 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
#pragma once
#include "../Common/Utils.h"
namespace CalculatorApp::ViewModel
{
- public ref class EquationViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
+public
+ ref class GridDisplayItems sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
+ {
+ public:
+ GridDisplayItems();
+
+ OBSERVABLE_OBJECT();
+ OBSERVABLE_PROPERTY_RW(Platform::String ^, Expression);
+ OBSERVABLE_PROPERTY_RW(Platform::String ^, Direction);
+ };
+
+public
+ ref class KeyGraphFeaturesItem sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
+ {
+ public:
+ KeyGraphFeaturesItem();
+
+ OBSERVABLE_OBJECT();
+ OBSERVABLE_PROPERTY_RW(Platform::String ^, Title);
+ OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector ^, DisplayItems);
+ OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector ^, GridItems);
+ OBSERVABLE_PROPERTY_RW(bool, IsText);
+ };
+
+
+public
+ ref class EquationViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
{
public:
EquationViewModel();
- OBSERVABLE_OBJECT();
- OBSERVABLE_PROPERTY_RW(Platform::String^, Expression);
+ OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
+ OBSERVABLE_PROPERTY_RW(Platform::String ^, Expression);
OBSERVABLE_PROPERTY_RW(Windows::UI::Xaml::Media::SolidColorBrush ^, LineColor);
- OBSERVABLE_PROPERTY_RW(Windows::UI::Xaml::Visibility, KeyGraphFeaturesVisibility);
+
+ // Key Graph Features
+ OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(bool, IsAnalysisUpdated);
+ OBSERVABLE_PROPERTY_RW(Platform::String ^, Domain);
+ OBSERVABLE_PROPERTY_RW(Platform::String ^, Range);
+ OBSERVABLE_PROPERTY_RW(Platform::String ^, XIntercept);
+ OBSERVABLE_PROPERTY_RW(Platform::String ^, YIntercept);
+ OBSERVABLE_PROPERTY_RW(int, Parity);
+ OBSERVABLE_PROPERTY_RW(int, PeriodicityDirection);
+ OBSERVABLE_PROPERTY_RW(Platform::String ^, PeriodicityExpression);
+ OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector ^, Minima);
+ OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector ^, Maxima);
+ OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector ^, InflectionPoints);
+ OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector ^, VerticalAsymptotes);
+ OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector ^, HorizontalAsymptotes);
+ OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector ^, ObliqueAsymptotes);
+ OBSERVABLE_PROPERTY_RW(int, TooComplexFeatures);
+ OBSERVABLE_PROPERTY_RW(int, AnalysisError);
+ OBSERVABLE_PROPERTY_R(Platform::String ^, AnalysisErrorString);
+ OBSERVABLE_PROPERTY_R(bool, AnalysisErrorVisible);
+ OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector ^, KeyGraphFeaturesItems)
+
+ property Windows::Foundation::Collections::IObservableMap ^ Monotonicity
+ {
+ Windows::Foundation::Collections::IObservableMap ^ get()
+ {
+ return m_Monotonicity;
+ }
+ void set(Windows::Foundation::Collections::IObservableMap ^ value)
+ {
+ if (m_Monotonicity != value)
+ {
+ m_Monotonicity = value;
+ }
+ }
+ }
+
+ private:
+ void OnPropertyChanged(Platform::String ^ propertyName);
+ void SetParityStringProperty();
+ void SetPeriodicityStringProperty();
+ void SetKeyGraphFeaturesItems(Platform::String ^ title, Platform::String ^ expression, Platform::String ^ errorString);
+ void SetKeyGraphFeaturesItems(Platform::String ^ title, Windows::Foundation::Collections::IObservableVector ^ expressionVector,
+ Platform::String ^ errorString);
+ void SetMonotoncityStringProperty();
+ void SetTooComplexFeaturesErrorProperty();
+ void OnIsAnalysisUpdatedChanged();
+
+ Windows::Foundation::Collections::IObservableMap ^ m_Monotonicity;
+ Windows::ApplicationModel::Resources::ResourceLoader ^ m_resourceLoader;
};
+
}
diff --git a/src/CalcViewModel/GraphingCalculator/GraphingCalculatorViewModel.cpp b/src/CalcViewModel/GraphingCalculator/GraphingCalculatorViewModel.cpp
index 984678a2..07b6fc13 100644
--- a/src/CalcViewModel/GraphingCalculator/GraphingCalculatorViewModel.cpp
+++ b/src/CalcViewModel/GraphingCalculator/GraphingCalculatorViewModel.cpp
@@ -1,3 +1,6 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
#include "pch.h"
#include "GraphingCalculatorViewModel.h"
diff --git a/src/CalcViewModel/GraphingCalculator/GraphingCalculatorViewModel.h b/src/CalcViewModel/GraphingCalculator/GraphingCalculatorViewModel.h
index 2c45f077..18a60543 100644
--- a/src/CalcViewModel/GraphingCalculator/GraphingCalculatorViewModel.h
+++ b/src/CalcViewModel/GraphingCalculator/GraphingCalculatorViewModel.h
@@ -1,3 +1,6 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
#pragma once
#include "../Common/Utils.h"
@@ -5,28 +8,29 @@
namespace CalculatorApp::ViewModel
{
- public value struct VariableChangedEventArgs sealed
+public
+ value struct VariableChangedEventArgs sealed
{
- Platform::String^ variableName;
+ Platform::String ^ variableName;
double newValue;
};
- [Windows::UI::Xaml::Data::Bindable]
- public ref class VariableViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
+ [Windows::UI::Xaml::Data::Bindable] public ref class VariableViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
{
public:
- VariableViewModel(Platform::String^ name, double value) :
- m_Name(name),
- m_Value(value),
- m_SliderSettingsVisible(false),
- m_Min(0.0),
- m_Step(0.1),
- m_Max(2.0)
- { }
+ VariableViewModel(Platform::String ^ name, double value)
+ : m_Name(name)
+ , m_Value(value)
+ , m_SliderSettingsVisible(false)
+ , m_Min(0.0)
+ , m_Step(0.1)
+ , m_Max(2.0)
+ {
+ }
OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
- OBSERVABLE_PROPERTY_R(Platform::String^, Name);
+ OBSERVABLE_PROPERTY_R(Platform::String ^, Name);
// TODO: Consider removing this work around and manually set the textbox text.
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(double, Value);
@@ -35,7 +39,7 @@ namespace CalculatorApp::ViewModel
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(double, Max);
OBSERVABLE_PROPERTY_RW(bool, SliderSettingsVisible);
- event Windows::Foundation::EventHandler^ VariableUpdated;
+ event Windows::Foundation::EventHandler ^ VariableUpdated;
void SetValue(double value)
{
@@ -52,7 +56,7 @@ namespace CalculatorApp::ViewModel
}
private:
- void OnPropertyChanged(Platform::String^ propertyName)
+ void OnPropertyChanged(Platform::String ^ propertyName)
{
if (propertyName == "Value")
{
@@ -61,23 +65,23 @@ namespace CalculatorApp::ViewModel
}
};
- [Windows::UI::Xaml::Data::Bindable]
- public ref class GraphingCalculatorViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
+ [Windows::UI::Xaml::Data::Bindable] public ref class GraphingCalculatorViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
{
public:
GraphingCalculatorViewModel();
OBSERVABLE_OBJECT();
OBSERVABLE_PROPERTY_R(bool, IsDecimalEnabled);
- OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector< EquationViewModel^ >^, Equations);
- OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector< VariableViewModel^ >^, Variables);
+ OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector ^, Equations);
+ OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector ^, Variables);
COMMAND_FOR_METHOD(ButtonPressed, GraphingCalculatorViewModel::OnButtonPressed);
- event Windows::Foundation::EventHandler^ VariableUpdated;
+ event Windows::Foundation::EventHandler ^ VariableUpdated;
+
+ void UpdateVariables(Windows::Foundation::Collections::IMap ^ variables);
- void UpdateVariables(Windows::Foundation::Collections::IMap^ variables);
private:
- void OnButtonPressed(Platform::Object^ parameter);
+ void OnButtonPressed(Platform::Object ^ parameter);
};
}
diff --git a/src/CalcViewModel/GraphingCalculatorEnums.h b/src/CalcViewModel/GraphingCalculatorEnums.h
new file mode 100644
index 00000000..5cf136a5
--- /dev/null
+++ b/src/CalcViewModel/GraphingCalculatorEnums.h
@@ -0,0 +1,28 @@
+#pragma once
+
+namespace CalculatorApp
+{
+ enum KeyGraphFeaturesFlag
+ {
+ Domain = 1,
+ Range = 2,
+ Parity = 4,
+ Periodicity = 8,
+ Zeros = 16,
+ YIntercept = 32,
+ Minima = 64,
+ Maxima = 128,
+ InflectionPoints = 256,
+ VerticalAsymptotes = 512,
+ HorizontalAsymptotes = 1024,
+ ObliqueAsymptotes = 2048,
+ MonotoneIntervals = 4096
+ };
+
+ enum AnalysisErrorType
+ {
+ NoError,
+ AnalysisCouldNotBePerformed,
+ AnalysisNotSupported
+ };
+}
diff --git a/src/Calculator/App.xaml b/src/Calculator/App.xaml
index 25e5bbfb..5f0219b2 100644
--- a/src/Calculator/App.xaml
+++ b/src/Calculator/App.xaml
@@ -1140,6 +1140,244 @@
+
+
+
+
-
-
-
@@ -1479,7 +1477,6 @@
-
@@ -1521,19 +1518,19 @@
-
+
-
-
diff --git a/src/Calculator/Calculator.vcxproj b/src/Calculator/Calculator.vcxproj
index 9142e475..e63cd492 100644
--- a/src/Calculator/Calculator.vcxproj
+++ b/src/Calculator/Calculator.vcxproj
@@ -8,8 +8,8 @@
15.0
true
Windows Store
- 10.0.18970.0
- 10.0.18362.0
+ 10.0.19019.0
+ 10.0.17134.0
false
false
@@ -234,6 +234,7 @@
+
@@ -258,6 +259,7 @@
EquationStylePanelControl.xaml
+
Views\Calculator.xaml
@@ -288,6 +290,9 @@
Views\GraphingCalculator\GraphingCalculator.xaml
+
+ Views\GraphingCalculator\KeyGraphFeaturesPanel.xaml
+
Views\HistoryList.xaml
@@ -348,6 +353,7 @@
+
@@ -379,6 +385,7 @@
+
@@ -408,6 +415,7 @@
EquationStylePanelControl.xaml
+
Views\Calculator.xaml
@@ -438,6 +446,9 @@
Views\GraphingCalculator\GraphingCalculator.xaml
+
+ Views\GraphingCalculator\KeyGraphFeaturesPanel.xaml
+
Views\HistoryList.xaml
@@ -850,4 +861,4 @@
-
\ No newline at end of file
+
diff --git a/src/Calculator/Calculator.vcxproj.filters b/src/Calculator/Calculator.vcxproj.filters
index 085b2000..6f8b28c4 100644
--- a/src/Calculator/Calculator.vcxproj.filters
+++ b/src/Calculator/Calculator.vcxproj.filters
@@ -307,6 +307,9 @@
Controls
+
+
+
@@ -393,6 +396,9 @@
Controls
+
+
+
@@ -470,6 +476,7 @@
Views\GraphingCalculator
+
diff --git a/src/Calculator/Controls/EquationTextBox.cpp b/src/Calculator/Controls/EquationTextBox.cpp
index df3d0c56..2fc9a7be 100644
--- a/src/Calculator/Controls/EquationTextBox.cpp
+++ b/src/Calculator/Controls/EquationTextBox.cpp
@@ -20,13 +20,12 @@ using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Controls::Primitives;
DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, EquationColor);
-DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, KeyGraphFeaturesContent);
DEPENDENCY_PROPERTY_INITIALIZATION(EquationTextBox, ColorChooserFlyout);
void EquationTextBox::OnApplyTemplate()
{
m_equationButton = dynamic_cast
\ No newline at end of file
diff --git a/src/MockGraphingImpl/Mocks/MathSolver.h b/src/MockGraphingImpl/Mocks/MathSolver.h
index 495fa316..7394c341 100644
--- a/src/MockGraphingImpl/Mocks/MathSolver.h
+++ b/src/MockGraphingImpl/Mocks/MathSolver.h
@@ -11,7 +11,8 @@ namespace MockGraphingImpl
{
public:
void SetFormatType(Graphing::FormatType type) override
- { }
+ {
+ }
};
class EvalOptions : public Graphing::IEvalOptions
@@ -22,7 +23,12 @@ namespace MockGraphingImpl
{
public:
void SetFormatType(Graphing::FormatType type) override
- { }
+ {
+ }
+
+ void SetMathMLPrefix(const std::wstring& value) override
+ {
+ }
};
class MathSolver : public Graphing::IMathSolver
@@ -63,6 +69,11 @@ namespace MockGraphingImpl
return std::wstring{};
}
+ Graphing::IGraphFunctionAnalysisData IMathSolver::Analyze(const Graphing::Analyzer::IGraphAnalyzer* analyzer)
+ {
+ return Graphing::IGraphFunctionAnalysisData{};
+ }
+
private:
MockGraphingImpl::ParsingOptions m_parsingOptions;
MockGraphingImpl::EvalOptions m_evalOptions;