Fixed crash when in high contrast (#1159)
* Fixed line colors out of bounds issue when switching to high contrast * Update the fix to not reload the colors OnColorChanged when in HighContrast
This commit is contained in:
parent
15b957c98b
commit
1ded2c57db
@ -48,6 +48,7 @@ EquationInputArea::EquationInputArea()
|
||||
{
|
||||
m_accessibilitySettings->HighContrastChanged +=
|
||||
ref new TypedEventHandler<AccessibilitySettings ^, Object ^>(this, &EquationInputArea::OnHighContrastChanged);
|
||||
m_isHighContrast = m_accessibilitySettings->HighContrast;
|
||||
|
||||
m_uiSettings = ref new UISettings();
|
||||
m_uiSettings->ColorValuesChanged += ref new TypedEventHandler<UISettings ^, Object ^>(this, &EquationInputArea::OnColorValuesChanged);
|
||||
@ -309,6 +310,7 @@ void EquationInputArea::FocusEquationIfNecessary(CalculatorApp::Controls::Equati
|
||||
void EquationInputArea::OnHighContrastChanged(AccessibilitySettings ^ sender, Object ^ args)
|
||||
{
|
||||
ReloadAvailableColors(sender->HighContrast, true);
|
||||
m_isHighContrast = sender->HighContrast;
|
||||
}
|
||||
|
||||
void EquationInputArea::OnColorValuesChanged(Windows::UI::ViewManagement::UISettings ^ sender, Platform::Object ^ args)
|
||||
@ -316,9 +318,9 @@ void EquationInputArea::OnColorValuesChanged(Windows::UI::ViewManagement::UISett
|
||||
WeakReference weakThis(this);
|
||||
this->Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([weakThis]() {
|
||||
auto refThis = weakThis.Resolve<EquationInputArea>();
|
||||
if (refThis != nullptr)
|
||||
if (refThis != nullptr && refThis->m_isHighContrast == refThis->m_accessibilitySettings->HighContrast)
|
||||
{
|
||||
refThis->ReloadAvailableColors(refThis->m_accessibilitySettings->HighContrast, false);
|
||||
refThis->ReloadAvailableColors(false, false);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ public
|
||||
Windows::UI::ViewManagement::UISettings ^ m_uiSettings;
|
||||
int m_lastLineColorIndex;
|
||||
int m_lastFunctionLabelIndex;
|
||||
bool m_isHighContrast;
|
||||
ViewModel::EquationViewModel ^ m_equationToFocus;
|
||||
Platform::Collections::Map<Platform::String ^, CalculatorApp::DispatcherTimerDelayer ^> ^ variableSliders;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user