Exemplo n.º 1
0
        private async void Connect()
        {
            IsPageEnabled = false;
            Lobby lobby;

            try
            {
                lobby = await lobbyServer.ConnectToLobby(selectedLobby.Name);
            }
            catch (Exception)
            {
                MessageBox.Show("Connection lost.", "Hanksite", MessageBoxButton.OK);
                Application.Current.Shutdown();
                return;
            }

            if (lobby == null)
            {
                MessageBox.Show("The selected lobby is full or cancelled!", "Hanksite", MessageBoxButton.OK);
                IsPageEnabled = true;
                return;
            }

            NavigationService.GetNavigationService(View).Navigate(new CreateLobby(lobby));
            IsPageEnabled = true;
        }