PDA

Click to See Complete Forum and Search --> : [RESOLVED] Problem with CradlePresent SystemState


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

gep13
May 23rd, 2008, 04:20 PM
Hello,

For anyone who is interested, I have found the solution to this now, and the solution was to do with ActivSync.

In the Connection Settings window of ActivSync, I had to change the "Allow Connections to one of the following:" setting to include DMA. From there, once I started up the Emulator, I was able to change the Cradled State, and this was then reflected in the code that I was executing.

Thanks

Gary