コード例 #1
0
        /// <summary>
        /// Event handler for arrival of  devices
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="devInterface">The device interface which was added</param>
        private void OnAdded(Windows.Devices.Enumeration.DeviceWatcher sender, Windows.Devices.Enumeration.DeviceInformation devInterface)
        {
            // search the device list for a device with a matching interface ID
            DeviceListEntry match = FindInList(devInterface.Id);

            // If we found a match then mark it as verified and return
            if (match != null)
            {
                if (match.Matched == false)
                {
                    DeviceAdded(this, new UsbDeviceInfo(match));
                }
                match.Matched = true;
                return;
            }


            // Create a new element for this device interface, and queue up the query of its
            // device information
            match = new DeviceListEntry(devInterface);

            // Add the new element to the end of the list of devices
            this.devices.Add(match);

            DeviceAdded(this, new UsbDeviceInfo(match));
        }
コード例 #2
0
 internal UsbDeviceInfo(DeviceListEntry info)
 {
     Id   = info.Id;
     Name = info.Name;
 }
コード例 #3
0
 internal UsbDeviceInfo(DeviceListEntry info)
 {
     Id = info.Id;
     Name = info.Name;
 }
コード例 #4
0
        /// <summary>
        /// Event handler for arrival of  devices
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="devInterface">The device interface which was added</param>
        private void OnAdded(Windows.Devices.Enumeration.DeviceWatcher sender, Windows.Devices.Enumeration.DeviceInformation devInterface)
        {
            // search the device list for a device with a matching interface ID
            DeviceListEntry match = FindInList(devInterface.Id);

            // If we found a match then mark it as verified and return
            if (match != null)
            {
                if (match.Matched == false)
                {
                    DeviceAdded(this, new UsbDeviceInfo(match));
                }
                match.Matched = true;
                return;
            }


            // Create a new element for this device interface, and queue up the query of its
            // device information
            match = new DeviceListEntry(devInterface);

            // Add the new element to the end of the list of devices
            this.devices.Add(match);

            DeviceAdded(this, new UsbDeviceInfo(match));
        }