コード例 #1
0
        public void when_IsActive_is_set_to_true_then_ActivationStateChanged_pumps_true()
        {
            var testSchedulerProvider = new TestDispatcherSchedulerProvider();

            var activationStateViewModel = new ActivationStateViewModel(new NoOpLogger(), testSchedulerProvider);

            var result = false;

            activationStateViewModel.ActivationStateChanged
                                    .Subscribe(isActive => result = isActive);

            activationStateViewModel.Activate();

            Assert.That(result, Is.True);
        }
コード例 #2
0
        public void the_first_time_IsActive_is_set_to_true_then_OnInitialise_pumps()
        {
            var testSchedulerProvider = new TestDispatcherSchedulerProvider();

            var activationStateViewModel = new ActivationStateViewModel(new NoOpLogger(), testSchedulerProvider);

            var result = false;

            activationStateViewModel.OnInitialise
                                    .Subscribe(_ => result = true);

            activationStateViewModel.Activate();

            Assert.That(result, Is.True);
        }
コード例 #3
0
ファイル: Workspace.cs プロジェクト: ganesum/Naru
        protected Workspace(ILog log, IDispatcherSchedulerProvider scheduler, IStandardDialog standardDialog)
        {
            _log = log;
            _scheduler = scheduler;
            _standardDialog = standardDialog;

            ClosingStrategy = new ClosingStrategy(log);
            ClosingStrategy.AddDisposable(Disposables);

            ClosingStrategy.Closing
                           .TakeUntil(ClosingStrategy.Closed)
                           .Subscribe(_ =>
                                      {
                                          Closing();

                                          CleanUp();
                                      });

            this.ExecuteOnClosed(() => Disposables.Dispose());

            BusyViewModel = new BusyViewModel(scheduler);
            BusyViewModel.AddDisposable(Disposables);

            ActivationStateViewModel = new ActivationStateViewModel(log, scheduler);
            ActivationStateViewModel.AddDisposable(Disposables);

            ActivationStateViewModel.OnInitialise
                                    .SelectMany(_ => OnInitialise().ToObservable()
                                                                   .TakeUntil(BusyViewModel.BusyLatch))
                                    .TakeUntil(ClosingStrategy.Closed)
                                    .Subscribe(_ => { });

            ActivationStateViewModel.ActivationStateChanged
                                    .ObserveOn(scheduler.Dispatcher.RX)
                                    .Where(isActive => isActive)
                                    .TakeUntil(ClosingStrategy.Closed)
                                    .Subscribe(_ => OnActivate());

            ActivationStateViewModel.ActivationStateChanged
                                    .ObserveOn(scheduler.Dispatcher.RX)
                                    .Where(isActive => !isActive)
                                    .TakeUntil(ClosingStrategy.Closed)
                                    .Subscribe(_ => OnDeActivate());

            Show();
        }
コード例 #4
0
ファイル: Workspace.cs プロジェクト: ganesum/Naru
        protected Workspace(ILog log, IDispatcherSchedulerProvider scheduler, IStandardDialog standardDialog)
        {
            _log            = log;
            _scheduler      = scheduler;
            _standardDialog = standardDialog;

            ClosingStrategy = new ClosingStrategy(log);
            ClosingStrategy.AddDisposable(Disposables);

            ClosingStrategy.Closing
            .TakeUntil(ClosingStrategy.Closed)
            .Subscribe(_ =>
            {
                Closing();

                CleanUp();
            });

            this.ExecuteOnClosed(() => Disposables.Dispose());

            BusyViewModel = new BusyViewModel(scheduler);
            BusyViewModel.AddDisposable(Disposables);

            ActivationStateViewModel = new ActivationStateViewModel(log, scheduler);
            ActivationStateViewModel.AddDisposable(Disposables);

            ActivationStateViewModel.OnInitialise
            .SelectMany(_ => OnInitialise().ToObservable()
                        .TakeUntil(BusyViewModel.BusyLatch))
            .TakeUntil(ClosingStrategy.Closed)
            .Subscribe(_ => { });

            ActivationStateViewModel.ActivationStateChanged
            .ObserveOn(scheduler.Dispatcher.RX)
            .Where(isActive => isActive)
            .TakeUntil(ClosingStrategy.Closed)
            .Subscribe(_ => OnActivate());

            ActivationStateViewModel.ActivationStateChanged
            .ObserveOn(scheduler.Dispatcher.RX)
            .Where(isActive => !isActive)
            .TakeUntil(ClosingStrategy.Closed)
            .Subscribe(_ => OnDeActivate());

            Show();
        }
コード例 #5
0
ファイル: ViewModelHelpersTests.cs プロジェクト: ganesum/Naru
 public SupportActivationState(IDispatcherSchedulerProvider scheduler)
 {
     ActivationStateViewModel = new ActivationStateViewModel(new NoOpLogger(), scheduler);
 }