Resolution for Bit Shift radio button announcements (#1317)

This commit is contained in:
Vignesh M 2020-07-21 03:35:22 +05:30 committed by GitHub
parent ed7bfb8142
commit 264babc608
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 72 additions and 22 deletions

View file

@ -29,6 +29,7 @@ namespace CalculatorApp::Common::Automation
StringReference FunctionRemoved(L"FunctionRemoved");
StringReference GraphViewBestFitChanged(L"GraphViewBestFitChanged");
StringReference AlwaysOnTop(L"AlwaysOnTop");
StringReference BitShiftRadioButtonContent(L"BitShiftRadioButtonContent");
}
}
@ -108,7 +109,10 @@ NarratorAnnouncement ^ CalculatorAnnouncement::GetHistoryClearedAnnouncement(Str
NarratorAnnouncement ^ CalculatorAnnouncement::GetHistorySlotClearedAnnouncement(String ^ announcement)
{
return ref new NarratorAnnouncement(
announcement, CalculatorActivityIds::HistorySlotCleared, AutomationNotificationKind::ItemRemoved, AutomationNotificationProcessing::ImportantMostRecent);
announcement,
CalculatorActivityIds::HistorySlotCleared,
AutomationNotificationKind::ItemRemoved,
AutomationNotificationProcessing::ImportantMostRecent);
}
NarratorAnnouncement ^ CalculatorAnnouncement::GetCategoryNameChangedAnnouncement(String ^ announcement)
@ -174,10 +178,7 @@ NarratorAnnouncement ^ CalculatorAnnouncement::GetGraphViewChangedAnnouncement(S
NarratorAnnouncement ^ CalculatorAnnouncement::GetFunctionRemovedAnnouncement(String ^ announcement)
{
return ref new NarratorAnnouncement(
announcement,
CalculatorActivityIds::FunctionRemoved,
AutomationNotificationKind::ItemRemoved,
AutomationNotificationProcessing::MostRecent);
announcement, CalculatorActivityIds::FunctionRemoved, AutomationNotificationKind::ItemRemoved, AutomationNotificationProcessing::MostRecent);
}
NarratorAnnouncement ^ CalculatorAnnouncement::GetGraphViewBestFitChangedAnnouncement(Platform::String ^ announcement)
@ -190,10 +191,16 @@ NarratorAnnouncement ^ CalculatorAnnouncement::GetGraphViewBestFitChangedAnnounc
}
NarratorAnnouncement ^ CalculatorAnnouncement::GetAlwaysOnTopChangedAnnouncement(String ^ announcement)
{
return ref new NarratorAnnouncement(
announcement, CalculatorActivityIds::AlwaysOnTop, AutomationNotificationKind::ActionCompleted, AutomationNotificationProcessing::ImportantMostRecent);
}
NarratorAnnouncement ^ CalculatorAnnouncement::GetBitShiftRadioButtonCheckedAnnouncement(String ^ announcement)
{
return ref new NarratorAnnouncement(
announcement,
CalculatorActivityIds::AlwaysOnTop,
CalculatorActivityIds::BitShiftRadioButtonContent,
AutomationNotificationKind::ActionCompleted,
AutomationNotificationProcessing::ImportantMostRecent);
}

View file

@ -76,5 +76,7 @@ public
static NarratorAnnouncement ^ GetAlwaysOnTopChangedAnnouncement(Platform::String ^ announcement);
static NarratorAnnouncement ^ GetBitShiftRadioButtonCheckedAnnouncement(Platform::String ^ announcement);
};
}

View file

@ -252,8 +252,7 @@ void StandardCalculatorViewModel::SetNoParenAddedNarratorAnnouncement()
{
if (m_localizedNoRightParenthesisAddedFormat == nullptr)
{
m_localizedNoRightParenthesisAddedFormat =
AppResourceProvider::GetInstance()->GetResourceString(CalculatorResourceKeys::NoParenthesisAdded);
m_localizedNoRightParenthesisAddedFormat = AppResourceProvider::GetInstance()->GetResourceString(CalculatorResourceKeys::NoParenthesisAdded);
}
Announcement = CalculatorAnnouncement::GetNoRightParenthesisAddedAnnouncement(m_localizedNoRightParenthesisAddedFormat);
@ -1004,8 +1003,8 @@ ButtonInfo StandardCalculatorViewModel::MapCharacterToButtonId(char16 ch)
{
if (LocalizationSettings::GetInstance().IsLocalizedDigit(ch))
{
result.buttonId = NumbersAndOperatorsEnum::Zero
+ static_cast<NumbersAndOperatorsEnum>(ch - LocalizationSettings::GetInstance().GetDigitSymbolFromEnUsDigit('0'));
result.buttonId =
NumbersAndOperatorsEnum::Zero + static_cast<NumbersAndOperatorsEnum>(ch - LocalizationSettings::GetInstance().GetDigitSymbolFromEnUsDigit('0'));
result.canSendNegate = true;
}
}
@ -1469,7 +1468,7 @@ void StandardCalculatorViewModel::Recalculate(bool fromHistory)
bool StandardCalculatorViewModel::IsOpnd(Command command)
{
static constexpr Command opnd[] = { Command::Command0, Command::Command1, Command::Command2, Command::Command3, Command::Command4, Command::Command5,
Command::Command6, Command::Command7, Command::Command8, Command::Command9, Command::CommandPNT };
Command::Command6, Command::Command7, Command::Command8, Command::Command9, Command::CommandPNT };
return find(begin(opnd), end(opnd), command) != end(opnd);
}
@ -1477,9 +1476,9 @@ bool StandardCalculatorViewModel::IsOpnd(Command command)
bool StandardCalculatorViewModel::IsUnaryOp(Command command)
{
static constexpr Command unaryOp[] = { Command::CommandSQRT, Command::CommandFAC, Command::CommandSQR, Command::CommandLOG,
Command::CommandPOW10, Command::CommandPOWE, Command::CommandLN, Command::CommandREC,
Command::CommandSIGN, Command::CommandSINH, Command::CommandASINH, Command::CommandCOSH,
Command::CommandACOSH, Command::CommandTANH, Command::CommandATANH, Command::CommandCUB };
Command::CommandPOW10, Command::CommandPOWE, Command::CommandLN, Command::CommandREC,
Command::CommandSIGN, Command::CommandSINH, Command::CommandASINH, Command::CommandCOSH,
Command::CommandACOSH, Command::CommandTANH, Command::CommandATANH, Command::CommandCUB };
if (find(begin(unaryOp), end(unaryOp), command) != end(unaryOp))
{
@ -1496,9 +1495,8 @@ bool StandardCalculatorViewModel::IsUnaryOp(Command command)
bool StandardCalculatorViewModel::IsTrigOp(Command command)
{
static constexpr Command trigOp[] = {
Command::CommandSIN, Command::CommandCOS, Command::CommandTAN, Command::CommandASIN, Command::CommandACOS, Command::CommandATAN
};
static constexpr Command trigOp[] = { Command::CommandSIN, Command::CommandCOS, Command::CommandTAN,
Command::CommandASIN, Command::CommandACOS, Command::CommandATAN };
return find(begin(trigOp), end(trigOp), command) != end(trigOp);
}
@ -1506,7 +1504,7 @@ bool StandardCalculatorViewModel::IsTrigOp(Command command)
bool StandardCalculatorViewModel::IsBinOp(Command command)
{
static constexpr Command binOp[] = { Command::CommandADD, Command::CommandSUB, Command::CommandMUL, Command::CommandDIV,
Command::CommandEXP, Command::CommandROOT, Command::CommandMOD, Command::CommandPWR };
Command::CommandEXP, Command::CommandROOT, Command::CommandMOD, Command::CommandPWR };
return find(begin(binOp), end(binOp), command) != end(binOp);
}
@ -1695,12 +1693,11 @@ NarratorAnnouncement ^ StandardCalculatorViewModel::GetDisplayUpdatedNarratorAnn
{
if (m_localizedButtonPressFeedbackAutomationFormat == nullptr)
{
m_localizedButtonPressFeedbackAutomationFormat = AppResourceProvider::GetInstance()->GetResourceString(CalculatorResourceKeys::ButtonPressFeedbackFormat);
m_localizedButtonPressFeedbackAutomationFormat =
AppResourceProvider::GetInstance()->GetResourceString(CalculatorResourceKeys::ButtonPressFeedbackFormat);
}
announcement = LocalizationStringUtil::GetLocalizedString(
m_localizedButtonPressFeedbackAutomationFormat,
m_CalculationResultAutomationName,
m_feedbackForButtonPress);
m_localizedButtonPressFeedbackAutomationFormat, m_CalculationResultAutomationName, m_feedbackForButtonPress);
}
// Make sure we don't accidentally repeat an announcement.
@ -1767,3 +1764,8 @@ void StandardCalculatorViewModel::SendCommandToCalcManager(int commandId)
{
m_standardCalculatorManager.SendCommand(static_cast<Command>(commandId));
}
void StandardCalculatorViewModel::SetBitshiftRadioButtonCheckedAnnouncement(Platform::String ^ announcement)
{
Announcement = CalculatorAnnouncement::GetBitShiftRadioButtonCheckedAnnouncement(announcement);
}

View file

@ -267,6 +267,7 @@ namespace CalculatorApp
void OnMaxDigitsReached();
void OnBinaryOperatorReceived();
void OnMemoryItemChanged(unsigned int indexOfMemory);
void SetBitshiftRadioButtonCheckedAnnouncement(Platform::String ^ announcement);
Platform::String ^ GetLocalizedStringFormat(Platform::String ^ format, Platform::String ^ displayValue);
void OnPropertyChanged(Platform::String ^ propertyname);