Allow rendering the graph on a background thread (#1014)

* Render on background thread

* More work

* variable fix

* Add comments
This commit is contained in:
Pepe Rivera
2020-02-04 15:02:42 -08:00
committed by GitHub
parent f4ab94ce1c
commit f1482252ef
9 changed files with 120 additions and 50 deletions

View File

@@ -319,26 +319,6 @@ void EquationTextBox::OnHasErrorPropertyChanged(bool, bool)
UpdateCommonVisualState();
}
Platform::String ^ EquationTextBox::GetEquationText()
{
String ^ text;
if (m_richEditBox != nullptr)
{
// Clear formatting since the graph control doesn't work with bold/underlines
ITextRange ^ range = m_richEditBox->TextDocument->GetRange(0, m_richEditBox->TextDocument->Selection->EndPosition);
if (range != nullptr)
{
range->CharacterFormat->Bold = FormatEffect::Off;
range->CharacterFormat->Underline = UnderlineType::None;
}
text = m_richEditBox->MathText;
}
return text;
}
void EquationTextBox::SetEquationText(Platform::String ^ equationText)
{
if (m_richEditBox != nullptr)

View File

@@ -33,7 +33,6 @@ namespace CalculatorApp
event Windows::Foundation::EventHandler<MathRichEditBoxFormatRequest ^> ^ EquationFormatRequested;
event Windows::UI::Xaml::RoutedEventHandler ^ EquationButtonClicked;
Platform::String ^ GetEquationText();
void SetEquationText(Platform::String ^ equationText);
void FocusTextBox();

View File

@@ -12,6 +12,7 @@ using namespace std;
using namespace Windows::ApplicationModel;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Text;
using namespace Windows::Foundation::Collections;
using namespace Windows::System;
@@ -178,6 +179,15 @@ void MathRichEditBox::BackSpace()
void MathRichEditBox::SubmitEquation(EquationSubmissionSource source)
{
// Clear formatting since the graph control doesn't work with bold/underlines
auto range = this->TextDocument->GetRange(0, this->TextDocument->Selection->EndPosition);
if (range != nullptr)
{
range->CharacterFormat->Bold = FormatEffect::Off;
range->CharacterFormat->Underline = UnderlineType::None;
}
auto newVal = GetMathTextProperty();
if (MathText != newVal)
{

View File

@@ -330,9 +330,6 @@ void EquationInputArea::SubmitTextbox(TextBox ^ sender)
{
val = validateDouble(sender->Text, variableViewModel->Value);
variableViewModel->Value = val;
// Assign back to val in case it gets changed due to min/max
val = variableViewModel->Value;
}
else if (sender->Name == "MinTextBox")
{