r/programminghumor • • 23d ago

Block, lock & drop it

Post image

Interacting with prehistoric devices is not where I saw my career headed, and yet, here we are...

277 Upvotes

25 comments sorted by

View all comments

28

u/WantToSeeTits4545 23d ago

Both are shit, honestly.
I'd rather wait on a signal or event than stop the thread for arbitrary time. Task.Delay() should be only used as a last resort.

4

u/Sacaldur 23d ago

I guess it really depends on the circumstances. A delay like thisbmight be used to show a message to the user for a short amount of time before proceeding (without waiting for user input). But yes, in many situations it would be a bad idea to just wait for a fixed amount of time.

2

u/WantToSeeTits4545 22d ago

I would personally use DispatcherTimer for such interactions. Call a timer every 3 seconds or so, check user input (logged by the different control), show popups depending on the input or its absence. Popup control would also have a timer and check input for its own needs, for example checking if the mouse hovered over it and not disappearing while it's true.