Пример #1
0
        private static void MenuClicked()
        {
            //全部清空,确保事例有效
            MsgDispatcher.UnRegisterAll("MSG1");

            MsgDispatcher.Register("MSG1", OnMsgReceived);
            MsgDispatcher.Register("MSG1", OnMsgReceived);

            MsgDispatcher.Send("MSG1", "hello world");

            MsgDispatcher.UnRegister("MSG1", OnMsgReceived);

            MsgDispatcher.Send("MSG1", "hello");
        }
Пример #2
0
 protected void RegisterMsg(string msgName, Action <object> onMsgReceived)
 {
     MsgDispatcher.Register(msgName, onMsgReceived);
     mMsgRecorder.Add(MsgRecord.Allocate(msgName, onMsgReceived));
 }