Example #1
0
        protected internal void ItSelfMessage(AllData allData)//Sending message itself
        {
            //~New~
            //Clients are divided into pairs. First is major, second is subordinate.{(0,1),(2,3),...(2k,2k+1)}
            string destID    = "";//destination ID
            int    intDestID = 0;

            int.TryParse(allData.sourceID, out intDestID);

            //Sending message itself
            for (int i = 0; i < clients.Count; i++)
            {
                if (clients[i].Id == intDestID.ToString())  // if client id equals destination client id
                {
                    con.sendBoard(allData.obj, clients[i]); //send the data to the client with id==intDestID.ToString()
                }
            }
        }
Example #2
0
 private void p_click(object sender, EventArgs e)
 {
     if (isMyTurn && isFinished == false)
     {
         if ((String)((Button)sender).Content == "")
         {
             SetBoardBasedOnButtonName(((Button)sender).Name);
             ClientObject CO = new ClientObject(SocketManagement._CLIENT, SocketManagement.server, false, 0);//isMain=false,
             //and currentCLientID=0, because In this case, we do not need these parameters
             con.sendBoard(board, CO);
             isMyTurn = false;
             CheckBoard();
             CheckTurn();
         }
         else
         {
             MessageBox.Show("Please select another box");
         }
     }
 }