Thursday, September 4, 2008

Hi How to use the System State in Windows mobile

Hi Guys

here simple sample how to use the system state class in windows mobile.

Question: How to check the cradlepresent in the Windows mobile Device or Emulator ?

Answers:

SystemState cradleState = null;

private void Init()
{
cradleState = new SystemState(SystemProperty.CradlePresent);
cradleState.Changed += new ChangeEventHandler(cradleState_Changed);
}

void cradleState_Changed(object sender, ChangeEventArgs args)
{
bool isPresent =Convert.ToBoolean(SystemState.GetValue(SystemProperty.CradlePresent));
if (isPresent)
{
MessageBox.Show("Present");
}
}

thank you

No comments: