Beispiel #1
0
        /// <summary>
        /// 在构造函数(绑定串口数组到ComboBox控件)
        /// </summary>
        public CarCard()
        {
            InitializeComponent();
            try
            {
                string[] portnames = System.IO.Ports.SerialPort.GetPortNames();//获取本地计算机可连接的串口数组
                if (portnames is Nullable || portnames.Length < 1)
                {
                    portnames = new string[10] { "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "COM10" };
                }
                comboSerialNO.DataSource = portnames;

                _icCard = new RegistIcCard();
            }
            catch (Exception eex3)
            {

            }
        }
Beispiel #2
0
        private void CarCard_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                _icCard.Close();
                _icCard = null;

            }
            catch (Exception ex1)
            {

            }
        }