예제 #1
0
        private void PortNameComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //BText.Text = PortNameComboBox.SelectedItem.ToString() + "串口被选择";
            var             selection = PortNameComboBox.SelectedItem;
            DeviceListEntry entry     = (DeviceListEntry)selection;

            TipText.Text   = entry.InstancePortName + "已选择";
            selectPortName = entry.InstancePortName;
        }
예제 #2
0
        /// <summary>
        /// Update Available Serial Port to UI List
        /// 更新可选的串口到UI列表中
        /// </summary>
        /// <param name="deviceInfo">DeviceInformation Type</param>
        private void AddDeviceToList(DeviceInformation deviceInformation, string deviceSelector)
        {
            var match = FindDevice(deviceInformation.Id);

            if (match == null)
            {
                match = new DeviceListEntry(deviceInformation, deviceSelector);
                listOfDevice.Add(match);
                serialPortDeviceDic[deviceInformation.Name] = deviceInformation.Id;
            }
        }