Ejemplo n.º 1
0
        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);
                }
            }
        }
Ejemplo n.º 2
0
        private void PowerIPConfigForm_Load(object sender, EventArgs e)
        {
            m_PowerControl = new PowerControl();
            PowerIPConfigInfo vPowerIPConfigInfo = m_PowerControl.GetIPConfig(DianYuanID);

            textBox_GateWay.Text           = vPowerIPConfigInfo.Gateway;
            textBox_IPAddress.Text         = vPowerIPConfigInfo.IPAddress;
            checkBox_DHCP.Checked          = vPowerIPConfigInfo.IsDHCP;
            numericUpDown_ServerPort.Value = vPowerIPConfigInfo.ServerPort;
            textBox_ServerIP.Text          = vPowerIPConfigInfo.ServerIPAddress;
            textBox_SubMask.Text           = vPowerIPConfigInfo.SubMask;
        }
Ejemplo n.º 3
0
        private async void button_Get_Click(object sender, EventArgs e)
        {
            m_PowerControl = new PowerControl();
            PowerIPConfigInfo vPowerIPConfigInfo = await m_PowerControl.SendCMD_GetIP(DianYuanID);

            textBox_GateWay.Text           = vPowerIPConfigInfo.Gateway;
            textBox_IPAddress.Text         = vPowerIPConfigInfo.IPAddress;
            checkBox_DHCP.Checked          = vPowerIPConfigInfo.IsDHCP;
            numericUpDown_ServerPort.Value = vPowerIPConfigInfo.ServerPort;
            textBox_ServerIP.Text          = vPowerIPConfigInfo.ServerIPAddress;
            textBox_SubMask.Text           = vPowerIPConfigInfo.SubMask;
        }