FxCop error: Do not use Timers that prevent power state changes

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,081
Programming Experience
10+
Apparently, Timers with an interval of less than 1 second are discouraged. How would you thus arrange a form to fade in and out, without using timers?

I'm considering a backgroundworker that reports progress, the job the worker must do is either fadein or fadeout, the progress it reports will be translated to the opacity of the form (because the form opacity cannot be modified on the worker thread) and the work routine will be a simple loop from 0 to 20, thread sleeping upon each iteration. Does anyone have any comments on whether this is a good or bad idea?
 
Eek!

Apparently, Timers with an interval of less than 1 second are discouraged.

I'd never heard that before. Is there a specific reason for that, other than it eating up CPU and possibly bogging the program down? I use a number of times in my program...most of them are for a second or more, but a couple of them are a quarter of a second for making something morph and I haven't seen anything untoward as yet.
 
Back
Top