From 9fb61490efb8a0355d9a02315b52c1d868b7bd0d Mon Sep 17 00:00:00 2001 From: Stephanie Anderl <46726333+sanderl@users.noreply.github.com> Date: Thu, 14 Mar 2019 11:10:18 -0700 Subject: [PATCH] Updated changes per code review feedback --- src/CalcManager/CalculatorManager.cpp | 1 - src/CalcViewModel/StandardCalculatorViewModel.cpp | 6 +++--- src/CalcViewModel/StandardCalculatorViewModel.h | 2 +- src/Calculator/Resources/en-US/Resources.resw | 4 ++-- .../Views/CalculatorProgrammerRadixOperators.xaml.cpp | 9 +++++---- .../Views/CalculatorProgrammerRadixOperators.xaml.h | 3 ++- .../Views/CalculatorScientificOperators.xaml.cpp | 6 +++--- .../Views/CalculatorScientificOperators.xaml.h | 2 +- 8 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/CalcManager/CalculatorManager.cpp b/src/CalcManager/CalculatorManager.cpp index 25cef8b2..946d4676 100644 --- a/src/CalcManager/CalculatorManager.cpp +++ b/src/CalcManager/CalculatorManager.cpp @@ -118,7 +118,6 @@ namespace CalculationManager /// /// Callback from the engine - /// Used to set the narrator text when no parenthesis can be added /// void CalculatorManager::OnNoRightParenAdded() { diff --git a/src/CalcViewModel/StandardCalculatorViewModel.cpp b/src/CalcViewModel/StandardCalculatorViewModel.cpp index 08b3f9d1..e97ffbef 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.cpp +++ b/src/CalcViewModel/StandardCalculatorViewModel.cpp @@ -55,7 +55,7 @@ namespace CalculatorApp::ViewModel StringReference BinButton(L"Format_BinButtonValue"); StringReference LeftParenthesisAutomationFormat(L"Format_OpenParenthesisAutomationNamePrefix"); StringReference OpenParenthesisCountAutomationFormat(L"Format_OpenParenthesisCountAutomationNamePrefix"); - StringReference NoParenthesisAdded(L"NoParenthesisAdded_Announcement"); + StringReference NoParenthesisAdded(L"NoRightParenthesisAdded_Announcement"); StringReference MaxDigitsReachedFormat(L"Format_MaxDigitsReached"); StringReference ButtonPressFeedbackFormat(L"Format_ButtonPressAuditoryFeedback"); StringReference MemorySave(L"Format_MemorySave"); @@ -97,7 +97,7 @@ StandardCalculatorViewModel::StandardCalculatorViewModel() : m_localizedMemoryItemClearedAutomationFormat(nullptr), m_localizedMemoryCleared(nullptr), m_localizedOpenParenthesisCountChangedAutomationFormat(nullptr), - m_localizedNoRightParenthesisAddedAutomationFormat(nullptr) + m_localizedNoRightParenthesisAddedFormat(nullptr) { WeakReference calculatorViewModel(this); m_calculatorDisplay.SetCallback(calculatorViewModel); @@ -254,7 +254,7 @@ void StandardCalculatorViewModel::SetNoParenAddedNarratorAnnouncement() { String^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement( CalculatorResourceKeys::NoParenthesisAdded, - m_localizedNoRightParenthesisAddedAutomationFormat); + m_localizedNoRightParenthesisAddedFormat); Announcement = CalculatorAnnouncement::GetNoRightParenthesisAddedAnnouncement(announcement); } diff --git a/src/CalcViewModel/StandardCalculatorViewModel.h b/src/CalcViewModel/StandardCalculatorViewModel.h index 576cee66..494cd5e0 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.h +++ b/src/CalcViewModel/StandardCalculatorViewModel.h @@ -342,7 +342,7 @@ namespace CalculatorApp Platform::String^ m_localizedMemoryItemClearedAutomationFormat; Platform::String^ m_localizedMemoryCleared; Platform::String^ m_localizedOpenParenthesisCountChangedAutomationFormat; - Platform::String^ m_localizedNoRightParenthesisAddedAutomationFormat; + Platform::String^ m_localizedNoRightParenthesisAddedFormat; bool m_pinned; bool m_isOperandEnabled; diff --git a/src/Calculator/Resources/en-US/Resources.resw b/src/Calculator/Resources/en-US/Resources.resw index 4ee3d418..3e9539b0 100644 --- a/src/Calculator/Resources/en-US/Resources.resw +++ b/src/Calculator/Resources/en-US/Resources.resw @@ -1313,7 +1313,7 @@ Left parenthesis Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + Left parenthesis, open parenthesis count %1 {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". @@ -1325,7 +1325,7 @@ Open parenthesis count %1 {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific and programmer operator keypad. %1 is the localized count of open parenthesis, e.g. "2". - + There are no open parentheses to close. {Locked="%1"} Screen reader prompt for the Calculator when the ")" button on the scientific and programmer operator keypad cannot be added to the equation. e.g. "1+)". diff --git a/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.cpp b/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.cpp index 380a798f..85215dda 100644 --- a/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.cpp +++ b/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.cpp @@ -34,11 +34,12 @@ CalculatorProgrammerRadixOperators::CalculatorProgrammerRadixOperators() : void CalculatorProgrammerRadixOperators::OnLoaded(Object^, RoutedEventArgs^) { - Model->ProgModeRadixChange += ref new ProgModeRadixChangeHandler(this, &CalculatorProgrammerRadixOperators::ProgModeRadixChange); - m_propertyChangedToken = Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &CalculatorProgrammerRadixOperators::OnPropertyChanged); + m_progModeRadixChangeToken = Model->ProgModeRadixChange += ref new ProgModeRadixChangeHandler(this, &CalculatorProgrammerRadixOperators::ProgModeRadixChange); + m_propertyChangedToken = Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &CalculatorProgrammerRadixOperators::OnViewModelPropertyChanged); } void CalculatorProgrammerRadixOperators::OnUnloaded(Object^, RoutedEventArgs^) { + Model->ProgModeRadixChange -= m_progModeRadixChangeToken; Model->PropertyChanged -= m_propertyChangedToken; } @@ -99,9 +100,9 @@ void CalculatorProgrammerRadixOperators::IsErrorVisualState::set(bool value) } } -void CalculatorProgrammerRadixOperators::OnPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e) +void CalculatorProgrammerRadixOperators::OnViewModelPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e) { - if (e->PropertyName == CalculatorViewModelProperties::OpenParenthesisCount && closeParenthesisButton->FocusState != Windows::UI::Xaml::FocusState::Unfocused) + if (e->PropertyName == CalculatorViewModelProperties::OpenParenthesisCount && closeParenthesisButton->FocusState != ::FocusState::Unfocused) { Model->SetOpenParenthesisCountNarratorAnnouncement(); } diff --git a/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.h b/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.h index 7fa64d31..7dd819d0 100644 --- a/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.h +++ b/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.h @@ -35,9 +35,10 @@ namespace CalculatorApp void OnLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void OnUnloaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void ProgModeRadixChange(); - void OnPropertyChanged(Platform::Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e); + void OnViewModelPropertyChanged(Platform::Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e); bool m_isErrorVisualState; + Windows::Foundation::EventRegistrationToken m_progModeRadixChangeToken; Windows::Foundation::EventRegistrationToken m_propertyChangedToken; }; } diff --git a/src/Calculator/Views/CalculatorScientificOperators.xaml.cpp b/src/Calculator/Views/CalculatorScientificOperators.xaml.cpp index 470e8512..fa7832fe 100644 --- a/src/Calculator/Views/CalculatorScientificOperators.xaml.cpp +++ b/src/Calculator/Views/CalculatorScientificOperators.xaml.cpp @@ -40,7 +40,7 @@ CalculatorScientificOperators::CalculatorScientificOperators() void CalculatorScientificOperators::OnLoaded(Object^, RoutedEventArgs^) { - m_propertyChangedToken = Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &CalculatorScientificOperators::OnPropertyChanged); + m_propertyChangedToken = Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &CalculatorScientificOperators::OnViewModelPropertyChanged); } void CalculatorScientificOperators::OnUnloaded(Object^, RoutedEventArgs^) { @@ -107,9 +107,9 @@ void CalculatorScientificOperators::SetOperatorRowVisibility() InvRow2->Visibility = invRowVis; } -void CalculatorScientificOperators::OnPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e) +void CalculatorScientificOperators::OnViewModelPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e) { - if (e->PropertyName == CalculatorViewModelProperties::OpenParenthesisCount && closeParenthesisButton->FocusState != Windows::UI::Xaml::FocusState::Unfocused) + if (e->PropertyName == CalculatorViewModelProperties::OpenParenthesisCount && closeParenthesisButton->FocusState != ::FocusState::Unfocused) { Model->SetOpenParenthesisCountNarratorAnnouncement(); } diff --git a/src/Calculator/Views/CalculatorScientificOperators.xaml.h b/src/Calculator/Views/CalculatorScientificOperators.xaml.h index a93e204e..ec10191c 100644 --- a/src/Calculator/Views/CalculatorScientificOperators.xaml.h +++ b/src/Calculator/Views/CalculatorScientificOperators.xaml.h @@ -41,7 +41,7 @@ namespace CalculatorApp void shiftButton_Check(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e); void shiftButton_IsEnabledChanged(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ e); void SetOperatorRowVisibility(); - void OnPropertyChanged(Platform::Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e); + void OnViewModelPropertyChanged(Platform::Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e); void OnLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void OnUnloaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);