private void OnExplicit2(Msg _msg) { _DispatchMsg2 msg = (_DispatchMsg2)_msg; onExplicit2 = true; }
public void OnMsg(_DispatchMsg2 msg) { dispatchMsg2 = true; }
public void OnMsg(_DispatchMsg2 msg) { }
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")); }
public void OnHandler6(_DispatchMsg2 msg) { dispatchInfo.Add("OnHandler6", msg); }
public void OnMsg(_DispatchMsg2 msg) { this.Count++; }