Esempio n. 1
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);
                    }
                }
            });
        }
        private IDisposable SubscribeForNotifications()
        {
            return(_transactions.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);
                    }
                }
            }));
        }