예제 #1
0
파일: ViewModel.cs 프로젝트: ibebbs/CODuo
 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));
 }
예제 #2
0
        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);
            }));
        }
예제 #3
0
파일: Provider.cs 프로젝트: ibebbs/CODuo
        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);
        }
예제 #4
0
파일: Running.cs 프로젝트: ibebbs/CODuo
        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)
                    );
            }));

            ;
        }