public void Init(SessionManager manager, LobbySession session)
        {
            _manager = manager;
            _session = session;

            LoadMatches();
        }
        public void Init(LobbySession lobbySession)
        {
            _lobbySession = lobbySession;
            Title = _lobbySession.GameInfo.DisplayName;

            InitGroupedMembers( _lobbySession );
            itemsControlGameRoomList.ItemsSource = _lobbySession.GameRoomManager.AllGameRooms;
            itemsControlJoinedGameRoomList.ItemsSource = _lobbySession.JoinedGameRooms;
            listBoxActiveGames.ItemsSource = _lobbySession.ActiveGames;

            PropertyChangedEventManager.AddListener(_lobbySession.GameInfo, this, "PropertyChanged");

            _userData.LookupPendingBets(OnPendingBetsComplete);

            _lobbySession.ChatMessageReceived += ChatMessages_CollectionChanged;

            //BuildContextMenu();
        }
        public void JoinChatroom(string id, string password = null)
        {
            ChatroomSessionBase chatroomSession;
            if (_chatroomUsage.TryGetValue(id, out chatroomSession))
            {
                if (chatroomSession.State == ChatroomState.New)
                    return;// we are already joining
                else if (chatroomSession.State == ChatroomState.Connected)
                {
                    chatroomSession.ShowControl(true);// show it
                    return;
                }
                // else state == invited, so join it
            }

            if (id.StartsWith(PrefixGameLobby))
            {
                var gameId = id.Substring(PrefixGameLobby.Length);
                HomeTab.LauncherInfo gameInfo;
                if (_userData.TryGetGame(gameId, out gameInfo))
                {
                    var session = new Lobby.LobbySession(this, gameInfo);
                    session.LoadGameRoomsComplete += session_LoadGameRoomsComplete;
                    session.LoadGameRooms();
                    chatroomSession = session;
                }
            }
            else if (id.StartsWith(PrefixGameRoom))
            {
                var gameRoomId = id.Substring(PrefixGameRoom.Length);
                Lobby.LobbySession lobbySession;
                Lobby.GameRoomItem gameRoomItem;
                if (!TryGetGameRoomAndSession(gameRoomId, out lobbySession, out gameRoomItem))
                {
                    Lobby.LobbySession.LookupGameRoom(_userData, gameRoomId, JoinLobbyAndGameRoom);
                    return;
                }

                var gameRoomSession = new GameRoom.GameRoomSession(this, lobbySession, gameRoomItem);
                chatroomSession = gameRoomSession;
            }
            else
                chatroomSession = new ChatroomSession(this);

            chatroomSession.ChatroomId = id;

            _chatroomUsage[id] = chatroomSession;

            var chatroom = new Chatroom { _id = id };
            var joinChatroom = (password == null)
                ? chatroom
                : new ChatroomWithPassword { _id = id, password = password, };
            ChatroomUserJoin(joinChatroom);
            ChatroomMemberGetList(chatroom);
        }