I have a method UploadReportNotifier() which is subscribed to an event, which is raised once i have finished uploading data to a database. In UploadReportNotifier() i want to reset some values on my GUI, ie progressbars etc, but i want there to be a time delay between doing this.
Is it possible to create a thread inside UploadReportNotifier() and call thread.Sleep, or is the timer() class more appropriate?
Thanks for your help.
I see you have found your solution. I just want to mention that in this situation you should always choose timers over
Thread+Sleep, which imo is just an ugly hack that should be avoided always.Timers are great because they are also capable of executing their code on the GUI thread, so you don’t need to use
InvokeorBeginInvoke. For exampleSystem.Windows.Forms.Timerfor WinForms orSystem.Windows.Threading.DispatcherTimerfor WPF.