Move hardcoded strings in Keyboard Manager projects to rc file (#5921)

* moved all strings in c++ side to rc file

* Fixed formatting
This commit is contained in:
Arjun Balgovind
2020-08-17 13:46:50 -07:00
committed by GitHub
parent 8dec9d5fe9
commit 8f8b200f24
10 changed files with 178 additions and 70 deletions

View File

@@ -3,7 +3,10 @@
#include <sstream> #include <sstream>
#include "../common/shared_constants.h" #include "../common/shared_constants.h"
#include <shlwapi.h> #include <shlwapi.h>
#include "../../common/common.h"
#include "keyboardmanager/dll/resource.h"
#include "../common/keyboard_layout.h" #include "../common/keyboard_layout.h"
extern "C" IMAGE_DOS_HEADER __ImageBase;
using namespace winrt::Windows::Foundation; using namespace winrt::Windows::Foundation;
@@ -137,43 +140,41 @@ namespace KeyboardManagerHelper
switch (errorType) switch (errorType)
{ {
case ErrorType::NoError: case ErrorType::NoError:
return L"Remapping successful"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_REMAPSUCCESSFUL).c_str();
case ErrorType::SameKeyPreviouslyMapped: case ErrorType::SameKeyPreviouslyMapped:
return L"Cannot remap a key more than once for the same target app"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SAMEKEYPREVIOUSLYMAPPED).c_str();
case ErrorType::MapToSameKey: case ErrorType::MapToSameKey:
return L"Cannot remap a key to itself"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_MAPPEDTOSAMEKEY).c_str();
case ErrorType::ConflictingModifierKey: case ErrorType::ConflictingModifierKey:
return L"Cannot remap this key as it conflicts with another remapped key"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_CONFLICTINGMODIFIERKEY).c_str();
case ErrorType::SameShortcutPreviouslyMapped: case ErrorType::SameShortcutPreviouslyMapped:
return L"Cannot remap a shortcut more than once for the same target app"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SAMESHORTCUTPREVIOUSLYMAPPED).c_str();
case ErrorType::MapToSameShortcut: case ErrorType::MapToSameShortcut:
return L"Cannot remap a shortcut to itself"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_MAPTOSAMESHORTCUT).c_str();
case ErrorType::ConflictingModifierShortcut: case ErrorType::ConflictingModifierShortcut:
return L"Cannot remap this shortcut as it conflicts with another remapped shortcut"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_CONFLICTINGMODIFIERSHORTCUT).c_str();
case ErrorType::WinL: case ErrorType::WinL:
return L"Cannot remap from/to Win L"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_WINL).c_str();
case ErrorType::CtrlAltDel: case ErrorType::CtrlAltDel:
return L"Cannot remap from/to Ctrl Alt Del"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_CTRLALTDEL).c_str();
case ErrorType::RemapUnsuccessful: case ErrorType::RemapUnsuccessful:
return L"Some remappings were not applied"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_REMAPUNSUCCESSFUL).c_str();
case ErrorType::SaveFailed: case ErrorType::SaveFailed:
return L"Failed to save the remappings"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SAVEFAILED).c_str();
case ErrorType::MissingKey:
return L"Incomplete remapping";
case ErrorType::ShortcutStartWithModifier: case ErrorType::ShortcutStartWithModifier:
return L"Shortcut must start with a modifier key"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SHORTCUTSTARTWITHMODIFIER).c_str();
case ErrorType::ShortcutCannotHaveRepeatedModifier: case ErrorType::ShortcutCannotHaveRepeatedModifier:
return L"Shortcut cannot contain a repeated modifier"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SHORTCUTNOREPEATEDMODIFIER).c_str();
case ErrorType::ShortcutAtleast2Keys: case ErrorType::ShortcutAtleast2Keys:
return L"Shortcut must have atleast 2 keys"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SHORTCUTATLEAST2KEYS).c_str();
case ErrorType::ShortcutOneActionKey: case ErrorType::ShortcutOneActionKey:
return L"Shortcut must contain an action key"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SHORTCUTONEACTIONKEY).c_str();
case ErrorType::ShortcutNotMoreThanOneActionKey: case ErrorType::ShortcutNotMoreThanOneActionKey:
return L"Shortcut cannot have more than one action key"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_SHORTCUTMAXONEACTIONKEY).c_str();
case ErrorType::ShortcutMaxShortcutSizeOneActionKey: case ErrorType::ShortcutMaxShortcutSizeOneActionKey:
return L"Shortcuts can only have up to 2 modifier keys"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_MAXSHORTCUTSIZE).c_str();
default: default:
return L"Unexpected error"; return GET_RESOURCE_STRING(IDS_ERRORMESSAGE_DEFAULT).c_str();
} }
} }

View File

@@ -43,7 +43,6 @@ namespace KeyboardManagerHelper
CtrlAltDel, CtrlAltDel,
RemapUnsuccessful, RemapUnsuccessful,
SaveFailed, SaveFailed,
MissingKey,
ShortcutStartWithModifier, ShortcutStartWithModifier,
ShortcutCannotHaveRepeatedModifier, ShortcutCannotHaveRepeatedModifier,
ShortcutAtleast2Keys, ShortcutAtleast2Keys,

View File

@@ -1,6 +1,9 @@
#pragma once #pragma once
#include <string> #include <string>
#include <winrt/base.h> #include <winrt/base.h>
#include "../../common/common.h"
#include "keyboardmanager/dll/resource.h"
extern "C" IMAGE_DOS_HEADER __ImageBase;
namespace KeyboardManagerConstants namespace KeyboardManagerConstants
{ {
@@ -43,9 +46,6 @@ namespace KeyboardManagerConstants
// Name of the dummy update file. // Name of the dummy update file.
inline const std::wstring DummyUpdateFileName = L"settings-updated.json"; inline const std::wstring DummyUpdateFileName = L"settings-updated.json";
// Initial value for tooltip
inline const winrt::hstring ToolTipInitialContent = L"Initialised";
// Minimum and maximum size of a shortcut // Minimum and maximum size of a shortcut
inline const long MinShortcutSize = 2; inline const long MinShortcutSize = 2;
inline const long MaxShortcutSize = 3; inline const long MaxShortcutSize = 3;
@@ -95,7 +95,7 @@ namespace KeyboardManagerConstants
inline const DWORD DUMMY_KEY = 0xFF; inline const DWORD DUMMY_KEY = 0xFF;
// String constant for the default app name in Remap shortcuts // String constant for the default app name in Remap shortcuts
inline const std::wstring DefaultAppName = L"All Apps"; inline const std::wstring DefaultAppName = GET_RESOURCE_STRING(IDS_EDITSHORTCUTS_ALLAPPS);
// String constant to represent no activated application in app-specific shortcuts // String constant to represent no activated application in app-specific shortcuts
inline const std::wstring NoActivatedApp = L""; inline const std::wstring NoActivatedApp = L"";

View File

@@ -4,8 +4,55 @@
STRINGTABLE STRINGTABLE
BEGIN BEGIN
IDS_SETTINGS_DESCRIPTION L"This feature requires Windows 10 version 1903 or higher" IDS_SETTINGS_DESCRIPTION L"This feature requires Windows 10 version 1903 or higher"
IDS_KEYBOARDMANAGER L"Keyboard Manager" IDS_KEYBOARDMANAGER L"Keyboard Manager"
IDS_CREATEWINDOWFAILED_ERRORMESSAGE L"Call to CreateWindow failed!"
IDS_CREATEWINDOWFAILED_ERRORTITLE L"Error"
IDS_REGISTERCLASSFAILED_ERRORMESSAGE L"Windows registration failed!"
IDS_REGISTERCLASSFAILED_ERRORTITLE L"Error"
IDS_EDITKEYBOARD_WINDOWNAME L"Remap keys"
IDS_EDITSHORTCUTS_WINDOWNAME L"Remap shortcuts"
IDS_OK_BUTTON L"OK"
IDS_CANCEL_BUTTON L"Cancel"
IDS_CONTINUE_BUTTON L"Continue Anyway"
IDS_EDITKEYBOARD_SOURCEHEADER L"Key:"
IDS_EDITKEYBOARD_TARGETHEADER L"Mapped To:"
IDS_EDITSHORTCUTS_SOURCEHEADER L"Shortcut:"
IDS_EDITSHORTCUTS_TARGETHEADER L"Mapped To:"
IDS_EDITSHORTCUTS_TARGETAPPHEADER L"Target App:"
IDS_EDITKEYBOARD_ORPHANEDDIALOGTITLE L"The following keys are unassigned and you won't be able to use them:"
IDS_EDITKEYBOARD_PARTIALCONFIRMATIONDIALOGTITLE L"Some of the keys could not be remapped. Do you want to continue anyway?"
IDS_EDITSHORTCUTS_PARTIALCONFIRMATIONDIALOGTITLE L"Some of the shortcuts could not be remapped. Do you want to continue anyway?"
IDS_EDITKEYBOARD_INFO L"Select the key you want to change (Key) and then the key or shortcut you want it to become (Mapped To)."
IDS_EDITKEYBOARD_INFOEXAMPLE L"For example, if you want to press A and get ""Ctrl+C"", key ""A"" would be your ""Key"" column and the shortcut ""Ctrl+C"" would be your ""Mapped To"" column."
IDS_EDITSHORTCUTS_INFO L"Select the shortcut you want to change (Shortcut) and then the key or shortcut you want it to invoke (Mapped To)."
IDS_EDITSHORTCUTS_INFOEXAMPLE L"For example, if you want to press ""Ctrl+C"" and get ""Alt"" only on Microsoft Edge, ""Ctrl+C"" would be your ""Shortcut"" column, the key ""Alt"" would be your ""Mapped To"" column, and ""MSEdge"" would be your ""Target App"" column. If no target app is entered, it will apply globally. The name must be the process name and not the app name."
IDS_TYPE_BUTTON L"Type"
IDS_TYPEKEY_TITLE L"Press a key on selected keyboard:"
IDS_TYPESHORTCUT_TITLE L"Press the keys in shortcut:"
IDS_TYPEKEY_HEADER L"Key Pressed:"
IDS_TYPESHORTCUT_HEADER L"Keys Pressed:"
IDS_TYPE_HOLDENTER L"Hold Enter to continue"
IDS_TYPE_HOLDESC L"Hold Esc to discard"
IDS_EDITSHORTCUTS_ALLAPPS L"All Apps"
IDS_ERRORMESSAGE_REMAPSUCCESSFUL L"Remapping successful"
IDS_ERRORMESSAGE_REMAPUNSUCCESSFUL L"Some remappings were not applied"
IDS_ERRORMESSAGE_SAMEKEYPREVIOUSLYMAPPED L"Cannot remap a key more than once"
IDS_ERRORMESSAGE_MAPPEDTOSAMEKEY L"Cannot remap a key to itself"
IDS_ERRORMESSAGE_CONFLICTINGMODIFIERKEY L"Cannot remap this key as it conflicts with another remapped key"
IDS_ERRORMESSAGE_SAMESHORTCUTPREVIOUSLYMAPPED L"Cannot remap a shortcut more than once for the same target app"
IDS_ERRORMESSAGE_MAPTOSAMESHORTCUT L"Cannot remap a shortcut to itself"
IDS_ERRORMESSAGE_CONFLICTINGMODIFIERSHORTCUT L"Cannot remap this shortcut as it conflicts with another remapped shortcut"
IDS_ERRORMESSAGE_WINL L"Cannot remap from/to Win L"
IDS_ERRORMESSAGE_CTRLALTDEL L"Cannot remap from/to Ctrl Alt Del"
IDS_ERRORMESSAGE_SAVEFAILED L"Failed to save the remappings"
IDS_ERRORMESSAGE_SHORTCUTSTARTWITHMODIFIER L"Shortcut must start with a modifier key"
IDS_ERRORMESSAGE_SHORTCUTNOREPEATEDMODIFIER L"Shortcut cannot contain a repeated modifier"
IDS_ERRORMESSAGE_SHORTCUTATLEAST2KEYS L"Shortcut must have atleast 2 keys"
IDS_ERRORMESSAGE_SHORTCUTONEACTIONKEY L"Shortcut must contain an action key"
IDS_ERRORMESSAGE_SHORTCUTMAXONEACTIONKEY L"Shortcut cannot have more than one action key"
IDS_ERRORMESSAGE_MAXSHORTCUTSIZE L"Shortcuts can only have up to 2 modifier keys"
IDS_ERRORMESSAGE_DEFAULT L"Unexpected error"
END END
IDS_KEYBOARDMANAGER_ICON ICON L"Keyboard.ico" IDS_KEYBOARDMANAGER_ICON ICON L"Keyboard.ico"

View File

@@ -13,5 +13,52 @@
////////////////////////////// //////////////////////////////
#define IDS_SETTINGS_DESCRIPTION 101 #define IDS_SETTINGS_DESCRIPTION 101
#define IDS_KEYBOARDMANAGER 102 #define IDS_KEYBOARDMANAGER 102
#define IDS_KEYBOARDMANAGER_ICON 103 #define IDS_KEYBOARDMANAGER_ICON 103
#define IDS_CREATEWINDOWFAILED_ERRORMESSAGE 104
#define IDS_CREATEWINDOWFAILED_ERRORTITLE 105
#define IDS_REGISTERCLASSFAILED_ERRORMESSAGE 106
#define IDS_REGISTERCLASSFAILED_ERRORTITLE 107
#define IDS_EDITKEYBOARD_WINDOWNAME 108
#define IDS_EDITSHORTCUTS_WINDOWNAME 109
#define IDS_CANCEL_BUTTON 110
#define IDS_OK_BUTTON 111
#define IDS_CONTINUE_BUTTON 112
#define IDS_EDITKEYBOARD_SOURCEHEADER 113
#define IDS_EDITKEYBOARD_TARGETHEADER 114
#define IDS_EDITSHORTCUTS_SOURCEHEADER 115
#define IDS_EDITSHORTCUTS_TARGETHEADER 116
#define IDS_EDITSHORTCUTS_TARGETAPPHEADER 117
#define IDS_EDITKEYBOARD_ORPHANEDDIALOGTITLE 118
#define IDS_EDITKEYBOARD_PARTIALCONFIRMATIONDIALOGTITLE 119
#define IDS_EDITSHORTCUTS_PARTIALCONFIRMATIONDIALOGTITLE 120
#define IDS_EDITKEYBOARD_INFO 121
#define IDS_EDITKEYBOARD_INFOEXAMPLE 122
#define IDS_EDITSHORTCUTS_INFO 123
#define IDS_EDITSHORTCUTS_INFOEXAMPLE 124
#define IDS_TYPE_BUTTON 125
#define IDS_TYPEKEY_TITLE 126
#define IDS_TYPESHORTCUT_TITLE 127
#define IDS_TYPEKEY_HEADER 128
#define IDS_TYPESHORTCUT_HEADER 129
#define IDS_TYPE_HOLDENTER 130
#define IDS_TYPE_HOLDESC 131
#define IDS_EDITSHORTCUTS_ALLAPPS 132
#define IDS_ERRORMESSAGE_REMAPSUCCESSFUL 133
#define IDS_ERRORMESSAGE_REMAPUNSUCCESSFUL 134
#define IDS_ERRORMESSAGE_SAMEKEYPREVIOUSLYMAPPED 135
#define IDS_ERRORMESSAGE_MAPPEDTOSAMEKEY 136
#define IDS_ERRORMESSAGE_CONFLICTINGMODIFIERKEY 137
#define IDS_ERRORMESSAGE_SAMESHORTCUTPREVIOUSLYMAPPED 138
#define IDS_ERRORMESSAGE_MAPTOSAMESHORTCUT 139
#define IDS_ERRORMESSAGE_CONFLICTINGMODIFIERSHORTCUT 140
#define IDS_ERRORMESSAGE_WINL 141
#define IDS_ERRORMESSAGE_CTRLALTDEL 142
#define IDS_ERRORMESSAGE_SAVEFAILED 143
#define IDS_ERRORMESSAGE_SHORTCUTSTARTWITHMODIFIER 144
#define IDS_ERRORMESSAGE_SHORTCUTNOREPEATEDMODIFIER 145
#define IDS_ERRORMESSAGE_SHORTCUTATLEAST2KEYS 146
#define IDS_ERRORMESSAGE_SHORTCUTONEACTIONKEY 147
#define IDS_ERRORMESSAGE_SHORTCUTMAXONEACTIONKEY 148
#define IDS_ERRORMESSAGE_MAXSHORTCUTSIZE 149
#define IDS_ERRORMESSAGE_DEFAULT 150

View File

@@ -1,5 +1,9 @@
#include "pch.h" #include "pch.h"
#include "Dialog.h" #include "Dialog.h"
#include <set>
#include "common/common.h"
#include "keyboardmanager/dll/resource.h"
extern "C" IMAGE_DOS_HEADER __ImageBase;
using namespace winrt::Windows::Foundation; using namespace winrt::Windows::Foundation;
@@ -10,9 +14,9 @@ IAsyncOperation<bool> Dialog::PartialRemappingConfirmationDialog(XamlRoot root,
confirmationDialog.Title(box_value(dialogTitle)); confirmationDialog.Title(box_value(dialogTitle));
confirmationDialog.IsPrimaryButtonEnabled(true); confirmationDialog.IsPrimaryButtonEnabled(true);
confirmationDialog.DefaultButton(ContentDialogButton::Primary); confirmationDialog.DefaultButton(ContentDialogButton::Primary);
confirmationDialog.PrimaryButtonText(winrt::hstring(L"Continue Anyway")); confirmationDialog.PrimaryButtonText(winrt::hstring(GET_RESOURCE_STRING(IDS_CONTINUE_BUTTON)));
confirmationDialog.IsSecondaryButtonEnabled(true); confirmationDialog.IsSecondaryButtonEnabled(true);
confirmationDialog.SecondaryButtonText(winrt::hstring(L"Cancel")); confirmationDialog.SecondaryButtonText(winrt::hstring(GET_RESOURCE_STRING(IDS_CANCEL_BUTTON)));
ContentDialogResult res = co_await confirmationDialog.ShowAsync(); ContentDialogResult res = co_await confirmationDialog.ShowAsync();
co_return res == ContentDialogResult::Primary; co_return res == ContentDialogResult::Primary;

View File

@@ -13,7 +13,9 @@
#include <keyboardmanager/dll/resource.h> #include <keyboardmanager/dll/resource.h>
#include "../common/shared_constants.h" #include "../common/shared_constants.h"
#include "keyboardmanager/common/KeyboardManagerState.h" #include "keyboardmanager/common/KeyboardManagerState.h"
#include "common/common.h"
#include "LoadingAndSavingRemappingHelper.h" #include "LoadingAndSavingRemappingHelper.h"
extern "C" IMAGE_DOS_HEADER __ImageBase;
using namespace winrt::Windows::Foundation; using namespace winrt::Windows::Foundation;
@@ -36,13 +38,13 @@ static IAsyncOperation<bool> OrphanKeysConfirmationDialog(
{ {
ContentDialog confirmationDialog; ContentDialog confirmationDialog;
confirmationDialog.XamlRoot(root); confirmationDialog.XamlRoot(root);
confirmationDialog.Title(box_value(L"The following keys are unassigned and you won't be able to use them:")); confirmationDialog.Title(box_value(GET_RESOURCE_STRING(IDS_EDITKEYBOARD_ORPHANEDDIALOGTITLE)));
confirmationDialog.Content(nullptr); confirmationDialog.Content(nullptr);
confirmationDialog.IsPrimaryButtonEnabled(true); confirmationDialog.IsPrimaryButtonEnabled(true);
confirmationDialog.DefaultButton(ContentDialogButton::Primary); confirmationDialog.DefaultButton(ContentDialogButton::Primary);
confirmationDialog.PrimaryButtonText(winrt::hstring(L"Continue Anyway")); confirmationDialog.PrimaryButtonText(winrt::hstring(GET_RESOURCE_STRING(IDS_CONTINUE_BUTTON)));
confirmationDialog.IsSecondaryButtonEnabled(true); confirmationDialog.IsSecondaryButtonEnabled(true);
confirmationDialog.SecondaryButtonText(winrt::hstring(L"Cancel")); confirmationDialog.SecondaryButtonText(winrt::hstring(GET_RESOURCE_STRING(IDS_CANCEL_BUTTON)));
TextBlock orphanKeysBlock; TextBlock orphanKeysBlock;
std::wstring orphanKeyString; std::wstring orphanKeyString;
@@ -67,7 +69,7 @@ static IAsyncAction OnClickAccept(KeyboardManagerState& keyboardManagerState, Xa
if (isSuccess != KeyboardManagerHelper::ErrorType::NoError) if (isSuccess != KeyboardManagerHelper::ErrorType::NoError)
{ {
if (!co_await Dialog::PartialRemappingConfirmationDialog(root, L"Some of the keys could not be remapped. Do you want to continue anyway?")) if (!co_await Dialog::PartialRemappingConfirmationDialog(root, GET_RESOURCE_STRING(IDS_EDITKEYBOARD_PARTIALCONFIRMATIONDIALOGTITLE)))
{ {
co_return; co_return;
} }
@@ -108,7 +110,7 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
if (RegisterClassEx(&windowClass) == NULL) if (RegisterClassEx(&windowClass) == NULL)
{ {
MessageBox(NULL, L"Windows registration failed!", L"Error", NULL); MessageBox(NULL, GET_RESOURCE_STRING(IDS_REGISTERCLASSFAILED_ERRORMESSAGE).c_str(), GET_RESOURCE_STRING(IDS_REGISTERCLASSFAILED_ERRORTITLE).c_str(), NULL);
return; return;
} }
@@ -126,7 +128,7 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
// Window Creation // Window Creation
HWND _hWndEditKeyboardWindow = CreateWindow( HWND _hWndEditKeyboardWindow = CreateWindow(
szWindowClass, szWindowClass,
L"Remap keys", GET_RESOURCE_STRING(IDS_EDITKEYBOARD_WINDOWNAME).c_str(),
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MAXIMIZEBOX, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MAXIMIZEBOX,
(desktopRect.right / 2) - (windowWidth / 2), (desktopRect.right / 2) - (windowWidth / 2),
(desktopRect.bottom / 2) - (windowHeight / 2), (desktopRect.bottom / 2) - (windowHeight / 2),
@@ -138,7 +140,7 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
NULL); NULL);
if (_hWndEditKeyboardWindow == NULL) if (_hWndEditKeyboardWindow == NULL)
{ {
MessageBox(NULL, L"Call to CreateWindow failed!", L"Error", NULL); MessageBox(NULL, GET_RESOURCE_STRING(IDS_CREATEWINDOWFAILED_ERRORMESSAGE).c_str(), GET_RESOURCE_STRING(IDS_CREATEWINDOWFAILED_ERRORTITLE).c_str(), NULL);
return; return;
} }
// Ensures the window is in foreground on first startup. If this is not done, the window appears behind because the thread is not on the foreground. // Ensures the window is in foreground on first startup. If this is not done, the window appears behind because the thread is not on the foreground.
@@ -168,14 +170,14 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
// Header text // Header text
TextBlock headerText; TextBlock headerText;
headerText.Text(L"Remap keys"); headerText.Text(GET_RESOURCE_STRING(IDS_EDITKEYBOARD_WINDOWNAME));
headerText.FontSize(30); headerText.FontSize(30);
headerText.Margin({ 0, 0, 0, 0 }); headerText.Margin({ 0, 0, 0, 0 });
header.SetAlignLeftWithPanel(headerText, true); header.SetAlignLeftWithPanel(headerText, true);
// Header Cancel button // Header Cancel button
Button cancelButton; Button cancelButton;
cancelButton.Content(winrt::box_value(L"Cancel")); cancelButton.Content(winrt::box_value(GET_RESOURCE_STRING(IDS_CANCEL_BUTTON)));
cancelButton.Margin({ 10, 0, 0, 0 }); cancelButton.Margin({ 10, 0, 0, 0 });
cancelButton.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { cancelButton.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
// Close the window since settings do not need to be saved // Close the window since settings do not need to be saved
@@ -184,13 +186,13 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
// Text block for information about remap key section. // Text block for information about remap key section.
TextBlock keyRemapInfoHeader; TextBlock keyRemapInfoHeader;
keyRemapInfoHeader.Text(L"Select the key you want to change (Key) and then the key or shortcut you want it to become (Mapped To)."); keyRemapInfoHeader.Text(GET_RESOURCE_STRING(IDS_EDITKEYBOARD_INFO));
keyRemapInfoHeader.Margin({ 10, 0, 0, 10 }); keyRemapInfoHeader.Margin({ 10, 0, 0, 10 });
keyRemapInfoHeader.FontWeight(Text::FontWeights::SemiBold()); keyRemapInfoHeader.FontWeight(Text::FontWeights::SemiBold());
keyRemapInfoHeader.TextWrapping(TextWrapping::Wrap); keyRemapInfoHeader.TextWrapping(TextWrapping::Wrap);
TextBlock keyRemapInfoExample; TextBlock keyRemapInfoExample;
keyRemapInfoExample.Text(L"For example, if you want to press A and get \"Ctrl+C\", key \"A\" would be your \"Key\" column and the shortcut \"Ctrl+C\" would be your \"Mapped To\" column."); keyRemapInfoExample.Text(GET_RESOURCE_STRING(IDS_EDITKEYBOARD_INFOEXAMPLE));
keyRemapInfoExample.Margin({ 10, 0, 0, 20 }); keyRemapInfoExample.Margin({ 10, 0, 0, 20 });
keyRemapInfoExample.FontStyle(Text::FontStyle::Italic); keyRemapInfoExample.FontStyle(Text::FontStyle::Italic);
keyRemapInfoExample.TextWrapping(TextWrapping::Wrap); keyRemapInfoExample.TextWrapping(TextWrapping::Wrap);
@@ -217,13 +219,13 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
// First header textblock in the header row of the keys remap table // First header textblock in the header row of the keys remap table
TextBlock originalKeyRemapHeader; TextBlock originalKeyRemapHeader;
originalKeyRemapHeader.Text(L"Key:"); originalKeyRemapHeader.Text(GET_RESOURCE_STRING(IDS_EDITKEYBOARD_SOURCEHEADER));
originalKeyRemapHeader.FontWeight(Text::FontWeights::Bold()); originalKeyRemapHeader.FontWeight(Text::FontWeights::Bold());
originalKeyRemapHeader.Margin({ 0, 0, 0, 10 }); originalKeyRemapHeader.Margin({ 0, 0, 0, 10 });
// Second header textblock in the header row of the keys remap table // Second header textblock in the header row of the keys remap table
TextBlock newKeyRemapHeader; TextBlock newKeyRemapHeader;
newKeyRemapHeader.Text(L"Mapped To:"); newKeyRemapHeader.Text(GET_RESOURCE_STRING(IDS_EDITKEYBOARD_TARGETHEADER));
newKeyRemapHeader.FontWeight(Text::FontWeights::Bold()); newKeyRemapHeader.FontWeight(Text::FontWeights::Bold());
newKeyRemapHeader.Margin({ 0, 0, 0, 10 }); newKeyRemapHeader.Margin({ 0, 0, 0, 10 });
@@ -261,7 +263,7 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
// Main Header Apply button // Main Header Apply button
Button applyButton; Button applyButton;
applyButton.Content(winrt::box_value(L"OK")); applyButton.Content(winrt::box_value(GET_RESOURCE_STRING(IDS_OK_BUTTON)));
applyButton.Style(AccentButtonStyle()); applyButton.Style(AccentButtonStyle());
applyButton.MinWidth(KeyboardManagerConstants::HeaderButtonWidth); applyButton.MinWidth(KeyboardManagerConstants::HeaderButtonWidth);
cancelButton.MinWidth(KeyboardManagerConstants::HeaderButtonWidth); cancelButton.MinWidth(KeyboardManagerConstants::HeaderButtonWidth);

View File

@@ -11,7 +11,9 @@
#include "Dialog.h" #include "Dialog.h"
#include <keyboardmanager/dll/resource.h> #include <keyboardmanager/dll/resource.h>
#include <keyboardmanager/common/KeyboardManagerState.h> #include <keyboardmanager/common/KeyboardManagerState.h>
#include "common/common.h"
#include "LoadingAndSavingRemappingHelper.h" #include "LoadingAndSavingRemappingHelper.h"
extern "C" IMAGE_DOS_HEADER __ImageBase;
using namespace winrt::Windows::Foundation; using namespace winrt::Windows::Foundation;
@@ -36,7 +38,7 @@ static IAsyncAction OnClickAccept(
if (isSuccess != KeyboardManagerHelper::ErrorType::NoError) if (isSuccess != KeyboardManagerHelper::ErrorType::NoError)
{ {
if (!co_await Dialog::PartialRemappingConfirmationDialog(root, L"Some of the shortcuts could not be remapped. Do you want to continue anyway?")) if (!co_await Dialog::PartialRemappingConfirmationDialog(root, GET_RESOURCE_STRING(IDS_EDITSHORTCUTS_PARTIALCONFIRMATIONDIALOGTITLE)))
{ {
co_return; co_return;
} }
@@ -67,7 +69,7 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
if (RegisterClassEx(&windowClass) == NULL) if (RegisterClassEx(&windowClass) == NULL)
{ {
MessageBox(NULL, L"Windows registration failed!", L"Error", NULL); MessageBox(NULL, GET_RESOURCE_STRING(IDS_REGISTERCLASSFAILED_ERRORMESSAGE).c_str(), GET_RESOURCE_STRING(IDS_REGISTERCLASSFAILED_ERRORTITLE).c_str(), NULL);
return; return;
} }
@@ -85,7 +87,7 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
// Window Creation // Window Creation
HWND _hWndEditShortcutsWindow = CreateWindow( HWND _hWndEditShortcutsWindow = CreateWindow(
szWindowClass, szWindowClass,
L"Remap shortcuts", GET_RESOURCE_STRING(IDS_EDITSHORTCUTS_WINDOWNAME).c_str(),
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MAXIMIZEBOX, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MAXIMIZEBOX,
(desktopRect.right / 2) - (windowWidth / 2), (desktopRect.right / 2) - (windowWidth / 2),
(desktopRect.bottom / 2) - (windowHeight / 2), (desktopRect.bottom / 2) - (windowHeight / 2),
@@ -97,7 +99,7 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
NULL); NULL);
if (_hWndEditShortcutsWindow == NULL) if (_hWndEditShortcutsWindow == NULL)
{ {
MessageBox(NULL, L"Call to CreateWindow failed!", L"Error", NULL); MessageBox(NULL, GET_RESOURCE_STRING(IDS_CREATEWINDOWFAILED_ERRORMESSAGE).c_str(), GET_RESOURCE_STRING(IDS_CREATEWINDOWFAILED_ERRORTITLE).c_str(), NULL);
return; return;
} }
// Ensures the window is in foreground on first startup. If this is not done, the window appears behind because the thread is not on the foreground. // Ensures the window is in foreground on first startup. If this is not done, the window appears behind because the thread is not on the foreground.
@@ -127,14 +129,14 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
// Header text // Header text
TextBlock headerText; TextBlock headerText;
headerText.Text(L"Remap shortcuts"); headerText.Text(GET_RESOURCE_STRING(IDS_EDITSHORTCUTS_WINDOWNAME));
headerText.FontSize(30); headerText.FontSize(30);
headerText.Margin({ 0, 0, 0, 0 }); headerText.Margin({ 0, 0, 0, 0 });
header.SetAlignLeftWithPanel(headerText, true); header.SetAlignLeftWithPanel(headerText, true);
// Cancel button // Cancel button
Button cancelButton; Button cancelButton;
cancelButton.Content(winrt::box_value(L"Cancel")); cancelButton.Content(winrt::box_value(GET_RESOURCE_STRING(IDS_CANCEL_BUTTON)));
cancelButton.Margin({ 10, 0, 0, 0 }); cancelButton.Margin({ 10, 0, 0, 0 });
cancelButton.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { cancelButton.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
// Close the window since settings do not need to be saved // Close the window since settings do not need to be saved
@@ -143,13 +145,13 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
// Text block for information about remap key section. // Text block for information about remap key section.
TextBlock shortcutRemapInfoHeader; TextBlock shortcutRemapInfoHeader;
shortcutRemapInfoHeader.Text(L"Select the shortcut you want to change (Shortcut) and then the key or shortcut you want it to invoke (Mapped To)."); shortcutRemapInfoHeader.Text(GET_RESOURCE_STRING(IDS_EDITSHORTCUTS_INFO));
shortcutRemapInfoHeader.Margin({ 10, 0, 0, 10 }); shortcutRemapInfoHeader.Margin({ 10, 0, 0, 10 });
shortcutRemapInfoHeader.FontWeight(Text::FontWeights::SemiBold()); shortcutRemapInfoHeader.FontWeight(Text::FontWeights::SemiBold());
shortcutRemapInfoHeader.TextWrapping(TextWrapping::Wrap); shortcutRemapInfoHeader.TextWrapping(TextWrapping::Wrap);
TextBlock shortcutRemapInfoExample; TextBlock shortcutRemapInfoExample;
shortcutRemapInfoExample.Text(L"For example, if you want to press \"Ctrl+C\" and get \"Alt\" only on Microsoft Edge, \"Ctrl+C\" would be your \"Shortcut\" column, the key \"Alt\" would be your \"Mapped To\" column, and \"MSEdge\" would be your \"Target App\" column. If no target app is entered, it will apply globally. The name must be the process name and not the app name."); shortcutRemapInfoExample.Text(GET_RESOURCE_STRING(IDS_EDITSHORTCUTS_INFOEXAMPLE));
shortcutRemapInfoExample.Margin({ 10, 0, 0, 20 }); shortcutRemapInfoExample.Margin({ 10, 0, 0, 20 });
shortcutRemapInfoExample.FontStyle(Text::FontStyle::Italic); shortcutRemapInfoExample.FontStyle(Text::FontStyle::Italic);
shortcutRemapInfoExample.TextWrapping(TextWrapping::Wrap); shortcutRemapInfoExample.TextWrapping(TextWrapping::Wrap);
@@ -180,19 +182,19 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
// First header textblock in the header row of the shortcut table // First header textblock in the header row of the shortcut table
TextBlock originalShortcutHeader; TextBlock originalShortcutHeader;
originalShortcutHeader.Text(L"Shortcut:"); originalShortcutHeader.Text(GET_RESOURCE_STRING(IDS_EDITSHORTCUTS_SOURCEHEADER));
originalShortcutHeader.FontWeight(Text::FontWeights::Bold()); originalShortcutHeader.FontWeight(Text::FontWeights::Bold());
originalShortcutHeader.Margin({ 0, 0, 0, 10 }); originalShortcutHeader.Margin({ 0, 0, 0, 10 });
// Second header textblock in the header row of the shortcut table // Second header textblock in the header row of the shortcut table
TextBlock newShortcutHeader; TextBlock newShortcutHeader;
newShortcutHeader.Text(L"Mapped To:"); newShortcutHeader.Text(GET_RESOURCE_STRING(IDS_EDITSHORTCUTS_TARGETHEADER));
newShortcutHeader.FontWeight(Text::FontWeights::Bold()); newShortcutHeader.FontWeight(Text::FontWeights::Bold());
newShortcutHeader.Margin({ 0, 0, 0, 10 }); newShortcutHeader.Margin({ 0, 0, 0, 10 });
// Third header textblock in the header row of the shortcut table // Third header textblock in the header row of the shortcut table
TextBlock targetAppHeader; TextBlock targetAppHeader;
targetAppHeader.Text(L"Target App:"); targetAppHeader.Text(GET_RESOURCE_STRING(IDS_EDITSHORTCUTS_TARGETAPPHEADER));
targetAppHeader.Width(KeyboardManagerConstants::ShortcutTableDropDownWidth); targetAppHeader.Width(KeyboardManagerConstants::ShortcutTableDropDownWidth);
targetAppHeader.FontWeight(Text::FontWeights::Bold()); targetAppHeader.FontWeight(Text::FontWeights::Bold());
targetAppHeader.Margin({ 0, 0, 0, 10 }); targetAppHeader.Margin({ 0, 0, 0, 10 });
@@ -245,7 +247,7 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
// Apply button // Apply button
Button applyButton; Button applyButton;
applyButton.Content(winrt::box_value(L"OK")); applyButton.Content(winrt::box_value(GET_RESOURCE_STRING(IDS_OK_BUTTON)));
applyButton.Style(AccentButtonStyle()); applyButton.Style(AccentButtonStyle());
applyButton.MinWidth(KeyboardManagerConstants::HeaderButtonWidth); applyButton.MinWidth(KeyboardManagerConstants::HeaderButtonWidth);
cancelButton.MinWidth(KeyboardManagerConstants::HeaderButtonWidth); cancelButton.MinWidth(KeyboardManagerConstants::HeaderButtonWidth);

View File

@@ -3,6 +3,9 @@
#include "KeyDropDownControl.h" #include "KeyDropDownControl.h"
#include "keyboardmanager/common/KeyboardManagerState.h" #include "keyboardmanager/common/KeyboardManagerState.h"
#include "keyboardmanager/common/Helpers.h" #include "keyboardmanager/common/Helpers.h"
#include "common/common.h"
#include "keyboardmanager/dll/resource.h"
extern "C" IMAGE_DOS_HEADER __ImageBase;
//Both static members are initialized to null //Both static members are initialized to null
HWND ShortcutControl::EditShortcutsWindowHandle = nullptr; HWND ShortcutControl::EditShortcutsWindowHandle = nullptr;
@@ -20,7 +23,7 @@ ShortcutControl::ShortcutControl(Grid table, const int colIndex, TextBox targetA
shortcutDropDownStackPanel.as<StackPanel>().Spacing(KeyboardManagerConstants::ShortcutTableDropDownSpacing); shortcutDropDownStackPanel.as<StackPanel>().Spacing(KeyboardManagerConstants::ShortcutTableDropDownSpacing);
shortcutDropDownStackPanel.as<StackPanel>().Orientation(Windows::UI::Xaml::Controls::Orientation::Horizontal); shortcutDropDownStackPanel.as<StackPanel>().Orientation(Windows::UI::Xaml::Controls::Orientation::Horizontal);
typeShortcut.as<Button>().Content(winrt::box_value(L"Type")); typeShortcut.as<Button>().Content(winrt::box_value(GET_RESOURCE_STRING(IDS_TYPE_BUTTON)));
typeShortcut.as<Button>().Width(KeyboardManagerConstants::ShortcutTableDropDownWidth); typeShortcut.as<Button>().Width(KeyboardManagerConstants::ShortcutTableDropDownWidth);
typeShortcut.as<Button>().Click([&, table, colIndex, isHybridControl, targetApp](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { typeShortcut.as<Button>().Click([&, table, colIndex, isHybridControl, targetApp](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
keyboardManagerState->SetUIState(KeyboardManagerUIState::DetectShortcutWindowActivated, EditShortcutsWindowHandle); keyboardManagerState->SetUIState(KeyboardManagerUIState::DetectShortcutWindowActivated, EditShortcutsWindowHandle);
@@ -210,7 +213,7 @@ void ShortcutControl::createDetectShortcutWindow(winrt::Windows::Foundation::IIn
// ContentDialog requires manually setting the XamlRoot (https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands) // ContentDialog requires manually setting the XamlRoot (https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands)
detectShortcutBox.XamlRoot(xamlRoot); detectShortcutBox.XamlRoot(xamlRoot);
detectShortcutBox.Title(box_value(L"Press the keys in shortcut:")); detectShortcutBox.Title(box_value(GET_RESOURCE_STRING(IDS_TYPESHORTCUT_TITLE)));
detectShortcutBox.IsPrimaryButtonEnabled(false); detectShortcutBox.IsPrimaryButtonEnabled(false);
detectShortcutBox.IsSecondaryButtonEnabled(false); detectShortcutBox.IsSecondaryButtonEnabled(false);
@@ -280,7 +283,7 @@ void ShortcutControl::createDetectShortcutWindow(winrt::Windows::Foundation::IIn
}; };
TextBlock primaryButtonText; TextBlock primaryButtonText;
primaryButtonText.Text(L"OK"); primaryButtonText.Text(GET_RESOURCE_STRING(IDS_OK_BUTTON));
Button primaryButton; Button primaryButton;
primaryButton.HorizontalAlignment(HorizontalAlignment::Stretch); primaryButton.HorizontalAlignment(HorizontalAlignment::Stretch);
@@ -309,7 +312,7 @@ void ShortcutControl::createDetectShortcutWindow(winrt::Windows::Foundation::IIn
}); });
TextBlock cancelButtonText; TextBlock cancelButtonText;
cancelButtonText.Text(L"Cancel"); cancelButtonText.Text(GET_RESOURCE_STRING(IDS_CANCEL_BUTTON));
Button cancelButton; Button cancelButton;
cancelButton.HorizontalAlignment(HorizontalAlignment::Stretch); cancelButton.HorizontalAlignment(HorizontalAlignment::Stretch);
@@ -364,7 +367,7 @@ void ShortcutControl::createDetectShortcutWindow(winrt::Windows::Foundation::IIn
// Header textblock // Header textblock
TextBlock text; TextBlock text;
text.Text(L"Keys Pressed:"); text.Text(GET_RESOURCE_STRING(IDS_TYPESHORTCUT_HEADER));
text.Margin({ 0, 0, 0, 10 }); text.Margin({ 0, 0, 0, 10 });
stackPanel.Children().Append(text); stackPanel.Children().Append(text);
@@ -381,13 +384,13 @@ void ShortcutControl::createDetectShortcutWindow(winrt::Windows::Foundation::IIn
stackPanel.Children().Append(keyStackPanel2); stackPanel.Children().Append(keyStackPanel2);
TextBlock holdEscInfo; TextBlock holdEscInfo;
holdEscInfo.Text(L"Hold Esc to discard"); holdEscInfo.Text(GET_RESOURCE_STRING(IDS_TYPE_HOLDESC));
holdEscInfo.FontSize(12); holdEscInfo.FontSize(12);
holdEscInfo.Margin({ 0, 20, 0, 0 }); holdEscInfo.Margin({ 0, 20, 0, 0 });
stackPanel.Children().Append(holdEscInfo); stackPanel.Children().Append(holdEscInfo);
TextBlock holdEnterInfo; TextBlock holdEnterInfo;
holdEnterInfo.Text(L"Hold Enter to continue"); holdEnterInfo.Text(GET_RESOURCE_STRING(IDS_TYPE_HOLDENTER));
holdEnterInfo.FontSize(12); holdEnterInfo.FontSize(12);
holdEnterInfo.Margin({ 0, 0, 0, 0 }); holdEnterInfo.Margin({ 0, 0, 0, 0 });
stackPanel.Children().Append(holdEnterInfo); stackPanel.Children().Append(holdEnterInfo);

View File

@@ -4,6 +4,9 @@
#include "keyboardmanager/common/KeyboardManagerConstants.h" #include "keyboardmanager/common/KeyboardManagerConstants.h"
#include "keyboardmanager/common/KeyboardManagerState.h" #include "keyboardmanager/common/KeyboardManagerState.h"
#include "ShortcutControl.h" #include "ShortcutControl.h"
#include "common/common.h"
#include "keyboardmanager/dll/resource.h"
extern "C" IMAGE_DOS_HEADER __ImageBase;
//Both static members are initialized to null //Both static members are initialized to null
HWND SingleKeyRemapControl::EditKeyboardWindowHandle = nullptr; HWND SingleKeyRemapControl::EditKeyboardWindowHandle = nullptr;
@@ -15,7 +18,7 @@ SingleKeyRemapControl::SingleKeyRemapControl(Grid table, const int colIndex)
{ {
typeKey = Button(); typeKey = Button();
typeKey.as<Button>().Width(KeyboardManagerConstants::RemapTableDropDownWidth); typeKey.as<Button>().Width(KeyboardManagerConstants::RemapTableDropDownWidth);
typeKey.as<Button>().Content(winrt::box_value(L"Type")); typeKey.as<Button>().Content(winrt::box_value(GET_RESOURCE_STRING(IDS_TYPE_BUTTON)));
singleKeyRemapControlLayout = StackPanel(); singleKeyRemapControlLayout = StackPanel();
singleKeyRemapControlLayout.as<StackPanel>().Margin({ 0, 0, 0, 10 }); singleKeyRemapControlLayout.as<StackPanel>().Margin({ 0, 0, 0, 10 });
@@ -176,7 +179,7 @@ void SingleKeyRemapControl::createDetectKeyWindow(winrt::Windows::Foundation::II
// ContentDialog requires manually setting the XamlRoot (https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands) // ContentDialog requires manually setting the XamlRoot (https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands)
detectRemapKeyBox.XamlRoot(xamlRoot); detectRemapKeyBox.XamlRoot(xamlRoot);
detectRemapKeyBox.Title(box_value(L"Press a key on selected keyboard:")); detectRemapKeyBox.Title(box_value(GET_RESOURCE_STRING(IDS_TYPEKEY_TITLE)));
detectRemapKeyBox.IsPrimaryButtonEnabled(false); detectRemapKeyBox.IsPrimaryButtonEnabled(false);
detectRemapKeyBox.IsSecondaryButtonEnabled(false); detectRemapKeyBox.IsSecondaryButtonEnabled(false);
@@ -228,7 +231,7 @@ void SingleKeyRemapControl::createDetectKeyWindow(winrt::Windows::Foundation::II
}; };
TextBlock primaryButtonText; TextBlock primaryButtonText;
primaryButtonText.Text(L"OK"); primaryButtonText.Text(GET_RESOURCE_STRING(IDS_OK_BUTTON));
Button primaryButton; Button primaryButton;
primaryButton.HorizontalAlignment(HorizontalAlignment::Stretch); primaryButton.HorizontalAlignment(HorizontalAlignment::Stretch);
@@ -255,7 +258,7 @@ void SingleKeyRemapControl::createDetectKeyWindow(winrt::Windows::Foundation::II
}); });
TextBlock cancelButtonText; TextBlock cancelButtonText;
cancelButtonText.Text(L"Cancel"); cancelButtonText.Text(GET_RESOURCE_STRING(IDS_CANCEL_BUTTON));
Button cancelButton; Button cancelButton;
cancelButton.HorizontalAlignment(HorizontalAlignment::Stretch); cancelButton.HorizontalAlignment(HorizontalAlignment::Stretch);
@@ -294,7 +297,7 @@ void SingleKeyRemapControl::createDetectKeyWindow(winrt::Windows::Foundation::II
// Header textblock // Header textblock
TextBlock text; TextBlock text;
text.Text(L"Key Pressed:"); text.Text(GET_RESOURCE_STRING(IDS_TYPEKEY_HEADER));
text.Margin({ 0, 0, 0, 10 }); text.Margin({ 0, 0, 0, 10 });
stackPanel.Children().Append(text); stackPanel.Children().Append(text);
@@ -304,13 +307,13 @@ void SingleKeyRemapControl::createDetectKeyWindow(winrt::Windows::Foundation::II
stackPanel.Children().Append(keyStackPanel); stackPanel.Children().Append(keyStackPanel);
TextBlock holdEscInfo; TextBlock holdEscInfo;
holdEscInfo.Text(L"Hold Esc to discard"); holdEscInfo.Text(GET_RESOURCE_STRING(IDS_TYPE_HOLDESC));
holdEscInfo.FontSize(12); holdEscInfo.FontSize(12);
holdEscInfo.Margin({ 0, 20, 0, 0 }); holdEscInfo.Margin({ 0, 20, 0, 0 });
stackPanel.Children().Append(holdEscInfo); stackPanel.Children().Append(holdEscInfo);
TextBlock holdEnterInfo; TextBlock holdEnterInfo;
holdEnterInfo.Text(L"Hold Enter to continue"); holdEnterInfo.Text(GET_RESOURCE_STRING(IDS_TYPE_HOLDENTER));
holdEnterInfo.FontSize(12); holdEnterInfo.FontSize(12);
holdEnterInfo.Margin({ 0, 0, 0, 0 }); holdEnterInfo.Margin({ 0, 0, 0, 0 });
stackPanel.Children().Append(holdEnterInfo); stackPanel.Children().Append(holdEnterInfo);