public void getMessage(int clientNumber, string tempString)
 {
     //sendAcknowledgement(clientNumber);
     currClientEvent = Newtonsoft.Json.JsonConvert.DeserializeObject<clientEvent>(tempString);
     if (currClientEvent._messageNumber > messageNum[clientNumber])
     {
         messageNum[clientNumber] = currClientEvent._messageNumber;
         updateCards = true;
         if (currClientEvent._button1Clicked == 1)
         {
             playerTurns[clientNumber].button1_Click();
         }
         if (currClientEvent._button2Clicked == 1)
         {
             playerTurns[clientNumber].button2_Click();
         }
         if (currClientEvent._button3Clicked == 1)
         {
             playerTurns[clientNumber].button3_Click();
         }
         if (currClientEvent._buttonBackClicked == 1)
         {
             playerTurns[clientNumber].buttonBack_Click();
         }
         if (currClientEvent._handDoubleClicked == 1)
         {
             handSelectedIndex = currClientEvent._handSelectedIndex;
             Hand_MouseDoubleClick();
         }
         if (currClientEvent._propertiesSelectionChanged == 1)
         {
             updateCards = false;
             tablePropertiesSelectedIndex = currClientEvent._tablePropertiesSelectedIndex;
             tablePropertiesSelectedItems = currClientEvent._tablePropertiesSelectedItems;
             tableMoneySelectedItems = currClientEvent._tableMoneySelectedItems;
             Table_Properties_SelectionChanged();
         }
         if (currClientEvent._moneySelectionChanged == 1)
         {
             updateCards = false;
             tablePropertiesSelectedItems = currClientEvent._tablePropertiesSelectedItems;
             tableMoneySelectedItems = currClientEvent._tableMoneySelectedItems;
             Table_Money_SelectionChanged();
         }
         //if (currClientEvent._propertiesDoubleClicked == 1)
         //{
         //    tablePropertiesSelectedIndex = currClientEvent._tablePropertiesSelectedIndex;
         //    Table_Properties_MouseDoubleClick();
         //}
         if (currClientEvent._otherPlayerClicked == 1)
         {
             playerClicked = currClientEvent._playerClicked;
             OtherPlayer_Click();
         }
         if (currClientEvent._otherPropertiesDoubleClicked == 1)
         {
             playerClicked = currClientEvent._playerClicked;
             otherPropertiesSelectedIndex = currClientEvent._otherPropertiesSelectedIndex;
             OtherPlayer_Properties_MouseDoubleClick();
         }
         sendGameStates();
         lastSend = DateTime.Now;
     }
 }
        public void checkForMessages(int clientNumber)
        {
            byte[] storage = null;
            storage = servers[clientNumber].pollAndReceiveData(servers[clientNumber].Client, 2);
            if (storage.Count() > 2)
            {
                sendAcknowledgement(clientNumber);
                string tempString = GetString(storage);
                currClientEvent = Newtonsoft.Json.JsonConvert.DeserializeObject<clientEvent>(tempString);
                updateCards = true;
                if (currClientEvent._button1Clicked==1)
                {
                    playerTurns[clientNumber].button1_Click();
                }
                if (currClientEvent._button2Clicked == 1)
                {
                    playerTurns[clientNumber].button2_Click();
                }
                if (currClientEvent._button3Clicked == 1)
                {
                    playerTurns[clientNumber].button3_Click();
                }
                if (currClientEvent._buttonBackClicked == 1)
                {
                    playerTurns[clientNumber].buttonBack_Click();
                }
                if (currClientEvent._handDoubleClicked == 1)
                {
                    handSelectedIndex = currClientEvent._handSelectedIndex;
                    Hand_MouseDoubleClick();
                }
                if (currClientEvent._propertiesSelectionChanged == 1)
                {
                    updateCards = false;
                    tablePropertiesSelectedIndex = currClientEvent._tablePropertiesSelectedIndex;
                    tablePropertiesSelectedItems = currClientEvent._tablePropertiesSelectedItems;
                    tableMoneySelectedItems = currClientEvent._tableMoneySelectedItems;
                    Table_Properties_SelectionChanged();
                }
                if (currClientEvent._moneySelectionChanged == 1)
                {
                    updateCards = false;
                    tablePropertiesSelectedItems = currClientEvent._tablePropertiesSelectedItems;
                    tableMoneySelectedItems = currClientEvent._tableMoneySelectedItems;
                    Table_Money_SelectionChanged();
                }
                //if (currClientEvent._propertiesDoubleClicked == 1)
                //{
                //    tablePropertiesSelectedIndex = currClientEvent._tablePropertiesSelectedIndex;
                //    Table_Properties_MouseDoubleClick();
                //}
                if (currClientEvent._otherPlayerClicked == 1)
                {
                    playerClicked = currClientEvent._playerClicked;
                    OtherPlayer_Click();
                }
                if (currClientEvent._otherPropertiesDoubleClicked == 1)
                {
                    playerClicked = currClientEvent._playerClicked;
                    otherPropertiesSelectedIndex = currClientEvent._otherPropertiesSelectedIndex;
                    OtherPlayer_Properties_MouseDoubleClick();
                }
                sendGameStates();
            }

        }