开发者

windows mobile 6.5 .net CF - how to get notification that the internal phone turns on or off

Which API can I use to get notifications about state change of teh phone? For instance I have my application and want to know wheter the user turns off or on the phone f开发者_开发知识库rom Wireless Manager?

Regards


Like this:

using Microsoft.WindowsMobile.Status;

var phoneRadioOffState = new SystemState(SystemProperty.PhoneRadioOff);

phoneRadioOffState.Changed += (sender, e) =>
{
    var off = Convert.ToBoolean(e.NewValue);

    // Here you can do whatever you'd like when the phone is on or off.
};

Just remember that the phoneRadioOffState must be in scope/alive for the event handler to be called, so it's usually not a good idea to make it a method-local variable.


Use the State and Notification Broker to watch the PhoneRadioOff property. An example of setting up the broker can be found here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜