public Insert_Ships(string IPConection, int porta, bool serverSide) { InitializeComponent(); setPort(porta); comboBoxConection.SelectedIndex = 0; foreach (string LocalIP in TCPIP.GetLocalIPAddress()) { comboBox_LocalIPs.Items.Add(LocalIP); } if (serverSide) { for (int x = 0; x < comboBox_LocalIPs.Items.Count; x++) { if (IPConection == comboBox_LocalIPs.Items[x].ToString()) { comboBox_LocalIPs.SelectedIndex = x; } } } else { radioBtnClient.Checked = true; mskTxt_HostIP.Text = IPConection; } createShips(); }
private void btn_RefreshIPs_Click(object sender, EventArgs e) { comboBox_LocalIPs.Items.Clear(); foreach (string IP in TCPIP.GetLocalIPAddress()) { comboBox_LocalIPs.Items.Add(IP); } comboBox_LocalIPs.SelectedIndex = 0; }
public Insert_Ships() { InitializeComponent(); comboBoxConection.SelectedIndex = 0; foreach (string IP in TCPIP.GetLocalIPAddress()) { comboBox_LocalIPs.Items.Add(IP); } comboBox_LocalIPs.SelectedIndex = 0; tabuleiro = new Tabuleiro(10, 10); tabuleiro.setMineFields(this); createShips(); }