Example #1
0
        /// <summary>
        /// 添加显示用的信息
        /// </summary>
        /// <param name="infoBase">信息</param>
        public void AddMessage(IInfoBase infoBase)
        {
            switch (infoBase.MessageType)
            {
            case InterfaceLib.MsgInterface.MsgInfo.Enums.MessageType.Text:
                AddTextMsg((infoBase as ITextInfo).Text);
                break;

            case InterfaceLib.MsgInterface.MsgInfo.Enums.MessageType.File:
                IFileInfo fileInfo = infoBase as IFileInfo;
                if (IsImg(fileInfo))
                {
                    if (fileInfo.Stream == null)
                    {
                        AddImageMsg(fileInfo.Path);
                    }
                    else
                    {
                        AddImageMsg(fileInfo.Stream);
                    }
                }
                break;

            case InterfaceLib.MsgInterface.MsgInfo.Enums.MessageType.Command:
                break;

            default:
                break;
            }
        }
Example #2
0
 /// <summary>
 /// 打开消息路由循环
 /// </summary>
 private void MessageRouteLoop()
 {
     while (true)
     {
         if (infoBases.Count == 0)
         {
             pause_task();
         }
         else if (Manager.RunningFaceInterface != null)
         {
             //IInfoBase infoBase = infoBases.Dequeue();
             IInfoBase        infoBase         = null;
             MessageInterface messageInterface = new MessageInterface();
             while (infoBases.Count > 0 && (infoBase = infoBases.Dequeue()) != null)
             {
                 messageInterface.AddMessage(infoBase);
             }
             ///发送给界面插件
             if (infoBase.ReciverId.Equals(Plugs.PluginsURL.FaceInterfaceId))
             {
                 Manager.RunningFaceInterface.ReciverFromServerMsg(messageInterface);
             }
             infoBase = null;
         }
     }
 }
Example #3
0
 /// <summary>
 /// 添加一条待处理的消息
 /// </summary>
 /// <param name="infoBase">消息</param>
 public void AddMessage(IInfoBase infoBase)
 {
     infoBases.Enqueue(infoBase);
     if (isActive == false)
     {
         continue_task();
     }
 }
Example #4
0
 /// <summary>
 /// 添加一条消息
 /// </summary>
 /// <param name="infoBase"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 public bool AddMessage(IInfoBase infoBase, string key = null)
 {
     if (key == null)
     {
         key = Guid.NewGuid().ToString();;
     }
     if (MsgInfos.ContainsKey(key) == false)
     {
         MsgInfos.Add(key, infoBase);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #5
0
 //-------------------------------------------------------------------------------
 //-------------------------------------------------------------------------------
 public void DeregisterSprite(IInfoBase <TInfoType> item)
 {
     RequestInfo   -= item.InfoRequested;
     item.SendInfo -= AddInfo;
 }