Improved error handing for function analysis for functions in the f(y) format (#1338)
* Updated the CanFunctionAnalysisBePerformed api to use the updated one with variableIsNotX error handling. Updated the UI to reflect the new descriptive error case to show an informative error. * Fixed spacing and updated the moved the variableIsNotX check up into the parent if statement * Update the internals version to match the version needed to support this change
This commit is contained in:
parent
bc473617ae
commit
a0f98ca76b
@ -29,7 +29,7 @@ jobs:
|
|||||||
downloadDirectory: $(Build.SourcesDirectory)
|
downloadDirectory: $(Build.SourcesDirectory)
|
||||||
vstsFeed: WindowsInboxApps
|
vstsFeed: WindowsInboxApps
|
||||||
vstsFeedPackage: calculator-internals
|
vstsFeedPackage: calculator-internals
|
||||||
vstsPackageVersion: 0.0.49
|
vstsPackageVersion: 0.0.50
|
||||||
|
|
||||||
- template: ./build-single-architecture.yaml
|
- template: ./build-single-architecture.yaml
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -80,7 +80,7 @@ jobs:
|
|||||||
downloadDirectory: $(Build.SourcesDirectory)
|
downloadDirectory: $(Build.SourcesDirectory)
|
||||||
vstsFeed: WindowsInboxApps
|
vstsFeed: WindowsInboxApps
|
||||||
vstsFeedPackage: calculator-internals
|
vstsFeedPackage: calculator-internals
|
||||||
vstsPackageVersion: 0.0.49
|
vstsPackageVersion: 0.0.50
|
||||||
|
|
||||||
- powershell: |
|
- powershell: |
|
||||||
# Just modify this line to indicate where your en-us PDP file is. Leave the other lines alone.
|
# Just modify this line to indicate where your en-us PDP file is. Leave the other lines alone.
|
||||||
|
@ -63,6 +63,10 @@ namespace CalculatorApp::ViewModel
|
|||||||
{
|
{
|
||||||
AnalysisErrorString = m_resourceLoader->GetString(L"KGFAnalysisNotSupported");
|
AnalysisErrorString = m_resourceLoader->GetString(L"KGFAnalysisNotSupported");
|
||||||
}
|
}
|
||||||
|
else if (graphEquation->AnalysisError == static_cast<int>(AnalysisErrorType::VariableIsNotX))
|
||||||
|
{
|
||||||
|
AnalysisErrorString = m_resourceLoader->GetString(L"KGFVariableIsNotX");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ namespace CalculatorApp
|
|||||||
{
|
{
|
||||||
NoError,
|
NoError,
|
||||||
AnalysisCouldNotBePerformed,
|
AnalysisCouldNotBePerformed,
|
||||||
AnalysisNotSupported
|
AnalysisNotSupported,
|
||||||
|
VariableIsNotX
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4019,6 +4019,10 @@
|
|||||||
<value>Analysis is not supported for this function.</value>
|
<value>Analysis is not supported for this function.</value>
|
||||||
<comment>Error displayed when graph analysis is not supported or had an error.</comment>
|
<comment>Error displayed when graph analysis is not supported or had an error.</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="KGFVariableIsNotX" xml:space="preserve">
|
||||||
|
<value>Analysis is only supported for functions in the f(x) format. Example: y=x</value>
|
||||||
|
<comment>Error displayed when graph analysis detects the function format is not f(x).</comment>
|
||||||
|
</data>
|
||||||
<data name="Maxima" xml:space="preserve">
|
<data name="Maxima" xml:space="preserve">
|
||||||
<value>Maxima</value>
|
<value>Maxima</value>
|
||||||
<comment>Title for KeyGraphFeatures Maxima Property</comment>
|
<comment>Title for KeyGraphFeatures Maxima Property</comment>
|
||||||
|
@ -254,8 +254,8 @@ namespace GraphControl
|
|||||||
vector<Equation ^> equationVector;
|
vector<Equation ^> equationVector;
|
||||||
equationVector.push_back(equation);
|
equationVector.push_back(equation);
|
||||||
UpdateGraphOptions(graph->GetOptions(), equationVector);
|
UpdateGraphOptions(graph->GetOptions(), equationVector);
|
||||||
|
bool variableIsNotX;
|
||||||
if (analyzer->CanFunctionAnalysisBePerformed())
|
if (analyzer->CanFunctionAnalysisBePerformed(variableIsNotX) && !variableIsNotX)
|
||||||
{
|
{
|
||||||
if (S_OK
|
if (S_OK
|
||||||
== analyzer->PerformFunctionAnalysis(
|
== analyzer->PerformFunctionAnalysis(
|
||||||
@ -265,6 +265,10 @@ namespace GraphControl
|
|||||||
return KeyGraphFeaturesInfo::Create(functionAnalysisData);
|
return KeyGraphFeaturesInfo::Create(functionAnalysisData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (variableIsNotX)
|
||||||
|
{
|
||||||
|
return KeyGraphFeaturesInfo::Create(CalculatorApp::AnalysisErrorType::VariableIsNotX);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return KeyGraphFeaturesInfo::Create(CalculatorApp::AnalysisErrorType::AnalysisNotSupported);
|
return KeyGraphFeaturesInfo::Create(CalculatorApp::AnalysisErrorType::AnalysisNotSupported);
|
||||||
|
@ -15,10 +15,10 @@ namespace Graphing::Analyzer
|
|||||||
|
|
||||||
struct IGraphAnalyzer : public NonCopyable, public NonMoveable
|
struct IGraphAnalyzer : public NonCopyable, public NonMoveable
|
||||||
{
|
{
|
||||||
virtual ~IGraphAnalyzer() = default;
|
virtual ~IGraphAnalyzer() = default;
|
||||||
virtual bool CanFunctionAnalysisBePerformed() = 0;
|
virtual bool CanFunctionAnalysisBePerformed(bool& variableIsNotX) = 0;
|
||||||
virtual HRESULT PerformFunctionAnalysis(NativeAnalysisType analysisType) = 0;
|
virtual HRESULT PerformFunctionAnalysis(NativeAnalysisType analysisType) = 0;
|
||||||
virtual HRESULT GetAnalysisTypeCaption(const AnalysisType type, std::wstring& captionOut) const = 0;
|
virtual HRESULT GetAnalysisTypeCaption(const AnalysisType type, std::wstring& captionOut) const = 0;
|
||||||
virtual HRESULT GetMessage(const GraphAnalyzerMessage msg, std::wstring& msgOut) const = 0;
|
virtual HRESULT GetMessage(const GraphAnalyzerMessage msg, std::wstring& msgOut) const = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user