예제 #1
0
 public void _doAddItem(netdata_ex_new itemData)
 {
     _syncContext.Post(doAddItem, itemData);
 }
예제 #2
0
        private void doAddItem(object itemData)
        {
            netdata_ex_new _ex_data = (netdata_ex_new)itemData;
            netdata_new    _data    = _ex_data.xdata;
            string         _Mac     = funs.Byte2Mac(_ex_data.xCmd.mac);

            _curMac = _Mac;
            foreach (ListViewItem item in this.listView1.Items)
            {
                if (item.SubItems[1].Text == _curMac)
                {
                    item.SubItems[4].Text = ntohs(_data.xdata.objport).ToString();
                    return;
                }
            }
            ListViewItem lvi = new ListViewItem();

            lvi.Tag  = _data;
            lvi.Text = (listView1.Items.Count + 1).ToString();
            lvi.SubItems.Add(_curMac);
            lvi.SubItems.Add(protocol_info[_data.xdata.protocol]);
            if (_data.xdata.domain_type == 0)
            {
                byte[] x = new byte[4];
                x[0] = _data.xdata.desc[0];
                x[1] = _data.xdata.desc[1];
                x[2] = _data.xdata.desc[2];
                x[3] = _data.xdata.desc[3];
                lvi.SubItems.Add(funs.ByteArrayToIPAddress(x));
            }
            else
            {
                lvi.SubItems.Add(Encoding.Default.GetString(_data.xdata.desc));
            }
            lvi.SubItems.Add(ntohs(_data.xdata.objport).ToString());
            lvi.SubItems.Add(funs.ByteArrayToIPAddress(_data.IP));
            lvi.SubItems.Add(ntohs(_data.xdata.localport).ToString());
            if (_data.xdata.Version == 0)
            {
                lvi.SubItems.Add("- -");
            }
            else
            {
                if (Rf.Models.Length >= _data.xdata.Version)
                {
                    lvi.SubItems.Add(Rf.Models[_data.xdata.Version - 1]);
                }
                else
                {
                    lvi.SubItems.Add("unknown");
                }
            }

            if (netcfg.E830_ETH2A.E830ETH_Flag == false && _data.xdata.Version == 8)
            {
                MessageBox.Show("型号选择错误,请重新选择");
            }
            else
            {
                this.listView1.Items.Add(lvi);
            }
            float ver = (float)Convert.ToDouble(Convert.ToString(_data.xdata.E_Version, 16)) / 10;

            lvi.SubItems.Add("V" + string.Format("{0:F1}", ver));
        }