-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading spinner #684
Loading spinner #684
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few bad patterns I found which you should check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Only one minor change request.
I answered the TODO questions. You can replace the TODO comments accordingly.
10730fd
to
4481719
Compare
This implements a loading spinner, intended to be displayed for long-running operations.
The spinner is displayed in the upper left corner of the screen (as the other corners are already occupied) – if there is more than one long-running process active, a small number will be displayed indicating how many processes are currently running. Hovering over the spinner yields a tooltip containing a short message describing the running processes.
Usage
The loading spinner can be accessed via static methods. A short, and especially a unique message should be passed to the
Show
method – this is what's shown to the user.This message is used to identify the loading process, and is later used to hide the spinner again once the process has completed running. If no message is passed to
Show
, a random one will be generated to ensure uniqueness.Recommended method
Alternative: Using the
IDisposable
Alternative: Using the message
Additional changes
RunOnMainThread
has been implemented by request of @Leon2796. When called from the thread pool, it switches to the main thread only for the given action. This is useful because certain methods and properties are not accessible from the thread pool.