public MainWindowViewModel() { // Setup the event stream subscription MyPushEventProvider eventProvider = new MyPushEventProvider(); (from myEvent in eventProvider.OneSecondTimer where myEvent.MessageId % 2 == 0 select myEvent) .Take(5) .AsObservable() .ObserveOnDispatcher() .Catch<MyMessage, Exception>(e => Observable.Return(new MyMessage {Description = e.Message})) .Subscribe(message => messages.Add(message), () => Messages.Add(new MyMessage {Description = "Complete"})); }
public MainWindowViewModel() { // Setup the event stream subscription MyPushEventProvider eventProvider = new MyPushEventProvider(); (from myEvent in eventProvider.OneSecondTimer where myEvent.MessageId % 2 == 0 select myEvent) .Take(5) .AsObservable() .ObserveOnDispatcher() .Catch <MyMessage, Exception>(e => Observable.Return(new MyMessage { Description = e.Message })) .Subscribe(message => messages.Add(message), () => Messages.Add(new MyMessage { Description = "Complete" })); }