/// <summary> /// Callback for when a connection had disconnected /// </summary> /// <param name="sender">The client object whom is disconnecting</param> private void ClientDisconnected(ChatClient client) { // Release this stream's AsyncEventArgs to the object pool //Release(client.Stream); client.Dispose(); if (Clients.TryRemove(client.ConnectionID, out client) && !client.Disposed) { client.Dispose(); } }
private void Window_Closed(object sender, EventArgs e) { _chatServer.Dispose(); _chatClient1.Dispose(); _chatClient2.Dispose(); }