/**
         * Constructor that initializes the web service, creates a list of highscores and fills it with the
         * highscores returned by the server. Finally shows the highscores in the data grid view.
         */
        public HighscoresForm(WelcomeForm welcomeForm)
        {
            InitializeComponent();
            this.welcomeForm = welcomeForm;
            ECCI_Hangman.ECCI_HangmanPortClient hangmanClient = new ECCI_Hangman.ECCI_HangmanPortClient();

            String[]         splitedHighscore;
            List <Highscore> highscoreStructs = new List <Highscore>();

            String[] highscores = hangmanClient.listHighscores();
            foreach (String highscore in highscores)
            {
                splitedHighscore = highscore.Split(':');
                highscoreStructs.Add(new Highscore(splitedHighscore[0], splitedHighscore[1], splitedHighscore[2], splitedHighscore[3]));
            }

            var source = new BindingSource();

            source.DataSource            = highscoreStructs;
            highscoreDataGrid.DataSource = source;

            highscoreDataGrid.Columns[0].HeaderText = "Nombre";
            highscoreDataGrid.Columns[1].HeaderText = "Palabra Resuelta";
            highscoreDataGrid.Columns[2].HeaderText = "Tiempo en segundos";
            highscoreDataGrid.Columns[3].HeaderText = "Intentos";
        }
示例#2
0
        /**
         * Constructor that creates the web service instance, initializes the labels, misses, remaining attempts
         * and sets the player's name and remaining attempts in the form.
         */
        public GameForm(WelcomeForm welcomeForm, String playerName)
        {
            InitializeComponent();
            this.welcomeForm   = welcomeForm;
            this.playerName    = playerName;
            this.hangmanClient = new ECCI_Hangman.ECCI_HangmanPortClient();;

            this.playerLbl.Text     += "  " + playerName;
            this.misses              = 0;
            this.remainingAttempts   = 7;
            this.remAttemptsLbl.Text = "Le quedan " + this.remainingAttempts + " intentos";
            this.wordTextBox.Text    = this.beautifyWord(this.hangmanClient.startGame(this.playerName));
            this.pictures            = new PictureBox[] { headPicBox, bodyPicBox, arm1PicBox, arm2PicBox, leg1PicBox, leg2PicBox };
            this.buttons             = new Button[] { ABtn, BBtn, CBtn, DBtn, EBtn, FBtn, GBtn, HBtn, IBtn, JBtn, KBtn, LBtn, MBtn, NBtn,
                                                      OBtn, PBtn, QBtn, RBtn, SBtn, TBtn, UBtn, VBtn, WBtn, XBtn, YBtn, ZBtn };
        }