private async void button_Config_Click(object sender, EventArgs e) { if (verifyIPAddress()) { m_PowerControl = new PowerControl(); PowerIPConfigInfo vPowerIPConfigInfo = new PowerIPConfigInfo() { Gateway = textBox_GateWay.Text, IPAddress = textBox_IPAddress.Text, IsDHCP = checkBox_DHCP.Checked, MAC = DianYuanID, ServerPort = Convert.ToInt16(numericUpDown_ServerPort.Value), ServerIPAddress = textBox_ServerIP.Text, SubMask = textBox_SubMask.Text, }; bool vResult = await m_PowerControl.SendCMD_SetIP(DianYuanID, vPowerIPConfigInfo); if (vResult) { MessageBox.Show("配置成功", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("配置失败", "信息", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }