參數設定為System.Property.ConnectionsDesktopCount
可以得知目前的值為0就是沒有連上, 1則是連上PC的Mobile Center
範例程式 SystemState state; private void Form1_Load(object sender, EventArgs e) { state = new SystemState(SystemProperty.ConnectionsDesktopCount); state.Changed += new ChangeEventHandler(state_Changed); bool bConnected = (int)state.CurrentValue != 0 ? true : false; //...... } void state_Changed(object sender, ChangeEventArgs args) { //Get changed }
沒有留言:
張貼留言