/// <summary>
        /// 发送聊天消息
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="message"></param>
        public void SendMessage(string interactionID, string userID, string message)
        {
            if (!string.IsNullOrEmpty(message))
            {
                message = Microsoft.JScript.GlobalObject.decodeURIComponent(message);
            }

            if (string.IsNullOrEmpty(interactionID))
            {
                if (this.Room != null)
                {
                    interactionID = this.Room.RoomID;
                }
                else
                {
                    interactionID = this.Room.SessionID;
                }
            }
            try
            {
                ChatLog.GetInstance().FormatMessage("发送消息:SessionID:{0},Content:{1}", interactionID, message);
                MessageText    text    = MessageText.Create(message);
                RequestMessage request = RequestMessage.Create(interactionID, Visibility.All, text);
                ChatLog.GetInstance().FormatMessage("发送消息:SessionID:{0}.begin", interactionID);
                this.SendMessage(userID, request);
            }
            catch (Exception ex)
            {
                ChatLog.GetInstance().LogException(ex);
            }
            ChatLog.GetInstance().FormatMessage("发送消息:SessionID:{0}.end", interactionID);
        }
        /// <summary>
        /// 离开聊天室
        /// </summary>
        public void LeftChat(string userID, bool keepAlive)
        {
            if (this.RoomID == null && this.Room != null)
            {
                this.RoomID = this.Room.RoomID;
            }
            RequestReleaseParty leftMessage = null;

            try
            {
                leftMessage = RequestReleaseParty.Create(this.RoomID);
            }
            catch (Exception ex)
            {
                ChatLog.GetInstance().LogException(ex);
            }
            if (leftMessage == null)
            {
                return;
            }
            leftMessage.UserId = userID;
            ChatParty party = this.Room.GetUser(userID);

            if (party != null)
            {
                try
                {
                    if (keepAlive)
                    {
                        leftMessage.MessageText = MessageText.Create(string.Format("[{0}] 已经离开。", party.DisplayName));
                    }
                    else
                    {
                        leftMessage.MessageText = MessageText.Create("亲,网络不给力,您与攻城狮失联了!");
                    }
                }
                catch (Exception ex)
                {
                    ChatLog.GetInstance().LogException(ex);
                }
                if (party.UserType == UserType.Agent)
                {
                    leftMessage.AfterAction = Genesyslab.Platform.WebMedia.Protocols.BasicChat.Action.CloseIfNoAgents;
                    if (keepAlive)
                    {
                        leftMessage.AfterAction = Genesyslab.Platform.WebMedia.Protocols.BasicChat.Action.KeepAlive;
                    }
                }
            }
            this.SendMessage(userID, leftMessage);
        }
 /// <summary>
 /// 加入聊天室
 /// </summary>
 public void ChatJoin(string interactionID, string userID, string message)
 {
     try
     {
         RequestJoin joinMessage = null;
         MessageText msg         = MessageText.Create(message);
         if (!string.IsNullOrEmpty(interactionID))
         {
             joinMessage = RequestJoin.Create(interactionID, Visibility.All, msg);
         }
         else
         {
             joinMessage = RequestJoin.Create(Visibility.All, "Resources:default", "I have some question.", msg);
         }
         this.SendMessage(userID, joinMessage);
     }
     catch (Exception ex)
     {
         ChatLog.GetInstance().FormatMessage("异常:RequestJoin 失败!TicketID:{0} SessionID:{1}", this.TicketID, this.RoomID);
         ChatLog.GetInstance().LogException(ex);
     }
 }
        public void Execute(string interactionId, string messageText)
        {
            try
            {
                RequestMessage reqMessage = RequestMessage.Create(
                    interactionId,
                    Genesyslab.Platform.WebMedia.Protocols.BasicChat.Visibility.All,
                    MessageText.Create(messageText));

                BaseAction action = new ChatMessageAction(Protocol);

                action.Request = reqMessage;

                base.CloneSubscription(ref action);

                action.Execute();
            }
            catch (Exception ex)
            {
                ChatLog.GetInstance().LogException(ex);
            }
        }
        public void Execute(string interactionId, string messageText)
        {
            try
            {
                RequestJoin reqJoin = RequestJoin.Create(interactionId, Visibility.All, MessageText.Create(messageText));
                BaseAction  action  = new ChatJoinAction(Protocol);
                action.Request = reqJoin;
                base.CloneSubscription(ref action);

                action.Execute();
            }
            catch (Exception ex)
            {
                ChatLog.GetInstance().LogException(ex);
            }
        }