Hi. I have a windows form program that updates info when an existing activesync connection is active.
I'd like to write an event handler that will automatically update the form when a new Mobile 6.5 device is cradled.
Does anyone have a
complete example of this?
All the code snippets found with Google don't work for me.
Thanks in advance.
Let me extend the question.
What I've done so far is put these lines in the form's CTOR
m_rapi.RAPIConnected += new RAPIConnectedHandler(m_rapi_RAPIConnected);
m_rapi.RAPIDisconnected += new RAPIConnectedHandler(m_rapi_RAPIDisconnected);
m_rapi.Connect(false, -1);
Then I have:
private void m_rapi_RAPIConnected()
{
MessageBox.Show("Connected");
Dostuff();
}
private void m_rapi_RAPIDisconnected()
{
MessageBox.Show("Disconnected");
clearForm();
}
When I start the program and the Mobile device is already connected, I get the messagebox but nothing else happens.
I fixed that by changing
m_rapi.Connect(false, -1);
to
m_rapi.Connect(true, -1);
The stuff in dostuff() now executes.
However, when I disconnect the device, the messagebox pops up, but the clearform() does nothing.
Also, when I reconnect the device, the connect method doesn't execute, which I assume is because it's in the CTOR.
Any ideas how to fix both problems?