private void RefreshEthUI(HnEthernetInfo nInfo) { this.cbDhcpEnable.Checked = nInfo.dhcp; this.tbIP.Text = nInfo.ip; this.tbMask.Text = nInfo.mask; this.tbGateway.Text = nInfo.gateway; this.tbDNS.Text = nInfo.dns; }
private HEthernetInfo N2Str(HnEthernetInfo nInfo) { HEthernetInfo info = new HEthernetInfo(); info.valid = this.GenBool(nInfo.valid); info.enable = this.GenBool(nInfo.enable); info.dhcp = this.GenBool(nInfo.dhcp); info.ip = nInfo.ip; info.mask = nInfo.mask; info.gateway = nInfo.gateway; info.dns = nInfo.dns; return(info); }
private HnEthernetInfo Str2N(HEthernetInfo info) { HnEthernetInfo nInfo = new HnEthernetInfo(); nInfo.valid = this.ParseBool(info.valid); nInfo.enable = this.ParseBool(info.enable); nInfo.dhcp = this.ParseBool(info.dhcp); nInfo.ip = info.ip; nInfo.mask = info.mask; nInfo.gateway = info.gateway; nInfo.dns = info.dns; return(nInfo); }
private void btnOK_Click(object sender, EventArgs e) { if (this.cbbDeviceID.Text == "") { return; } HnEthernetInfo nInfo = new HnEthernetInfo(); nInfo.valid = true; nInfo.enable = true; nInfo.dhcp = this.cbDhcpEnable.Checked; nInfo.ip = this.tbIP.Text; nInfo.mask = this.tbMask.Text; nInfo.gateway = this.tbGateway.Text; nInfo.dns = this.tbDNS.Text; HEthernetInfo info = this.N2Str(nInfo); string cmd = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<sdk>\n" + " <in method=\"SetEth0Info\">\n" + " <eth valid=\"true\">\n" + " <enable value=\"true\"/>\n" + " <dhcp auto=\"##dhcp\"/>\n" + " <address ip=\"##ip\" netmask=\"##netmask\" gateway=\"##gateway\" dns=\"##dns\"/>\n" + " </eth>\n" + " </in>\n" + "</sdk>\n"; cmd = cmd.Replace("##dhcp", info.dhcp); cmd = cmd.Replace("##ip", info.ip); cmd = cmd.Replace("##netmask", info.mask); cmd = cmd.Replace("##gateway", info.gateway); cmd = cmd.Replace("##dns", info.dns); UDPServices.GetInstance().SendCmd(this.cbbDeviceID.Text, cmd); }