private void bNetworkConfigSet_Click(object sender, EventArgs e) { BtnClick(bNetworkConfigSet, () => { RepProtocol.NetworkConfig config = new RepProtocol.NetworkConfig(); config.ip = IPAddress.Parse(Utils.FixRepIpAddressString(tbNetConfigIP.Text)); config.mask = IPAddress.Parse(Utils.FixRepIpAddressString(tbNetConfigMask.Text)); config.gateway = IPAddress.Parse(Utils.FixRepIpAddressString(tbNetConfigGateway.Text)); repProtocol.SetNetworkConfig(config); }); }
private void bNetworkConfigGet_Click(object sender, EventArgs e) { BtnClick(bNetworkConfigGet, delegate() { RepProtocol.NetworkConfig config = repProtocol.GetNetworkConfig(); Invoke(() => { tbNetConfigIP.Text = config.ip.ToString(); tbNetConfigMask.Text = config.mask.ToString(); tbNetConfigGateway.Text = config.gateway.ToString(); tbNetConfigMAC.Text = Regex.Replace(config.mac.ToString(), "(.{2})(?!$)", m => m.Groups[1].Value + "-"); }); }); }