Ejemplo n.º 1
0
 private void parseObject(dataTypes objReceived)
 {
     if (objReceived.objectType.Equals(typeof(messageToEveryone).ToString()))
     {
         messageToEveryone msg = (messageToEveryone)objReceived.myObject;
         clientMW.appendText("[" + msg.whoAmI + "] " + msg.message);
     }
     else if (objReceived.objectType.Equals(typeof(userList).ToString()))
     {
         userList onlineClients = (userList)objReceived.myObject;
         clientMW.appendUsers(onlineClients.users);
     }
     else if (objReceived.objectType.Equals(typeof(startPrivate).ToString()))
     {
         startPrivate startPRV = (startPrivate)objReceived.myObject;
         clientMW.startPrivateConversationByServer(startPRV.whoStarts);
     }
     else if (objReceived.objectType.Equals(typeof(privateMessage).ToString()))
     {
         privateMessage prvMsg = (privateMessage)objReceived.myObject;
         clientMW.pushPrivateToWindow(prvMsg);
     }
     else if (objReceived.objectType.Equals(typeof(closePrivate).ToString()))
     {
         closePrivate closePrv = (closePrivate)objReceived.myObject;
         clientMW.closePrivate(closePrv);
     }
     else
     {
         throw new Exception("Unsupported object type");
     }
 }