mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[AdvancedPaste] Custom Actions (#34395)
* [AdvancedPaste] Custom Actions * Renamed pipe name to make spellcheck happy * Improved settings page for Custom Actions * UI improvements, disabled standard paste actions when no clipboard text, update clipboard text and gpo state every second * Bug fixes, single query/prompt box, Ctrl+num shortcuts for custom actions, error box * Spellcheck issue * Bug fixes and used Advanced Paste Window as wait indicator for keyboard shortcuts * Improvements to PromptBox, incluing show error message as tooltip * Refactoring * Fixed issue where ESC sometimes didn't close paste window * Update src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> --------- Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
This commit is contained in:
@@ -115,13 +115,9 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
internalSettings = new HotkeySettings();
|
||||
|
||||
this.Unloaded += ShortcutControl_Unloaded;
|
||||
hook = new HotkeySettingsControlHook(Hotkey_KeyDown, Hotkey_KeyUp, Hotkey_IsActive, FilterAccessibleKeyboardEvents);
|
||||
var resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader;
|
||||
this.Loaded += ShortcutControl_Loaded;
|
||||
|
||||
if (App.GetSettingsWindow() != null)
|
||||
{
|
||||
App.GetSettingsWindow().Activated += ShortcutDialog_SettingsWindow_Activated;
|
||||
}
|
||||
var resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader;
|
||||
|
||||
// We create the Dialog in C# because doing it in XAML is giving WinUI/XAML Island bugs when using dark theme.
|
||||
shortcutDialog = new ContentDialog
|
||||
@@ -134,11 +130,9 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
CloseButtonText = resourceLoader.GetString("Activation_Shortcut_Cancel"),
|
||||
DefaultButton = ContentDialogButton.Primary,
|
||||
};
|
||||
shortcutDialog.PrimaryButtonClick += ShortcutDialog_PrimaryButtonClick;
|
||||
shortcutDialog.SecondaryButtonClick += ShortcutDialog_Reset;
|
||||
shortcutDialog.RightTapped += ShortcutDialog_Disable;
|
||||
shortcutDialog.Opened += ShortcutDialog_Opened;
|
||||
shortcutDialog.Closing += ShortcutDialog_Closing;
|
||||
|
||||
AutomationProperties.SetName(EditButton, resourceLoader.GetString("Activation_Shortcut_Title"));
|
||||
|
||||
OnAllowDisableChanged(this, null);
|
||||
@@ -156,14 +150,28 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
}
|
||||
|
||||
// Dispose the HotkeySettingsControlHook object to terminate the hook threads when the textbox is unloaded
|
||||
if (hook != null)
|
||||
{
|
||||
hook.Dispose();
|
||||
}
|
||||
hook?.Dispose();
|
||||
|
||||
hook = null;
|
||||
}
|
||||
|
||||
private void ShortcutControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// These all belong here; because of virtualization in e.g. a ListView, the control can go through several Loaded / Unloaded cycles.
|
||||
hook?.Dispose();
|
||||
|
||||
hook = new HotkeySettingsControlHook(Hotkey_KeyDown, Hotkey_KeyUp, Hotkey_IsActive, FilterAccessibleKeyboardEvents);
|
||||
|
||||
shortcutDialog.PrimaryButtonClick += ShortcutDialog_PrimaryButtonClick;
|
||||
shortcutDialog.Opened += ShortcutDialog_Opened;
|
||||
shortcutDialog.Closing += ShortcutDialog_Closing;
|
||||
|
||||
if (App.GetSettingsWindow() != null)
|
||||
{
|
||||
App.GetSettingsWindow().Activated += ShortcutDialog_SettingsWindow_Activated;
|
||||
}
|
||||
}
|
||||
|
||||
private void KeyEventHandler(int key, bool matchValue, int matchValueCode)
|
||||
{
|
||||
VirtualKey virtualKey = (VirtualKey)key;
|
||||
|
||||
Reference in New Issue
Block a user