0

I am using Microsoft.SmartDevice.Connectivity to connect to my device and use classes like FileDeployer. I am puzzled about the propper way to connect to the device.

I am currently doing this:

DatastoreManager dsmgr = new DatastoreManager(1033);

Platform platform = dsmgr.GetPlatforms().FirstOrDefault();

Device device = platform.GetDevices().FirstOrDefault();

And it works for all the devices I can get my hands on. Which ever device I connect, classes like FileDeployer and RemoteProcess always work on the connected device with the code I submitted above.

I can't understand the way this is supposed to work, since GetDevices() always returns several devices - al though even one is connected. Even if I remove the emulators, there are still several possibilities. Even the Connect method succeeds on several devices (while only one is actually present)...

How can this be? Can anyone shed some light on the subject? What is the proper way of identifying the connected device (given that you don't know anything about the device)?

David Božjak
  • 16,887
  • 18
  • 67
  • 98

1 Answers1

0

Quote from here

The Datastore contains information about platforms and devices registered on the desktop computer.

That's why you getting full list of devices, no matter are they connected or not.

After call to Connect() method you should call IsConnected() method to check if device is really connected.

Renatas M.
  • 11,694
  • 1
  • 43
  • 62
  • Thank you for this, but it doesn't answer my question as a whole. Is there a simple way of finding the one, real, physical device connected to the PC? – David Božjak Jul 18 '11 at 13:46