Example #1
0
        private void changeListItem(byte[] ID, byte[] type, byte[] version)
        {
            string nodeID    = ID[0].ToString("X2") + ID[1].ToString("X2");
            int    listCount = listView1.Items.Count;

            for (int i = 0; i < listCount; i++)
            {
                if (nodeID.Equals(listView1.Items[i].SubItems[0].Text))
                {
                    listView1.Items[i].SubItems[2].Text = CiXinUtils.getVersion(version) + getSunTypeName(type[2], type[3]);
                    return;
                }
            }
            addData(nodeID, nodeID, CiXinUtils.getVersion(version) + getSunTypeName(type[2], type[3]));
        }
Example #2
0
 /// <summary>
 /// 获取子设备类型的字符串
 /// </summary>
 /// <param name="mainType"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static string getSunTypeName(byte mainType, byte type)
 {
     if (mainType == 0x01)
     {
         return(CiXinUtils.getSunNODETypeName(0x01, type));
     }
     else if (mainType == 0x02)
     {
         return(CiXinUtils.getSunCankaodianTypeName(0x02, type));
     }
     else if (mainType == 0x03)
     {
         return(CiXinUtils.getSunCardTypeName(0x03, type));
     }
     else
     {
         return("");
     }
 }
Example #3
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count <= 0)
            {
                return;
            }
            try
            {
                ListViewItem selectOne = listView1.SelectedItems[0];
                if (!button1.Enabled)
                {
                    return;
                }
                string selectMsg = selectOne.SubItems[0].Text;
                selectNodeID = XWUtils.getByteID(selectMsg);
                string tpBtStr = XWUtils.getSplTypeEnd(selectOne.SubItems[2].Text, '-');
                sunType = CiXinUtils.getSunType("-" + tpBtStr);
                if (selectNodeID == null)
                {
                    return;
                }

                label3.Text = "0%";
                label4.Text = StringUtils.changeDrivace + ":" + selectNodeID[0].ToString("X2") + selectNodeID[1].ToString("X2") + " " + tpBtStr;
                label5.Text = StringUtils.currentDrivace + ":" + selectNodeID[0].ToString("X2") + selectNodeID[1].ToString("X2") + " " + tpBtStr;
                if (progressBar1.Value != 0)
                {
                    progressBar1.Value = 0;
                }
                if (button5.Enabled)
                {
                    setBtnOpen(sunType);
                    readAllcanShu(DrivaceTypeAll.NODE, selectNodeID);
                    return;
                }
                setBtnClose();
                setBtnOpen(sunType);
                setBouthOpen();
                readAllcanShu(DrivaceTypeAll.NODE, selectNodeID);
            }
            catch { }
        }