#include "pch.h" #include "SingleKeyRemapControl.h" //Both static members are initialized to null HWND SingleKeyRemapControl::EditKeyboardWindowHandle = nullptr; KeyboardManagerState* SingleKeyRemapControl::keyboardManagerState = nullptr; // Function to add a new row to the remap keys table. If the originalKey and newKey args are provided, then the displayed remap keys are set to those values. void SingleKeyRemapControl::AddNewControlKeyRemapRow(StackPanel& parent, const DWORD& originalKey, const DWORD& newKey) { // Parent element for the row Windows::UI::Xaml::Controls::StackPanel tableRow; tableRow.Background(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::LightGray() }); tableRow.Spacing(100); tableRow.Orientation(Windows::UI::Xaml::Controls::Orientation::Horizontal); // SingleKeyRemapControl for the original key. SingleKeyRemapControl originalRemapKeyControl; tableRow.Children().Append(originalRemapKeyControl.getSingleKeyRemapControl()); // SingleKeyRemapControl for the new remap key. SingleKeyRemapControl newRemapKeyControl; tableRow.Children().Append(newRemapKeyControl.getSingleKeyRemapControl()); // Set the key text if the two keys are not null (i.e. default args) if (originalKey != NULL && newKey != NULL) { originalRemapKeyControl.singleKeyRemapText.Text(winrt::to_hstring((unsigned int)originalKey)); newRemapKeyControl.singleKeyRemapText.Text(winrt::to_hstring((unsigned int)newKey)); } // Delete row button Windows::UI::Xaml::Controls::Button deleteRemapKeys; deleteRemapKeys.Background(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::LightGray() }); deleteRemapKeys.Foreground(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::Black() }); FontIcon deleteSymbol; deleteSymbol.FontFamily(Xaml::Media::FontFamily(L"Segoe MDL2 Assets")); deleteSymbol.Glyph(L"\xE74D"); deleteRemapKeys.Content(deleteSymbol); deleteRemapKeys.Click([&](IInspectable const& sender, RoutedEventArgs const&) { StackPanel currentRow = sender.as