Esempio n. 1
0
 protected void UnRegisterMessage(UIMessageID msgId, UIEntity entity)
 {
     UIMessageDispatcher.Instance.UnRegisterMessage(msgId, entity);
     if (_dict.ContainsKey(msgId))
     {
         _dict.Remove(msgId);
     }
 }
Esempio n. 2
0
 public void UnRegisterMessage(UIMessageID msgId, UIEntity entity)
 {
     if (_dict.ContainsKey(msgId))
     {
         SortedList list = _dict[msgId];
         if (list.ContainsKey(entity))
         {
             list.Remove(entity);
         }
     }
 }
Esempio n. 3
0
    public bool HandleMessage(UITelegram msg)
    {
        bool        ret = false;
        UIMessageID id  = (UIMessageID)msg._msgId;

        if (_dict.ContainsKey(id))
        {
            ret = _dict[id](msg);
        }

        return(ret);
    }
Esempio n. 4
0
    public void SendMessage(UIMessageID msgId, UIEntity entity, object extraInfo, object extraInfo2)
    {
        if (!_dict.ContainsKey(msgId))
        {
            return;
        }

        SortedList list = _dict[msgId];
        UITelegram msg  = new UITelegram((int)msgId, null, -1, extraInfo, extraInfo2);

        if (entity != null && list.ContainsKey(entity))
        {
            entity.HandleMessage(msg);
        }
        else
        {
            for (int i = 0; i < list.Count; i++)
            {
                UIEntity en = (UIEntity)list.GetKey(i);

                if (!en.HandleMessage(msg))
                {
                    continue;
                }

                if (en.BlockType == UIEntity.UIBlockType.BlockAll)
                {
                    break;
                }
                else if (en.BlockType == UIEntity.UIBlockType.BlockLower)
                {
                    for (int j = i + 1; j < list.Count; j++)
                    {
                        UIEntity ent = (UIEntity)list.GetKey(j);

                        if (en.Priority == ent.Priority)
                        {
                            ent.HandleMessage(msg);
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
        }
    }
Esempio n. 5
0
    public void RegisterMessage(UIMessageID msgId, UIEntity entity)
    {
        SortedList list = null;

        if (_dict.ContainsKey(msgId))
        {
            list = _dict [msgId];
        }
        else
        {
            list = new SortedList();
        }

        list.Add(entity, null);
        _dict [msgId] = list;
    }
Esempio n. 6
0
 public void SendMessage(UIMessageID msgId, UIEntity entity, object extraInfo)
 {
     SendMessage(msgId, entity, extraInfo, null);
 }
Esempio n. 7
0
 protected void RegisterMessage(UIMessageID msgId, UIEntity entity, HandleMessageDelegate handler)
 {
     UIMessageDispatcher.Instance.RegisterMessage(msgId, entity);
     _dict [msgId] = handler;
 }