Thread.Sleep(int32) not working? Send Help [Answered]
So it goes like this
- the basic color
- 1st click on the button assigned - color goes green (succeeded)
- 2nd click - color stays green (success again) When it should flash for 0.25 to the basic color then go green
I want to make something aka flashy event for the label with text "upgrade succeeded/failed" so when you get 2x upgrade in a row you get that little visual information that it actually tried the upgrading instead of the color being green all time
What am i missing?
10 Replies
I think the problem is you're sleeping on the UI thread, you should make the method async and then
await Thread.Sleep(250);
You mean
await Task.Delay(250);
?well i can't make async void
i'll try it in a sec
@thinker227 then i can't use it as an OnClick event for the button
yep sorry, brain scrambles
Warning CS4014 Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
why's that? admittedly been a while since I've used winforms (assuming that's what you're working in) but not finding anything that says callbacks can't be async
winforms .net framwork 4.7.2
w8
im dumb
works
thank you XD
👍
final version
✅ This post has been marked as answered!