refactored Device.PowerChanged