private void DisconnectCore(DisconnectionReason reason, IClientConnection connection, bool reconnect, bool fireEvent) { lock (StateSync) { disconnectedInChannelId = CurrentUser.CurrentChannelId; this.connecting = false; this.running = false; this.formallyConnected = false; CurrentUser = new CurrentUser(this); this.Users.Reset(); this.Channels.Clear(); this.Sources.Reset(); this.Audio.Stop(); connection.DisconnectAsync(); if (fireEvent) { OnDisconnected(this, new DisconnectedEventArgs(reason)); } if (reconnect) { this.connecting = true; ThreadPool.QueueUserWorkItem(Reconnect); } } }