Raise notification event on delete key/shortcut button click (#12546)

This commit is contained in:
Stefan Markovic
2021-07-29 10:37:09 +02:00
committed by GitHub
parent 5a97db8992
commit e762bfa348
4 changed files with 24 additions and 2 deletions

View File

@@ -135,7 +135,7 @@ void SingleKeyRemapControl::AddNewControlKeyRemapRow(StackPanel& parent, std::ve
deleteRemapKeys.Content(deleteSymbol);
deleteRemapKeys.Background(Media::SolidColorBrush(Colors::Transparent()));
deleteRemapKeys.HorizontalAlignment(HorizontalAlignment::Center);
deleteRemapKeys.Click([&, parent, row, brush](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
deleteRemapKeys.Click([&, parent, row, brush, deleteRemapKeys](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
uint32_t rowIndex;
// Get index of delete button
UIElementCollection children = parent.Children();
@@ -158,6 +158,15 @@ void SingleKeyRemapControl::AddNewControlKeyRemapRow(StackPanel& parent, std::ve
UpdateAccessibleNames(sourceCol, targetCol, delButton, i);
}
if (auto automationPeer{ Automation::Peers::FrameworkElementAutomationPeer::FromElement(deleteRemapKeys) })
{
automationPeer.RaiseNotificationEvent(
Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
GET_RESOURCE_STRING(IDS_DELETE_REMAPPING_EVENT),
L"KeyRemappingDeletedNotificationEvent" /* unique name for this notification category */);
}
children.RemoveAt(rowIndex);
parent.UpdateLayout();
singleKeyRemapBuffer.erase(singleKeyRemapBuffer.begin() + rowIndex);