gep13
May 16th, 2008, 03:17 PM
Hello
In order for my Application to know when it is able to synchronise with the back end server, I am trying to use the SystemState CradlePresent property, as follows:
Sysyemstate cradleState = new SystemState(SystemProperty.CradlePresent);
cradleState.Changed += new ChangeEventHandler(cradleState_Changed);
And then I assigning an Event Handler to when the State changes. However, when I try and access the Property as follows:
return ((int)cradleState.CurrentValue != 0);
I get a NullReferenceException :(
To explain this slightly more, I only get the Exception when I run the code on a Device Emulator, when I run it on an actual device then I don't get the exception. Even though i have used Device Emulator Manager to make sure that the device is cradled?!?!?
Any thoughts on why this would be happening?
Thanks
Gary
In order for my Application to know when it is able to synchronise with the back end server, I am trying to use the SystemState CradlePresent property, as follows:
Sysyemstate cradleState = new SystemState(SystemProperty.CradlePresent);
cradleState.Changed += new ChangeEventHandler(cradleState_Changed);
And then I assigning an Event Handler to when the State changes. However, when I try and access the Property as follows:
return ((int)cradleState.CurrentValue != 0);
I get a NullReferenceException :(
To explain this slightly more, I only get the Exception when I run the code on a Device Emulator, when I run it on an actual device then I don't get the exception. Even though i have used Device Emulator Manager to make sure that the device is cradled?!?!?
Any thoughts on why this would be happening?
Thanks
Gary