Skip to content

Conversation

bengavin
Copy link

@bengavin bengavin commented Jun 6, 2024

This updates the library to support binding to the 'Preview' events on Windows. It also works around a bug where the behavior can be attached multiple times to the same bindable without intervening Detached events [currently a bug in the CommunityToolkit PopupService, see: https://github.com/CommunityToolkit/Maui/issues/1912 ].

Also does some general cleanup:

  • Removal of unused classes
  • KeyboardKeys is NOT a set of flags, so don't treat it as such
  • Naming/etc cleanup, pull things internal that shouldn't be exposed by the library

@davidortinau davidortinau requested a review from Copilot April 9, 2025 19:10
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/Plugin.Maui.KeyListener/KeyboardKeysExtensions.cs:41

  • [nitpick] The mapping for KeyboardKeys.N returns an uppercase 'N' while most mappings use lowercase letters; it might be more consistent to return 'n' unless the uppercase is intentional.
KeyboardKeys.N => 'N',

Comment on lines +15 to 16
private List<Guid> _boundIds = [Guid.Empty];

Copy link

Copilot AI Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initialization of _boundIds using [Guid.Empty] is not valid C# syntax; consider changing it to 'new List { Guid.Empty }' if the intention is to start with a default value, or initialize an empty list if no default is required.

Suggested change
private List<Guid> _boundIds = [Guid.Empty];
private List<Guid> _boundIds = new List<Guid> { Guid.Empty };

Copilot uses AI. Check for mistakes.

@PureWeen
Copy link
Collaborator

@bengavin I realize it's been a bit here

But what's the motivation for wiring into Preview events? What problem are you solving here?

@bengavin
Copy link
Author

@bengavin I realize it's been a bit here

But what's the motivation for wiring into Preview events? What problem are you solving here?

In our case we needed to capture input from a barcode scanner without having the user need to have focus on an input field. The preview events seemed to be the only way on windows to accomplish this, and it was still relatively unreliable if the screen was clicked on in an area that also handled keyboard events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants