ReactiveMessageBase<T>

Jul 21, 2011 at 6:57 PM
Edited Jul 21, 2011 at 6:58 PM

Hi

The Reactive Framework is a great toolset to realize ansychronous datastreams.
For this I created some "Duplex Communication Messages" which have a Method like this
Reply(... Data...)

In my scenario Data Is a IObservable so its

void Reply(IObservable<T> dataStream);

the Message itself implements IObservable<T>. So the UI can subscribe to the message and update the viewcollection when data is stream.

For example like this:

ReadTasksMessage msg = new ReadTasksMessage();

msg.SubscribeOn(Scheduler.ThreadPool).ObserveOnDispatcher().Subscribe(task => this.TaskCollection.Add(task));
this.Messenger.Send(msg);

Now some kind of adapter receives the message, reads the Data and returns it to the ui like this.

Messenger.Register(msg =>
{
  // ... readTasks...
  msg.Reply(myObservableResult);
});

 

It would be really great to get some mvvm light baseclasses to this. 
If there are some people interesseted i would also contribute my source .

Jul 22, 2011 at 12:05 AM

I've heard good things about Reactive Extensions, although I understand it does require a reasonable amount of banging your head against the desk until you can understand the major paradigm shift. ReactiveUI seems to be ahead of the curve in bringing Rx to the MVVM world; as you say, it would be good to see what MvvmLight could bring to the table.

Jul 23, 2011 at 5:09 PM

hmm perhaps there isn't a big wish for that. but does somebody know if it is possible to create some kind of feature branches on codeplex?

 

I'm thinking about creating an MVVMLight.RX Extension library