private void FrmStartClient_FormClosed(object sender, FormClosedEventArgs e) { if (socketClient != null) { socketClient.TokenSourceCheckingParcels.Cancel(); socketClient.Dispose(); } }
private void Chat_FormClosing(object sender, FormClosingEventArgs e) { if (_client == null || !_client.SocketConnected) { return; } _client.SendParcel("***HAS LEFT THE CHAT***"); _client.TokenSourceCheckingParcels.Cancel(); _client.Dispose(); }