Skip to content
Discussion options

You must be logged in to vote

Hi! Thanks for using SharpHook!

It looks like a problem with threads. You see, when you call RunAsync on a TaskPoolGlobalHook (or SimpleGlobalHook) it will start a new thread and run the global hook there. In case of SimpleGlobalHook, all event handlers will also run in that same new thread. In case of TaskPoolGlobalHook, the event handlers will run on some thread in the thread pool for Task objects. Sounds difficult to someone who's new to this, but you don't have to dive into details. All you have to know is that if you want to update the UI in MAUI (or any other UI framework for .NET) you'll have to do that in the main thread. You can use the MainThread class for this.

Your code will t…

Replies: 2 comments 18 replies

Comment options

You must be logged in to vote
1 reply
@submarines414
Comment options

Answer selected by submarines414
Comment options

You must be logged in to vote
17 replies
@TolikPylypchuk
Comment options

@headintheclouds21
Comment options

@TolikPylypchuk
Comment options

@TolikPylypchuk
Comment options

@headintheclouds21
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants