示例#1
0
        private void New_Game_Click(object sender, RoutedEventArgs e)
        {
            int  minP = (int)minPlayers.SelectedItem;
            int  maxP = (int)maxPlayers.SelectedItem;
            int  sB   = Int32.Parse(Small_Blind.Text);
            int  bB   = Int32.Parse(Big_Blind.Text);
            int  cP   = Int32.Parse(Chip_Policy.Text);
            int  bIP  = Int32.Parse(Buy_In_Policy.Text);
            int  tP   = 0;
            bool aS   = Allow_Spec.IsChecked.Value;

            Models.GamePreferences pref = new Models.GamePreferences(maxP, minP, sB, bB, tP, bIP, cP, aS);

            manager.CreateGame(pref);

/*
 *          ///FOR DEBUG
 *          Models.ClientGame game = new Models.ClientGame();
 *          List<Models.ClientUserProfile> players = new List<Models.ClientUserProfile>();
 *          Models.ClientUserProfile niv = new Models.ClientUserProfile();
 *          niv.Username = "******";
 *          Models.ClientUserProfile omer = new Models.ClientUserProfile();
 *          omer.Username = "******";
 *          Models.ClientUserProfile naor = new Models.ClientUserProfile();
 *          naor.Username = "******";
 *          Models.ClientUserProfile rick = new Models.ClientUserProfile();
 *          rick.Username = "******";
 *          Models.ClientUserProfile rick2 = new Models.ClientUserProfile();
 *          rick2.Username = "******";
 *          Models.ClientUserProfile rick3 = new Models.ClientUserProfile();
 *          rick3.Username = "******";
 *
 *
 *          players.Add(niv);
 *          players.Add(omer);
 *          players.Add(naor);
 *          players.Add(rick);
 *          players.Add(rick2);
 *          players.Add(rick3);
 *          game.Players = players;
 *          NavigationService.Navigate(new GameFrame(main,game));
 */
        }
示例#2
0
        private void showResults(List <Models.ClientGame> gameList)
        {
            List <GameDataGrid> displayList = new List <GameDataGrid>();

            foreach (Models.ClientGame game in gameList)
            {
                Models.GamePreferences prefs = game.gamePref;
                GameDataGrid           gdg   = new GameDataGrid {
                    ID                = game.id,
                    PlayersInGame     = game.players.Count,
                    MaxPlayers        = prefs.maxPlayers,
                    MinPlayers        = prefs.minPlayers,
                    BigBlind          = prefs.bigBlind,
                    SmallBlind        = prefs.smallBlind,
                    SpectatingAllowed = prefs.allowSpectators
                };
                displayList.Add(gdg);
            }
            Display_game_results.ItemsSource           = displayList;
            Display_game_results.Columns[0].Visibility = Visibility.Collapsed;
        }
示例#3
0
        private async void Find_game_Click(object sender, RoutedEventArgs e)
        {
            //send to manager to get results and then
            //show them using showResults
            string criterion = "";
            object param     = null;

            if (!player_name.Text.Equals(""))
            {
                criterion = "playerName";
                param     = player_name.Text;
            }
            else if (!pot_size.Text.Equals(""))
            {
                criterion = "potsize";
                param     = pot_size.Text;
            }
            else if (gamePrefFieldsEdited())
            {
                int sB = -1;
                int bI = -1;
                int tP = -1;
                int cP = -1;
                Int32.TryParse(small_blind.Text, out sB);
                Int32.TryParse(buy_in.Text, out bI);
                Int32.TryParse(Type_Policy.Text, out tP);
                Int32.TryParse(chip_policy.Text, out cP);
                bool aS = Allow_Spec.IsChecked.Value;
                param     = new Models.GamePreferences(-1, -1, sB, -1, tP, bI, cP, aS);
                criterion = "gamepreference";
            }

            List <Models.ClientGame> gameList = await manager.SearchGames(criterion, param);

            showResults(gameList);
        }