Fix: Disable duplicate shortcut keys#1224
Fix: Disable duplicate shortcut keys#1224ChenYiLins wants to merge 3 commits intoAutoDarkMode:v11.1from
Conversation
| shortcutDialog.Closing += (dialog, args) => | ||
| { | ||
| if (args.Result == ContentDialogResult.Primary) | ||
| { | ||
| var (isDuplicate, conflictingName) = ViewModel.IsDuplicateHotkey(hotkeyData.Tag, dialogContent.CapturedHotkeys); | ||
| if (isDuplicate) |
There was a problem hiding this comment.
Can we move this to the "changed" OnKeyboardEvent event, for immediate display? Similar to the check for a "valid" hotkey.
There was a problem hiding this comment.
Done. (By the way, I used delegation to realize this function, but it also led to the problem of higher code coupling, but I really couldn't think of a better solution, because the key information was saved in the ViewModel of the page, which had nothing to do with ShortcutDialogContentControl, but the InfoBar of error information was in ShortcutDialogContentControl)
There was a problem hiding this comment.
I actually don't like the OnKeyboardEvent for the new addition of showing that only modifier keys aren't allowed. Now as soon the user presses one button (for example ctrl) he sees a red message. I think its irritating, even though it's only for one second.
So at least for the Key Modifier warning, it should only appear if the shortcut dialog wants to close.
Really good and important additions, thanks. |



Description
Before, we allowed multiple shortcuts to use the same shortcut key. This PR improves this problem. Now when you try to save the same shortcut key, an error message will pop up and you can't save it.
Sloved #1146.
Screenshots