Narrator does not provide the confirmation when user deleted one history from the history list items #1172 (#1302)

* Narrator reads incorrect information as “History and Memory list” in Programmer Calculator #1174
This commit is contained in:
Vignesh M 2020-07-14 22:38:57 +05:30 committed by GitHub
parent ca53d01e4e
commit b1f49a2fcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 1 deletions

View File

@ -18,6 +18,7 @@ namespace CalculatorApp::Common::Automation
StringReference MemoryItemChanged(L"MemorySlotChanged"); StringReference MemoryItemChanged(L"MemorySlotChanged");
StringReference MemoryItemAdded(L"MemorySlotAdded"); StringReference MemoryItemAdded(L"MemorySlotAdded");
StringReference HistoryCleared(L"HistoryCleared"); StringReference HistoryCleared(L"HistoryCleared");
StringReference HistorySlotCleared(L"HistorySlotCleared");
StringReference CategoryNameChanged(L"CategoryNameChanged"); StringReference CategoryNameChanged(L"CategoryNameChanged");
StringReference UpdateCurrencyRates(L"UpdateCurrencyRates"); StringReference UpdateCurrencyRates(L"UpdateCurrencyRates");
StringReference DisplayCopied(L"DisplayCopied"); StringReference DisplayCopied(L"DisplayCopied");
@ -104,6 +105,12 @@ NarratorAnnouncement ^ CalculatorAnnouncement::GetHistoryClearedAnnouncement(Str
announcement, CalculatorActivityIds::HistoryCleared, AutomationNotificationKind::ItemRemoved, AutomationNotificationProcessing::MostRecent); announcement, CalculatorActivityIds::HistoryCleared, AutomationNotificationKind::ItemRemoved, AutomationNotificationProcessing::MostRecent);
} }
NarratorAnnouncement ^ CalculatorAnnouncement::GetHistorySlotClearedAnnouncement(String ^ announcement)
{
return ref new NarratorAnnouncement(
announcement, CalculatorActivityIds::HistorySlotCleared, AutomationNotificationKind::ItemRemoved, AutomationNotificationProcessing::ImportantMostRecent);
}
NarratorAnnouncement ^ CalculatorAnnouncement::GetCategoryNameChangedAnnouncement(String ^ announcement) NarratorAnnouncement ^ CalculatorAnnouncement::GetCategoryNameChangedAnnouncement(String ^ announcement)
{ {
return ref new NarratorAnnouncement( return ref new NarratorAnnouncement(

View File

@ -57,6 +57,7 @@ public
static NarratorAnnouncement ^ GetMemoryItemAddedAnnouncement(Platform::String ^ announcement); static NarratorAnnouncement ^ GetMemoryItemAddedAnnouncement(Platform::String ^ announcement);
static NarratorAnnouncement ^ GetHistoryClearedAnnouncement(Platform::String ^ announcement); static NarratorAnnouncement ^ GetHistoryClearedAnnouncement(Platform::String ^ announcement);
static NarratorAnnouncement ^ GetHistorySlotClearedAnnouncement(Platform::String ^ announcement);
static NarratorAnnouncement ^ GetCategoryNameChangedAnnouncement(Platform::String ^ announcement); static NarratorAnnouncement ^ GetCategoryNameChangedAnnouncement(Platform::String ^ announcement);

View File

@ -23,14 +23,16 @@ using namespace Windows::Foundation::Collections;
static StringReference HistoryVectorLengthKey{ L"HistoryVectorLength" }; static StringReference HistoryVectorLengthKey{ L"HistoryVectorLength" };
static StringReference ItemsSizeKey{ L"ItemsCount" }; static StringReference ItemsSizeKey{ L"ItemsCount" };
namespace CalculatorApp::ViewModel::HistoryResourceKeys namespace HistoryResourceKeys
{ {
StringReference HistoryCleared(L"HistoryList_Cleared"); StringReference HistoryCleared(L"HistoryList_Cleared");
StringReference HistorySlotCleared(L"Format_HistorySlotCleared");
} }
HistoryViewModel::HistoryViewModel(_In_ CalculationManager::CalculatorManager* calculatorManager) HistoryViewModel::HistoryViewModel(_In_ CalculationManager::CalculatorManager* calculatorManager)
: m_calculatorManager(calculatorManager) : m_calculatorManager(calculatorManager)
, m_localizedHistoryCleared(nullptr) , m_localizedHistoryCleared(nullptr)
, m_localizedHistorySlotCleared(nullptr)
{ {
AreHistoryShortcutsEnabled = true; AreHistoryShortcutsEnabled = true;
@ -129,6 +131,12 @@ void HistoryViewModel::DeleteItem(_In_ HistoryItemViewModel ^ e)
RaisePropertyChanged(ItemsSizeKey); RaisePropertyChanged(ItemsSizeKey);
} }
} }
// Adding 1 to the history item index to provide 1-based numbering on announcements.
wstring localizedIndex = to_wstring(itemIndex + 1);
LocalizationSettings::GetInstance().LocalizeDisplayValue(&localizedIndex);
m_localizedHistorySlotCleared = AppResourceProvider::GetInstance()->GetResourceString(HistoryResourceKeys::HistorySlotCleared);
String ^ announcement = LocalizationStringUtil::GetLocalizedString(m_localizedHistorySlotCleared, StringReference(localizedIndex.c_str()));
HistoryAnnouncement = CalculatorAnnouncement::GetHistorySlotClearedAnnouncement(announcement);
} }
void HistoryViewModel::OnHideCommand(_In_ Platform::Object ^ e) void HistoryViewModel::OnHideCommand(_In_ Platform::Object ^ e)

View File

@ -61,6 +61,7 @@ namespace CalculatorApp
CalculatorDisplay m_calculatorDisplay; CalculatorDisplay m_calculatorDisplay;
CalculationManager::CalculatorMode m_currentMode; CalculationManager::CalculatorMode m_currentMode;
Platform::String ^ m_localizedHistoryCleared; Platform::String ^ m_localizedHistoryCleared;
Platform::String ^ m_localizedHistorySlotCleared;
}; };
} }
} }

View File

@ -4715,6 +4715,10 @@
<value>Memory list</value> <value>Memory list</value>
<comment>Automation name for the group of controls for memory list.</comment> <comment>Automation name for the group of controls for memory list.</comment>
</data> </data>
<data name="Format_HistorySlotCleared" xml:space="preserve">
<value>History slot %1 cleared</value>
<comment>{Locked='%1'} Formatting string for a Narrator announcement when the user clears a history slot. The %1 is the index of the history slot. For example, users might hear "History slot 2 cleared".</comment>
</data>
<data name="CalcAlwaysOnTop" xml:space="preserve"> <data name="CalcAlwaysOnTop" xml:space="preserve">
<value>Calculator always on top</value> <value>Calculator always on top</value>
<comment>Announcement to indicate calculator window is always shown on top.</comment> <comment>Announcement to indicate calculator window is always shown on top.</comment>