Ejemplo n.º 1
0
        private void JoinLobby(object parameter)
        {
            Guid            lobbyId         = (Guid)parameter;
            Lobby           lobbyToJoin     = _lobbyProxy.GetLobbyById(lobbyId);
            CustomPrincipal customPrincipal = Thread.CurrentPrincipal as CustomPrincipal;
            Guid            userId          = customPrincipal.Identity.Id;
            Account         account         = _accountProxy.FindById(userId);

            //check if its private
            //if (lobbyToJoin.pas)
            //{
            //    JoinLobbyPasswordDialog jlpd = new JoinLobbyPasswordDialog();
            //}
            if (_lobbyProxy.JoinLobby(userId, lobbyId) || ContainsAccount(userId, lobbyId))
            {
                LobbyWindow _lobbyWindow = new LobbyWindow(lobbyToJoin, _dashboardWindow);


                _lobbyWindow.Show();
                Lobbies     = _lobbyProxy.GetLobbies();
                IsJoined    = true;
                JoinedLobby = lobbyToJoin;
            }
            else
            {
                MessageBox.Show("You already joined a lobby", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 2
0
        private void OpenLobby(object parameter)
        {
            Guid            lobbyId         = (Guid)parameter;
            Lobby           lobbyToOpen     = _lobbyProxy.GetLobbyById(lobbyId);
            CustomPrincipal customPrincipal = Thread.CurrentPrincipal as CustomPrincipal;
            Guid            userId          = customPrincipal.Identity.Id;
            Account         account         = _accountProxy.FindById(userId);

            //TODO: Check if private and do whatever from there
            if (ContainsAccount(userId, lobbyId))
            {
                LobbyWindow _lobbyWindow = new LobbyWindow(lobbyToOpen, _dashboardWindow);

                _lobbyWindow.Show();
                Lobbies = _lobbyProxy.GetLobbies();
            }
            else
            {
                MessageBox.Show("You already joined a lobby", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }