protected override void OnCreate(Bundle savedInstanceState)
        {
            chat = new ChatActions();

            // if you are creating the game, you are white player
            ChessActions.isWhite = newGame;

            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Chess);

            // Make a chess board
            chessBoard = actions.generateDefaultBoard();

            printToTable(chessBoard);
            //board.Text = actions.printBoard (chessBoard);

            actions.printOnServer();

            /**
             *
             * Test of updating Move from on touch. Right now only the left most
             * white pawn will update the move from EditText.
             *
             * Will have to looop through all elements of table and and MyOnTouch
             *
             * Might have to  change IDs to something like A0 through H7 to simplify
             * filling in the MoveTo and From boxes
             */


            int i, j;

            for (i = 0; i < 8; i++)
            {
                for (j = 0; j < 8; j++)
                {
                    table [i, j].LongClick += PieceLongClick;
                    table [i, j].Drag      += DropZone_Drag;
                }
            }
            txt = FindViewById <TextView> (Resource.Id.ChatDisplay);



            TextView headText = FindViewById <TextView> (Resource.Id.HeadText);

            if (!newGame)
            {
                headText.Text = "Playing " + opponent + ". You're Black.";
            }
            else
            {
                headText.Text = "Playing " + opponent + ". You're White.";
            }
            whoTurn = FindViewById <TextView> (Resource.Id.whoTurn);

            EditText msgText    = FindViewById <EditText> (Resource.Id.MsgText);
            Button   sendButton = FindViewById <Button> (Resource.Id.SendButton);

            sendButton.Click += (object sender, EventArgs e) => {
                chat.SendMsg(msgText.Text);
                //Send string to chat

                msgText.Text = "";
            };

            if (newGame == true)
            {
                whoTurn.Text = username + "'s Turn";
            }
            else
            {
                whoTurn.Text = opponent + "'s Turn";
            }

            // Create your application here
            Button exitButton = FindViewById <Button>(Resource.Id.ExitButton);

            //Wire up the connnect button
            exitButton.Click += (object sender, EventArgs e) =>
            {
                actions.logout();
                Intent intent = new Intent(Intent.ActionMain);
                intent.AddCategory(Intent.CategoryHome);
                intent.SetFlags(ActivityFlags.NewTask);
                StartActivity(intent);
                Finish();
                System.Environment.Exit(0);
            };

            System.Threading.ThreadPool.QueueUserWorkItem(delegate {
                while (true)
                {
                    RunOnUiThread(() => getUpdates(actions, chessBoard, whoTurn));
                    RunOnUiThread(() => getMsg(chat, txt));
                    System.Threading.Thread.Sleep(1000);
                }
            }, null);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            chat = new ChatActions ();

            // if you are creating the game, you are white player
            ChessActions.isWhite = newGame;

            base.OnCreate (savedInstanceState);
            SetContentView (Resource.Layout.Chess);

            // Make a chess board
            chessBoard = actions.generateDefaultBoard ();

            printToTable (chessBoard);
            //board.Text = actions.printBoard (chessBoard);

            actions.printOnServer ();

            /**
             *
             * Test of updating Move from on touch. Right now only the left most
             * white pawn will update the move from EditText.
             *
             * Will have to looop through all elements of table and and MyOnTouch
             *
             * Might have to  change IDs to something like A0 through H7 to simplify
             * filling in the MoveTo and From boxes
             */

            int i, j;
            for (i = 0; i < 8; i++) {
                for (j = 0; j < 8; j++) {
                    table [i, j].LongClick += PieceLongClick;
                    table [i, j].Drag += DropZone_Drag;
                }
            }
            txt = FindViewById<TextView> (Resource.Id.ChatDisplay);

            TextView headText = FindViewById<TextView> (Resource.Id.HeadText);
            if (!newGame) {
                headText.Text = "Playing " + opponent + ". You're Black.";
            } else {
                headText.Text = "Playing " + opponent + ". You're White.";

            }
            whoTurn = FindViewById<TextView> (Resource.Id.whoTurn);

            EditText msgText = FindViewById<EditText> (Resource.Id.MsgText);
            Button sendButton = FindViewById<Button> (Resource.Id.SendButton);
            sendButton.Click += (object sender, EventArgs e) => {
                chat.SendMsg (msgText.Text);
                //Send string to chat

                msgText.Text = "";
            };

            if (newGame == true) {
                whoTurn.Text = username + "'s Turn";
            } else {
                whoTurn.Text = opponent + "'s Turn";
            }

            // Create your application here
            Button exitButton = FindViewById<Button>(Resource.Id.ExitButton);

            //Wire up the connnect button
            exitButton.Click += (object sender, EventArgs e) =>
            {
                actions.logout();
                Intent intent = new Intent(Intent.ActionMain);
                intent.AddCategory(Intent.CategoryHome);
                intent.SetFlags(ActivityFlags.NewTask);
                StartActivity(intent);
                Finish();
                System.Environment.Exit(0);
            };

                System.Threading.ThreadPool.QueueUserWorkItem(delegate {
                while(true){
                    RunOnUiThread(()=>getUpdates(actions, chessBoard, whoTurn));
                    RunOnUiThread(()=>getMsg(chat, txt));
                    System.Threading.Thread.Sleep (1000);
                }
                }, null);
        }
 /// <summary>Updates the chat area.</summary>
 public void getMsg(ChatActions chat, TextView txt)
 {
     txt.Text = chat.GetMsg() + txt.Text;
 }
 /// <summary>Updates the chat area.</summary>
 public void getMsg(ChatActions chat, TextView txt)
 {
     txt.Text = chat.GetMsg() + txt.Text;
 }