public Game(Server serverIn, Client clientIn)
        {
            InitializeComponent();

            this.Closing += new System.ComponentModel.CancelEventHandler(Game_Closing);

            this.server = serverIn;
            this.client = clientIn;

            if (this.server != null)
            {
                this.map = this.server.map;

                this.server.UpdateChat += this.UpdateChat;
                this.server.UpdateProgressBar += this.UpdateProgressBar;
                this.server.UpdateStatusBar += this.UpdateStatusBar;
                this.server.PlayerLost += this.PlayerLost;

                this.BuildPlayerNames(this.server.playerNames);
                this.BuildMap(this.server.playerNames.IndexOf(this.server.name));
                this.BuildStatusBar(this.server);
            }
            else
            {
                this.map = this.client.map;

                this.client.UpdateChat += this.UpdateChat;
                this.client.UpdateProgressBar += this.UpdateProgressBar;
                this.client.UpdateStatusBar += this.UpdateStatusBar;
                this.client.PlayerLost += this.PlayerLost;

                this.BuildPlayerNames(this.client.playerNames);
                this.BuildMap(this.client.playerNames.IndexOf(this.client.name));
                this.BuildStatusBar(this.client);
            }

            this.ChatInputTextBox.TextChanged      += new TextChangedEventHandler(chatText_TextChanged);
            this.ChatInputTextBox.AcceptsReturn     = true;
            this.ChatOutputTextBlock.TextWrapping   = TextWrapping.Wrap;

            this.gameOver = false;
        }
        void Button_Client_Click(object sender, RoutedEventArgs e)
        {
            if (this.avatarName != null && IPAddress.TryParse(this.IPBox.Text, out iPAdress) && Int32.TryParse(this.PortBox.Text, out port))
            {
                try
                {
                    this.client = new Client(this.avatarName, this.iPAdress, this.port);
                    this.client.CreateBattleField += this.CreateBattleGround;

                    this.backGroundTextBlock.Text = "Connecting...";
                    this.BattleGround.Children.Add(this.backGroundTextBlock);
                }
                catch
                {
                    MessageBox.Show("Al parecer hubo un error con los datos ingresados. Inténtelo nuevamente.");
                    this.ResetData();
                }
            }
            else
            {
                this.ResetData();
            }
        }