예제 #1
0
        private void OnExplicit2(Msg _msg)
        {
            _DispatchMsg2 msg = (_DispatchMsg2)_msg;

            onExplicit2 = true;
        }
예제 #2
0
 public void OnMsg(_DispatchMsg2 msg)
 {
     dispatchMsg2 = true;
 }
예제 #3
0
 public void OnMsg(_DispatchMsg2 msg)
 {
 }
예제 #4
0
        public void MsgDispatcherLogical_Broadcast()
        {
            MsgDispatcher dispatcher = new MsgDispatcher();
            Msg           msg;

            dispatcher.AddTarget(this);

            Clear();
            msg         = new _DispatchMsg1("logical://Foo/Bar/1");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(1, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler1"));

            Clear();
            msg         = new _DispatchMsg1("logical://Foo/Bar/2");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(1, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler5"));

            Clear();
            msg         = new _DispatchMsg1("logical://Foo/Bar/*");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(2, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler1") && dispatchInfo.ContainsKey("OnHandler5"));

            //-------------------------

            Clear();
            msg         = new _DispatchMsg2("logical://Foo/Bar/1");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(1, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler2"));

            Clear();
            msg         = new _DispatchMsg2("logical://Foo/Bar/2");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(1, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler6"));

            Clear();
            msg         = new _DispatchMsg2("logical://Foo/Bar/*");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(2, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler2") && dispatchInfo.ContainsKey("OnHandler6"));

            //-------------------------

            Clear();
            msg         = new _DispatchMsg3("logical://Foo/Bar/1");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(1, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler3"));

            Clear();
            msg         = new _DispatchMsg3("logical://Foo/Bar/2");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(1, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler7"));

            Clear();
            msg         = new _DispatchMsg3("logical://Foo/Bar/*");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(2, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler3") && dispatchInfo.ContainsKey("OnHandler7"));

            //-------------------------

            Clear();
            msg         = new _DispatchMsg4("logical://Foo/Bar/1");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(1, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler4"));

            Clear();
            msg         = new _DispatchMsg4("logical://Foo/Bar/2");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(1, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler8"));

            Clear();
            msg         = new _DispatchMsg4("logical://Foo/Bar/*");
            msg._Flags |= MsgFlag.Broadcast;
            Assert.IsTrue(Dispatch(dispatcher, msg));
            Assert.AreEqual(2, dispatchInfo.Count);
            Assert.IsTrue(dispatchInfo.ContainsKey("OnHandler4") && dispatchInfo.ContainsKey("OnHandler8"));
        }
예제 #5
0
 public void OnHandler6(_DispatchMsg2 msg)
 {
     dispatchInfo.Add("OnHandler6", msg);
 }
예제 #6
0
 public void OnMsg(_DispatchMsg2 msg)
 {
     this.Count++;
 }