这家伙怎么回答。
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/d7e6d896-ff0b-4bb8-969d-3ff516db6782
OpennetCF提供了一种监视activesync连接状态的方法。如下面的代码:
private void connectAsync_Click(object sender, System.EventArgs e)
{
m_rapi.RAPIConnected += new RAPIConnectedHandler(m_rapi_RAPIConnected);
m_rapi.RAPIDisconnected += new RAPIConnectedHandler(m_rapi_RAPIDisconnected);
m_rapi.Connect(false, -1);
}
private void m_rapi_RAPIConnected()
{
this.Invoke(textUpdate, new object[] { this, new TextArgs(connectStatus, "Connected") });
this.Invoke(enableUpdate, new object[] { this, new EnableArgs(connectAsync, false) });
this.Invoke(enableUpdate, new object[] { this, new EnableArgs(connectSync, false) });
}
private void m_rapi_RAPIDisconnected()
{
this.Invoke(textUpdate, new object[] { this, new TextArgs(connectStatus, "Not Connected") });
this.Invoke(enableUpdate, new object[] { this, new EnableArgs(connectAsync, false) });
this.Invoke(enableUpdate, new object[] { this, new EnableArgs(connectAsync, false) });
}
private void copyFrom_Click(object sender, System.EventArgs e)
{
if(! m_rapi.Connected)
{
MessageBox.Show("Not connected!");
return;
}
m_rapi.CopyFileFromDevice("f:\\1.jpg", "\\My Documents\\1.jpg", true);
}
当检测到它是连接时,它
将状态更改为“已连接”。
更多信息:
http://social.msdn.microsoft.com/forums/en-US/vssmartdevicesvbcs/thread/44e50105-a0ec-4906-86f8-42c8215b6993/
祝你好运,卞光明-中新网