紧凑型框架中是否存在会在挂起和恢复时触发的事件? [英] Is there an event in compact framework that fires on suspend and resume?
问题描述
还是我必须调用本机代码?
我不想要电源状态...好吧,但是我不想一直轮询它,而是希望一场大火。
Or do I have to pinvoke native code?
I don't want the power status...well I do, but I don't want to poll it all the time and would rather have an event fire.
推荐答案
没有。通常,应用程序完全不了解电源状态。当设备挂起时,代码只是停止执行。当您恢复时,它会从停下来的确切位置再次开始。
No there is not. Generally an application is completely unaware of the power state. When the device suspends, code simply stops executing. When you resume, it starts again at the exact spot it left off.
您可以插入电源管理系统以获得通知,尽管要知道您没有时间进行实际反应,所以代码很可能可以
You can hook into the power management system to get notifications, though be aware that you don't have time to actually react, so it's likely that your code can't actually handle the "going to sleep" event until after it wakes again.
这两个状态转换都在智能设备框架的 OpenNETCF.WindowsCE.PowerManager 类。
Both These state transitions are exposed in managed functions in the Smart Device Framework's OpenNETCF.WindowsCE.PowerManager class.
这篇关于紧凑型框架中是否存在会在挂起和恢复时触发的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!