change sleepInMilliSeconds to sleepInSpinWait
use Thread.SpinWait instead of Thread.sleep,change event array to make all device power status always on