mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 18:29:24 +08:00
Move KBM warnings at Apply to Flyouts (#2237)
* Moved warning to Flyout * Fixed formatting
This commit is contained in:
parent
325db535c0
commit
ddf800de10
@ -137,7 +137,9 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
|
||||
keyRemapTable.Children().Append(tableHeaderRow);
|
||||
|
||||
// Message to display success/failure of saving settings.
|
||||
Flyout applyFlyout;
|
||||
TextBlock settingsMessage;
|
||||
applyFlyout.Content(settingsMessage);
|
||||
|
||||
// Store handle of edit keyboard window
|
||||
SingleKeyRemapControl::EditKeyboardWindowHandle = _hWndEditKeyboardWindow;
|
||||
@ -162,6 +164,7 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
|
||||
applyButton.Background(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::LightGray() });
|
||||
applyButton.Foreground(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::Black() });
|
||||
applyButton.Content(winrt::box_value(winrt::to_hstring("Apply")));
|
||||
applyButton.Flyout(applyFlyout);
|
||||
applyButton.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
|
||||
bool isSuccess = true;
|
||||
// Clear existing Key Remaps
|
||||
@ -191,25 +194,21 @@ void createEditKeyboardWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMan
|
||||
|
||||
if (isSuccess && saveResult)
|
||||
{
|
||||
settingsMessage.Foreground(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::Green() });
|
||||
settingsMessage.Text(winrt::to_hstring("Remapping successful!"));
|
||||
settingsMessage.Text(winrt::to_hstring("Remapping successful"));
|
||||
}
|
||||
else if (!isSuccess && saveResult)
|
||||
{
|
||||
settingsMessage.Foreground(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::Red() });
|
||||
settingsMessage.Text(winrt::to_hstring("All remappings were not successfully applied."));
|
||||
settingsMessage.Text(winrt::to_hstring("All remappings were not successfully applied"));
|
||||
}
|
||||
else
|
||||
{
|
||||
settingsMessage.Foreground(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::Red() });
|
||||
settingsMessage.Text(winrt::to_hstring("Failed to save the remappings."));
|
||||
settingsMessage.Text(L"Failed to save the remappings.");
|
||||
}
|
||||
});
|
||||
|
||||
header.Children().Append(headerText);
|
||||
header.Children().Append(cancelButton);
|
||||
header.Children().Append(applyButton);
|
||||
header.Children().Append(settingsMessage);
|
||||
|
||||
// Add remap key button
|
||||
Windows::UI::Xaml::Controls::Button addRemapKey;
|
||||
|
@ -128,7 +128,9 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
|
||||
shortcutTable.Children().Append(tableHeaderRow);
|
||||
|
||||
// Message to display success/failure of saving settings.
|
||||
Flyout applyFlyout;
|
||||
TextBlock settingsMessage;
|
||||
applyFlyout.Content(settingsMessage);
|
||||
|
||||
// Store handle of edit shortcuts window
|
||||
ShortcutControl::EditShortcutsWindowHandle = _hWndEditShortcutsWindow;
|
||||
@ -151,6 +153,7 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
|
||||
// Apply button
|
||||
Button applyButton;
|
||||
applyButton.Content(winrt::box_value(winrt::to_hstring("Apply")));
|
||||
applyButton.Flyout(applyFlyout);
|
||||
applyButton.Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) {
|
||||
bool isSuccess = true;
|
||||
// Clear existing shortcuts
|
||||
@ -181,18 +184,15 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
|
||||
|
||||
if (isSuccess && saveResult)
|
||||
{
|
||||
settingsMessage.Foreground(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::Green() });
|
||||
settingsMessage.Text(winrt::to_hstring("Remapping successful!"));
|
||||
}
|
||||
else if (!isSuccess && saveResult)
|
||||
{
|
||||
settingsMessage.Foreground(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::Red() });
|
||||
settingsMessage.Text(winrt::to_hstring("All remappings were not successfully applied."));
|
||||
}
|
||||
else
|
||||
{
|
||||
settingsMessage.Foreground(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::Red() });
|
||||
settingsMessage.Text(winrt::to_hstring("Failed to save the remappings."));
|
||||
settingsMessage.Text(L"Failed to save the remappings.");
|
||||
}
|
||||
});
|
||||
|
||||
@ -259,7 +259,7 @@ LRESULT CALLBACK EditShortcutsWindowProc(HWND hWnd, UINT messageCode, WPARAM wPa
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CheckEditShortcutsWindowActive()
|
||||
bool CheckEditShortcutsWindowActive()
|
||||
{
|
||||
bool result = false;
|
||||
std::unique_lock<std::mutex> hwndLock(editShortcutsWindowMutex);
|
||||
|
Loading…
Reference in New Issue
Block a user