Key graph features (#704)

* Added IGraphAnalyzer

* Key Graph Features called and getting returned to the client. To do put all strings into the Equation object

* Updated UpdateKeyGraphFeatures to add function analysis data to all properties in Equation object

* Update KGF when variables are updated

* Key graph features ui started

* Added MathRichEditBox and started hooking up key graph features to the UI

* Updated EquationViewModel to include parity and periodicity

* Updated key graph features to update the EquationViewModel

* updated key graph features to display more values

* Key graph features populating uing MathRichEdit mode

* moved KeyGraphFeatures control to GraphingCalculator.xaml

* Use MathML formatting instead of MathRichEdit for strings passed back from the engine

* cleaned up project targeting and equation.h comments

* Updated equation edit box to populate for KeyGraphFeatures

* Fixed vcxproj files to have the correct targeting and certificates. KGF Title strings moved to x:Uid instead of the code behind

* Updated per PR feedback

* Update MathRichEditBox to detect if the string is a mathml string and use the appropriate set method to set the text

* fixed the issue where parity, periodicity and monotonicity could be set with an old value if the next one is empty

* KGF control UI adjustments and error handling

* Error control updates

* Error handling added when analysis fails

* fixed alignment on rich edit boxes

* Add monotonicity direction into the mathml string and only have 1 richeditbox

* Set hover state on KGF EquationEditBox to change button opacity and fixed spacing in Monotonicity RichEditBox

* remove sideload package certificate info VS added

* updated logic for setting error strings to be in the viewmodel

* Updated KeyGraphFeatures to populate dynamically using a ListView and TemplateSelector

* Update periodicity to not show if it isn't supported

* Fixed issue where y-intercept was using the x-intercept value

* Remove ItemsControl ItemsContainerStyle

* Updated per pr feedback. Fixed bug where analysis error would not reset

* Update MathRichEdit box to remove selection when focus is lost

* Updated mathrichedit to get LAF access for Dev, Release and Graphing projects

* Remove OnLostFocus in MathRichEdit, Change KGF ItemsControl back to ListView

* Clean up styles for KGF and ensure the match the comps

* Moved formatoptions logic to the Grapher constructor and reverted LineColor.Text resource that was mistakenly taken out

* Add copyright header to KGF Files

* fixed issue where asymptote values were not populating

* Disable KGF button when there is no equation. Fixed issue where equation populated in a new equationtextbox after the previous one was deleted

* Removed formatoptions testing lines used for debugging
This commit is contained in:
Stephanie Anderl
2019-11-12 13:46:11 -08:00
committed by GitHub
parent 626bdf0de5
commit 442ed6a861
48 changed files with 2931 additions and 476 deletions

View File

@@ -42,7 +42,7 @@
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.18970.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.19019.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
@@ -351,6 +351,7 @@
<ClInclude Include="DataLoaders\UnitConverterDataConstants.h" />
<ClInclude Include="DataLoaders\UnitConverterDataLoader.h" />
<ClInclude Include="DateCalculatorViewModel.h" />
<ClInclude Include="GraphingCalculatorEnums.h" />
<ClInclude Include="GraphingCalculator\EquationViewModel.h" />
<ClInclude Include="GraphingCalculator\GraphingCalculatorViewModel.h" />
<ClInclude Include="HistoryItemViewModel.h" />

View File

@@ -220,6 +220,9 @@
<ClInclude Include="DataLoaders\CurrencyDataLoader.h">
<Filter>DataLoaders</Filter>
</ClInclude>
<ClInclude Include="GraphingCalculatorEnums.h">
<Filter>Common</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View File

@@ -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<String ^>() }
, m_GridItems{ ref new Vector<GridDisplayItems ^>() }
, 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<String ^>() }
, m_Maxima{ ref new Vector<String ^>() }
, m_InflectionPoints{ ref new Vector<String ^>() }
, m_Monotonicity{ ref new Map<String ^, String ^>() }
, m_VerticalAsymptotes{ ref new Vector<String ^>() }
, m_HorizontalAsymptotes{ ref new Vector<String ^>() }
, m_ObliqueAsymptotes{ ref new Vector<String ^>() }
, m_TooComplexFeatures{ -1 }
, m_AnalysisError{ 0 }
, m_AnalysisErrorVisible{ false }
, m_KeyGraphFeaturesItems{ ref new Vector<KeyGraphFeaturesItem ^>() }
, 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<int>(AnalysisErrorType::AnalysisCouldNotBePerformed))
{
AnalysisErrorString = m_resourceLoader->GetString(L"KGFAnalysisCouldNotBePerformed");
}
else if (AnalysisError == static_cast<int>(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<String ^> ^ 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);
}
}

View File

@@ -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<Platform::String ^> ^, DisplayItems);
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector<GridDisplayItems ^> ^, 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<Platform::String ^> ^, Minima);
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector<Platform::String ^> ^, Maxima);
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector<Platform::String ^> ^, InflectionPoints);
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector<Platform::String ^> ^, VerticalAsymptotes);
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector<Platform::String ^> ^, HorizontalAsymptotes);
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector<Platform::String ^> ^, 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<CalculatorApp::ViewModel::KeyGraphFeaturesItem ^> ^, KeyGraphFeaturesItems)
property Windows::Foundation::Collections::IObservableMap<Platform::String ^, Platform::String^> ^ Monotonicity
{
Windows::Foundation::Collections::IObservableMap<Platform::String ^, Platform::String^> ^ get()
{
return m_Monotonicity;
}
void set(Windows::Foundation::Collections::IObservableMap<Platform::String ^, Platform::String^> ^ 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<Platform::String ^> ^ expressionVector,
Platform::String ^ errorString);
void SetMonotoncityStringProperty();
void SetTooComplexFeaturesErrorProperty();
void OnIsAnalysisUpdatedChanged();
Windows::Foundation::Collections::IObservableMap<Platform::String ^, Platform::String ^> ^ m_Monotonicity;
Windows::ApplicationModel::Resources::ResourceLoader ^ m_resourceLoader;
};
}

View File

@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "pch.h"
#include "GraphingCalculatorViewModel.h"

View File

@@ -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<VariableChangedEventArgs>^ VariableUpdated;
event Windows::Foundation::EventHandler<VariableChangedEventArgs> ^ 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<EquationViewModel ^> ^, Equations);
OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector<VariableViewModel ^> ^, Variables);
COMMAND_FOR_METHOD(ButtonPressed, GraphingCalculatorViewModel::OnButtonPressed);
event Windows::Foundation::EventHandler<VariableChangedEventArgs>^ VariableUpdated;
event Windows::Foundation::EventHandler<VariableChangedEventArgs> ^ VariableUpdated;
void UpdateVariables(Windows::Foundation::Collections::IMap<Platform::String ^, double> ^ variables);
void UpdateVariables(Windows::Foundation::Collections::IMap<Platform::String^, double>^ variables);
private:
void OnButtonPressed(Platform::Object^ parameter);
void OnButtonPressed(Platform::Object ^ parameter);
};
}

View File

@@ -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
};
}