Jul 21, 2011 at 5:57 PM
Edited Jul 21, 2011 at 5:58 PM
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
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));
Now some kind of adapter receives the message, reads the Data and returns it to the ui like this.
// ... readTasks...
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 .