public void Disconnect() { // удаляем чаты foreach (var chat in _chatRooms) { chat.StateChanged -= ichat_StateChanged; chat.Dispose(); } _chatRooms.Clear(); // удаляем комнаты foreach (Room r in _rooms.Values) { r.Leave(null); } _rooms.Clear(); _connected = false; if (_disco != null) { _disco.Dispose(); } if (_conference != null) { _conference.Dispose(); } if (_roster != null) { _roster.Dispose(); } if (_jc == null) { return; } _jc.Close(); UnSubscribe(); _jc.Dispose(); _jc = null; }