Raise notification event on delete key/shortcut button click (#12546)
This commit is contained in:
parent
5a97db8992
commit
e762bfa348
|
@ -357,6 +357,9 @@
|
|||
<data name="Delete_Remapping_Button" xml:space="preserve">
|
||||
<value>Delete Remapping</value>
|
||||
</data>
|
||||
<data name="Delete_Remapping_Event" xml:space="preserve">
|
||||
<value>Remapping deleted</value>
|
||||
</data>
|
||||
<data name="AutomationProperties_Row" xml:space="preserve">
|
||||
<value>Row </value>
|
||||
</data>
|
||||
|
|
|
@ -191,7 +191,7 @@ void ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, std::vector<s
|
|||
deleteShortcut.Content(deleteSymbol);
|
||||
deleteShortcut.Background(Media::SolidColorBrush(Colors::Transparent()));
|
||||
deleteShortcut.HorizontalAlignment(HorizontalAlignment::Center);
|
||||
deleteShortcut.Click([&, parent, row, brush](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
|
||||
deleteShortcut.Click([&, parent, row, brush, deleteShortcut](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
|
||||
Button currentButton = sender.as<Button>();
|
||||
uint32_t rowIndex;
|
||||
// Get index of delete button
|
||||
|
@ -215,6 +215,15 @@ void ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, std::vector<s
|
|||
UpdateAccessibleNames(sourceCol, targetCol, targetApp, delButton, i);
|
||||
}
|
||||
|
||||
if (auto automationPeer{ Automation::Peers::FrameworkElementAutomationPeer::FromElement(deleteShortcut) })
|
||||
{
|
||||
automationPeer.RaiseNotificationEvent(
|
||||
Automation::Peers::AutomationNotificationKind::ActionCompleted,
|
||||
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
|
||||
GET_RESOURCE_STRING(IDS_DELETE_REMAPPING_EVENT),
|
||||
L"ShortcutRemappingDeletedNotificationEvent" /* unique name for this notification category */);
|
||||
}
|
||||
|
||||
children.RemoveAt(rowIndex);
|
||||
parent.UpdateLayout();
|
||||
shortcutRemapBuffer.erase(shortcutRemapBuffer.begin() + rowIndex);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#pragma push_macro("GetCurrentTime")
|
||||
#undef GetCurrentTime
|
||||
#include <winrt/Windows.UI.Xaml.Automation.h>
|
||||
#include <winrt/Windows.UI.Xaml.Automation.Peers.h>
|
||||
#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
|
||||
#include <winrt/Windows.UI.Xaml.Hosting.h>
|
||||
#include <winrt/Windows.UI.Xaml.Interop.h>
|
||||
|
|
Loading…
Reference in a new issue