예제 #1
0
        private void ObserveSourceChanges()
        {
            if (!IsLoaded)
            {
                return;
            }

            StopListeningForChanges();

            var databaseModel = ApplicationModel.Database.Value;

            if (databaseModel != null)
            {
                changesSubscription =
                    databaseModel.IndexChanges.Where(i => i.Name.Equals(ConflictsIndexName, StringComparison.Ordinal))
                    .SampleResponsive(TimeSpan.FromSeconds(1))
                    .ObserveOnDispatcher()
                    .Subscribe(_ => ConflictDocuments.Refresh(RefreshMode.PermitStaleDataWhilstRefreshing));

                replicationSourcesChanges =
                    databaseModel.DocumentChanges.Where(
                        d => d.Id.StartsWith("Raven/Replication/Sources/", StringComparison.OrdinalIgnoreCase))
                    .SampleResponsive(TimeSpan.FromSeconds(1))
                    .ObserveOnDispatcher()
                    .Subscribe(_ => LoadReplicationSources());
            }
        }
예제 #2
0
        protected override void OnViewLoaded()
        {
            ApplicationModel.Database
            .ObservePropertyChanged()
            .TakeUntil(Unloaded)
            .Subscribe(_ =>
            {
                EnsureIndexExists();
                ObserveSourceChanges();
                ConflictDocuments.Refresh(RefreshMode.ClearStaleData);
            });

            ObserveSourceChanges();
            ConflictDocuments.Refresh(RefreshMode.ClearStaleData);
            LoadReplicationSources();
            EnsureIndexExists();
        }