private void btn_Create_Click(object sender, EventArgs e) { Boolean res = false; try { res = Network.Client.CheckForName(txtBox_Pseudo.Text); if (res) { MessageBox.Show("Pseudo deja utilisé"); } else { this.Hide(); Form_Lobby fm = new Form_Lobby(this.Location, txtBox_Pseudo.Text); fm.ShowDialog(); this.Close(); } } catch (Exception) { this.Close(); this.Hide(); AskIPFormcs fm = new AskIPFormcs(this.Location, txtBox_Pseudo.Text); fm.ShowDialog(); } }
private void JoinLobby(String lobbyName) { Form fm = new Form_Lobby(this.Location, player.getName()); fm.ShowDialog(); for (int i = Application.OpenForms.Count - 1; i >= 0; i--) { if (Application.OpenForms[i] != this) { Application.OpenForms[i].Close(); } } }
private void btn_Back_Click(object sender, EventArgs e) { KillTheThread(); Thread.Sleep(500); clientLobby.ClientLeaveLobby(lobbyName); clientLobby.CloseSocket(); clientLobby = null; this.Hide(); this.Close(); Form_Lobby fm = new Form_Lobby(this.Location, p.getName()); fm.ShowDialog(); }