Updated changes per code review feedback

This commit is contained in:
Stephanie Anderl 2019-03-14 11:10:18 -07:00
commit 9fb61490ef
8 changed files with 17 additions and 16 deletions

View file

@ -118,7 +118,6 @@ namespace CalculationManager
/// <summary>
/// Callback from the engine
/// Used to set the narrator text when no parenthesis can be added
/// </summary>
void CalculatorManager::OnNoRightParenAdded()
{

View file

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

View file

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

View file

@ -1313,7 +1313,7 @@
<value>Left parenthesis</value>
<comment>Screen reader prompt for the Calculator "(" button on the scientific operator keypad</comment>
</data>
<data name="Format_OpenParenthesisAutomationNamePrefix" xml:space="preserve">
<data name="Format_OpenParenthesisAutomationNamePrefix" xml:space="preserve">
<value>Left parenthesis, open parenthesis count %1</value>
<comment>{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".</comment>
</data>
@ -1325,7 +1325,7 @@
<value>Open parenthesis count %1</value>
<comment>{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".</comment>
</data>
<data name="NoParenthesisAdded_Announcement" xml:space="preserve">
<data name="NoRightParenthesisAdded_Announcement" xml:space="preserve">
<value>There are no open parentheses to close.</value>
<comment>{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+)".</comment>
</data>

View file

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

View file

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

View file

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

View file

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