Dtex
Dtex

Reputation: 2623

MessageBus and Replay

I tried to register to the MessageBus an observable that replay the last value produced when a new subscription occurs

var currentViewObs = currentViewGallery.ObservableForProperty(g => g.SelectedIndex)
                .Value().Select(CurrentViewObsSelector).Replay(1);

currentViewObs.Connect();

MessageBus.Current.RegisterMessageSource(currentViewObs, MessageBusContracts.CurrentView);

This doesn't work because the observable is wrapped in a ScheduledSubject which swallows the replay. Is there another way of doing that?

Upvotes: 0

Views: 244

Answers (1)

Ana Betts
Ana Betts

Reputation: 74654

In this case, you probably want to use your own MessageBus - implement IMessageBus (possibly by just copy-pasting code from here and editing it), then assign it to MessageBus.Current

Upvotes: 1

Related Questions