private IDisposable ShouldSendLayoutModeResponseWhenLayoutModeRequestReceived() { return(_eventBus .GetEvent <Event.LayoutModeRequest>() .SelectMany(_ => _view.Where(view => view != null).SelectMany(view => view.CurrentMode).Take(1)) .Select(mode => new Event.LayoutModeChanged(mode)) .Subscribe(_eventBus.Publish)); }
public IObservable <ITransition> Enter() { return(Observable.Create <ITransition>( observer => { _eventBus.Publish(new Event.Application.Suspended()); return _eventBus .GetEvent <Event.Application.Resuming>() .Select(_ => new Transition.ToResuming(_aggregateRoot)) .Subscribe(observer); })); }
public Provider(Platform.ISchedulers schedulers, Event.IBus eventBus) { _eventBus = eventBus; var httpClient = CreateHttpClient(); var timedSource = Observable .Interval(TimeSpan.FromMinutes(15), schedulers.Default); var requestSource = eventBus .GetEvent <Event.Data.Requested>() .Select(_ => schedulers.Default.Now.Ticks); _observable = Observable .Merge(timedSource, requestSource) .StartWith(0) .SelectMany(_ => FetchContainer(httpClient)) .Replay(1); }
public IObservable <ITransition> Enter() { return(Observable.Create <ITransition>( observer => { var navigation = Platform.Services.Service.Provider .GetService <Navigation.State.IMachine>() .Run(_aggregateRoot.GetNavigationStateData()); var transitions = _eventBus .GetEvent <Event.Application.Suspending>() .WithLatestFrom(navigation, (_, data) => data) .Scan(_aggregateRoot, (aggregateRoot, data) => aggregateRoot.SetNavigationStateData(() => data)) .Select(aggregateRoot => new Transition.ToSuspending(aggregateRoot)); return new CompositeDisposable( transitions.Subscribe(observer) ); })); ; }