예제 #1
0
        public SyncingManager(ISyncConfigurationsProvider configurationsProvider)
        {
            _realm = Realm.GetInstance(configurationsProvider.ActiveConfiguration);

            var session             = _realm.GetSession();
            var downloadsObservable =
                session.GetProgressObservable(ProgressDirection.Download, ProgressMode.ReportIndefinitely);

            _token  = downloadsObservable.Subscribe(this);
            _source = new CancellationTokenSource();
        }
예제 #2
0
        public AccountsRepository(ISyncConfigurationsProvider configurationsProvider) : base(configurationsProvider)
        {
            _notificationsToken = _items.SubscribeForNotifications((sender, changes, error) => {
                if (changes != null)
                {
                    if (changes.InsertedIndices.Length != 0)
                    {
                        OnItemsInserted?.Invoke(this, changes.InsertedIndices);
                    }

                    if (changes.DeletedIndices.Length != 0)
                    {
                        OnItemsDeleted?.Invoke(this, changes.DeletedIndices);
                    }

                    if (changes.ModifiedIndices.Length != 0)
                    {
                        OnItemsModified?.Invoke(this, changes.ModifiedIndices);
                    }
                }
            });
        }
예제 #3
0
 public BaseRepository(ISyncConfigurationsProvider configurationsProvider)
 {
     _realm = Realm.GetInstance(configurationsProvider.ActiveConfiguration);
 }
예제 #4
0
 public TransactionsRepository(ISyncConfigurationsProvider configurationsProvider) : base(configurationsProvider)
 {
     _notificationsToken = SubscribeForNotifications();
 }