public void Refresh() { _deviceManager.RefreshDeviceList(); Clear(); // Determine how many WPD devices are connected var deviceIds = new string[1]; uint count = 1; _deviceManager.GetDevices(ref deviceIds[0], ref count); if (count == 0) { return; // no devices connected } // Retrieve the device ID for each connected device deviceIds = new string[count]; _deviceManager.GetDevices(ref deviceIds[0], ref count); // Add devices to our collection for (int i = 0; i < deviceIds.Length; i++) { Add(new PortableDevice(deviceIds[i])); } }
private void RefreshDevices() { portableDevices.Clear(); deviceManager.RefreshDeviceList(); uint _countDevices = 1; deviceManager.GetDevices(null, ref _countDevices); var devicesIds = new string[_countDevices]; deviceManager.GetDevices(devicesIds, ref _countDevices); countDevices = _countDevices; }