Exemple #1
0
        /// <summary>
        /// Construct the device by obtainin the device properties and the sub data.
        ///
        /// NOTE:
        /// There is a difference with the device id and the id.
        /// The id indicates the object id within the windows portable device.
        /// The device id indicates the object id within the operating system.
        ///
        /// The initial id for all windows portable devices is hard coded to "DEVICE"
        /// </summary>
        /// <param name="deviceId"></param>
        public Device(string deviceId, bool withDeviceItems = true) : base("DEVICE")
        {
            DeviceId        = deviceId;
            ComDeviceObject = new PortableDeviceClass();
            Connect();
            IPortableDeviceValues deviceProperties = ExtractDeviceProperties(ComDeviceObject);

            ContentType     = new ContentTypeProperty(deviceProperties);
            DeviceType      = new TypeProperty(deviceProperties);
            FirmwareVersion = new FirmwareVersionProperty(deviceProperties);
            FriendlyName    = new FriendlyNameProperty(deviceProperties);
            Manufacturer    = new ManufacturerProperty(deviceProperties);
            Model           = new ModelProperty(deviceProperties);
            Name            = new NameProperty(deviceProperties);
            SerialNumber    = new SerialNumberProperty(deviceProperties);

            if (withDeviceItems == true)
            {
                LoadDeviceData(ComDeviceObject);

                do
                {
                    System.Threading.Thread.Sleep(100);
                } while (UtilityHelper.threadList.Count > 0);
            }
            Disconnect();
        }
Exemple #2
0
        /// <summary>
        /// Construct the device by obtainin the device properties and the sub data.
        ///
        /// NOTE:
        /// There is a difference with the device id and the id.
        /// The id indicates the object id within the windows portable device.
        /// The device id indicates the object id within the operating system.
        ///
        /// The initial id for all windows portable devices is hard coded to "DEVICE"
        /// </summary>
        /// <param name="deviceId"></param>
        public Device(string deviceId) : base("DEVICE")
        {
            DeviceId        = deviceId;
            ComDeviceObject = new PortableDeviceClass();
            Connect();
            IPortableDeviceValues deviceProperties = ExtractDeviceProperties(ComDeviceObject);

            ContentType     = new ContentTypeProperty(deviceProperties);
            DeviceType      = new TypeProperty(deviceProperties);
            FirmwareVersion = new FirmwareVersionProperty(deviceProperties);
            FriendlyName    = new FriendlyNameProperty(deviceProperties);
            Manufacturer    = new ManufacturerProperty(deviceProperties);
            Model           = new ModelProperty(deviceProperties);
            Name            = new NameProperty(deviceProperties);
            SerialNumber    = new SerialNumberProperty(deviceProperties);

            LoadDeviceData(ComDeviceObject);

            Disconnect();
        }