private void btnAdd_Click(object sender, EventArgs e) { Username = txtUsername.Text; Ip = ipAddress.IPAddress; MacAddrConvertable macVariable = new MacAddrConvertable(); macVariable.Address = macMac.Text; Mac = macVariable.ConvertToPhysicalAddress(); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
private PhysicalAddress GetChosenMac() { if (radioClient.Checked) { MacAddrConvertable macVariable = new MacAddrConvertable(); macVariable.Address = macClient.Text; return macVariable.ConvertToPhysicalAddress(); } else if (radioPTP.Checked) { MacAddrConvertable macVariable = new MacAddrConvertable(); macVariable.Address = macRouterPTP.Text; return macVariable.ConvertToPhysicalAddress(); } else if (radioSwitch.Checked) { return null; } else if (radioTransparentRouter.Checked) { MacAddrConvertable macVariable = new MacAddrConvertable(); macVariable.Address = macRouter.Text; return macVariable.ConvertToPhysicalAddress(); } else throw new Exception("Not any of options"); }