private void FormEditDevice_Load(object sender, EventArgs e) { this.textBoxDeviceName.Text = ZLDM.GetDevParamString(DevID, ZLDM.PARAM_DEV_NAME); this.comboBoxBaudRate.SelectedIndex = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_BAUNDRATE); this.comboBoxDataBits.SelectedIndex = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_DATA_BITS); this.comboBoxPatity.SelectedIndex = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_PARITY); this.comboBoxStopBits.SelectedIndex = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_STOP_BIT); this.comboBoxFlowControl.SelectedIndex = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_FLOW_CONTROL); this.comboBoxIPMode.SelectedIndex = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_IP_MODE); this.textBoxIP.Text = ZLDM.GetDevParamString(DevID, ZLDM.PARAM_DEV_LOCAL_IP); this.textBoxPort.Text = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_DEV_LOCAL_PORT).ToString(); this.comboBoxWorkMode.SelectedIndex = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_WORK_MODE); this.textBoxMask.Text = ZLDM.GetDevParamString(DevID, ZLDM.PARAM_NET_MASK); this.textBoxGateway.Text = ZLDM.GetDevParamString(DevID, ZLDM.PARAM_GATEWAY); this.textBoxDestIP.Text = ZLDM.GetDevParamString(DevID, ZLDM.PARAM_DEST_IP); this.textBoxDestPort.Text = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_DEST_PORT).ToString(); }
private void button_StartSearchDev_Click(object sender, EventArgs e) { int DeviceNumber, paraInt; string DevID; DeviceNumber = ZLDM.StartSearchDev(); this.dataGridView1.Rows.Clear(); if (DeviceNumber > 0) { this.dataGridView1.Rows.Add(DeviceNumber); } for (int i = 0; i < DeviceNumber; i++) { //设备ID //DevID = ZLDM.GetDevID(0);//只能显示第一个设备 DevID = ZLDM.GetDevID(i); this.dataGridView1.Rows[i].Cells[Index设备ID].Value = DevID; //类型 paraInt = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_DEV_EXIST_IN_SUBNET); this.dataGridView1.Rows[i].Cells[Index类型].Value = Enum.Parse(typeof(ParamDevExitInSubnet), paraInt.ToString()).ToString(); //设备名称 this.dataGridView1.Rows[i].Cells[Index设备名称].Value = ZLDM.GetDevParamString(DevID, ZLDM.PARAM_DEV_NAME); //设备IP this.dataGridView1.Rows[i].Cells[Index设备IP].Value = ZLDM.GetDevParamString(DevID, ZLDM.PARAM_DEV_LOCAL_IP); //目的IP this.dataGridView1.Rows[i].Cells[Index目的IP].Value = ZLDM.GetDevParamString(DevID, ZLDM.PARAM_DEST_IP); //模式 paraInt = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_WORK_MODE); this.dataGridView1.Rows[i].Cells[Index模式].Value = Enum.Parse(typeof(ParamWorkMode), paraInt.ToString()).ToString(); //TCP连接状态 paraInt = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_LINK_STATUS); this.dataGridView1.Rows[i].Cells[IndexTCP连接].Value = Enum.Parse(typeof(ParamLinkStatus), paraInt.ToString()).ToString(); } this.toolStripStatusLabel1.Text = "搜索到" + DeviceNumber.ToString() + "个设备"; }