Exemple #1
0
        private void SendUpdatedUserState(FullUserInfo userInfo)
        {
            Contract.Requires(userInfo != null);
            // Creating message to send
            var    userStateCommand = new UserStateCommand(userInfo.UserInfo, userInfo.UserState);
            var    message          = new Message(1, messageId, userStateCommand);
            string xml = messageConverter.ConvertToXml(message).ToString();

            // Finding all connected users (without this particular user)
            var collectionToSend = users.Where(ui => ui.EndPoint != null && ui != userInfo);

            // And sending user information to them
            foreach (var ui in collectionToSend)
            {
                tcpServer.SendString(ui.EndPoint, xml);
            }
        }
Exemple #2
0
        private void SendMessage(Message message)
        {
            Contract.Requires(message != null);

            string xml = messageConverter.ConvertToXml(message).ToString();

            connection.SendString(xml);
        }