/// <summary> /// /// </summary> /// <param name="client"></param> public Frm_PublicPark(DCN.TicTacToe.Client.Client client) { InitializeComponent(); this.client = client; client.AddNewPlayer += Client_AddNewPlayer; client.UpdateLocationP += Client_UpdateLocationP; client.JoinPPResponse += Client_JoinPPResponse; client.ShowMessPP += Client_ShowMessPP; client.RemovePlayerRequest += Client_RemovePlayerRequest; }
private void btn_Exit_Click(object sender, EventArgs e) { client.RequestOutPublicPark((clientSender, mess) => { this.InvokeUI(() => { client.AddNewPlayer -= Client_AddNewPlayer; client.UpdateLocationP -= Client_UpdateLocationP; client.JoinPPResponse -= Client_JoinPPResponse; client.ShowMessPP -= Client_ShowMessPP; client.RemovePlayerRequest -= Client_RemovePlayerRequest; this.client = null; this.Dispose(); }); }); }