Exemplo n.º 1
0
        /* 描述:连接信息新增按钮响应函数
         * 参数:略
         * 返回值:void
         */
        private void AddConnectButton_Click(object sender, EventArgs e)
        {
            BoardInitForm_AddConnect addConnect = new BoardInitForm_AddConnect(tabControl3.SelectedTab.Text);

            addConnect.StartPosition = FormStartPosition.CenterScreen;
            addConnect.Owner         = this;
            addConnect.ShowDialog();
            if (addConnect.DialogResult == DialogResult.Yes)
            {
                switch (tabControl3.SelectedTab.Text)
                {
                case "EtherNet":
                    ConnectAddItem(addConnect, EtherLV, ref _netNum);
                    break;

                case "RapidIO":
                    ConnectAddItem(addConnect, RioLV, ref _rapidIONum);
                    break;

                case "GTX":
                    ConnectAddItem(addConnect, GtxLV, ref _gtxNum);
                    break;

                case "LVDS":
                    ConnectAddItem(addConnect, LvdsLV, ref _lvdsNum);
                    break;

                default:
                    break;
                }
                addConnect.Dispose();
            }
        }
Exemplo n.º 2
0
        /* 描述:连接信息ListView添加Item函数
         * 参数:
         * addConnect----新增连接信息录入界面实例
         * lv----四种链接信息对应的ListView实例
         * serialNum----Item排序编号,传入值为成员变量_netNum,_rapidIONum,_gtxNum,_lvdsNum
         * 返回值:void
         */
        private void ConnectAddItem(BoardInitForm_AddConnect addConnect, ListView lv, ref int serialNum)
        {
            serialNum++;
            lv.BeginUpdate();
            ListViewItem lvi = new ListViewItem();

            lvi.Text = serialNum.ToString();
            lvi.SubItems.Add(addConnect.Port1_Type);
            lvi.SubItems.Add(addConnect.Port1_SN);
            lvi.SubItems.Add(addConnect.Port1_Num);
            lvi.SubItems.Add(addConnect.Port2_Type);
            lvi.SubItems.Add(addConnect.Port2_SN);
            lvi.SubItems.Add(addConnect.Port2_Num);

            lv.Items.Add(lvi);
            lv.EndUpdate();
        }