开发者

I can't get ReactiveUI MessageBus to work on Windows Phone 7

I'm trying to implement messaging between my ViewModels My Proof of Concept Code is the following:

RxApp.MessageBus.Liste开发者_如何学Pythonn<int>("test")
    .Subscribe(i => MessageBox.Show(i.ToString()));    

RxApp.MessageBus.SendMessage<int>(42, "test");

My unit Tests run successfully so I thought it might be a Scheduling problem. I manually set the Scheduler: RxApp.DeferredScheduler = DispatcherScheduler.Instance;

but it was set to the right Instance anyway so as expected, no change. I can register for Messages. I just never receive any :/ Using an empty message contract does not change anything either.

I tried on both the Emulator and a Device (Mango SDK Refresh / Mango Build 7712)

I hope someone here can help me :) Any hints are very much appreciated.


I suspect this is a MessageBus bug - who writes this crap, anyways?

** I'll look into it :)


My mistake, for assuming it was something non-trivial to do with the Scheduler :)

The problem was, that the Tuple class in use as a Dictionary key on WP7/SL does not implement a useful Equals() override.

The Dictionary never returned any matches when looking up the registered Subjects.

GetHashCode() should also be replaced with a custom implementation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜