Ejemplo n.º 1
0
        private void UnsubscribeFromNotifications()
        {
            Debug.Assert(_notificationToken != null);

            _notificationToken.Dispose();
            _notificationToken = null;
        }
Ejemplo n.º 2
0
        private void UnsubscribeFromNotifications()
        {
            Debug.Assert(_notificationToken != null, "_notificationToken must not be null to unsubscribe.");

            _notificationToken?.Dispose();
            _notificationToken = null;
        }
        private void SubscribeForNotifications()
        {
            Debug.Assert(_notificationToken == null, "_notificationToken must be null before subscribing.");

            Realm.ExecuteOutsideTransaction(() =>
            {
                var managedResultsHandle = GCHandle.Alloc(this);
                _notificationToken       = Handle.Value.AddNotificationCallback(GCHandle.ToIntPtr(managedResultsHandle), NotificationsHelper.NotificationCallback);
            });
        }
Ejemplo n.º 4
0
        private void SubscribeForNotifications()
        {
            Debug.Assert(_keyNotificationToken == null, "_keyNotificationToken must be null before subscribing.");

            Realm.ExecuteOutsideTransaction(() =>
            {
                var managedResultsHandle = GCHandle.Alloc(this);
                _keyNotificationToken    = _dictionaryHandle.AddKeyNotificationCallback(GCHandle.ToIntPtr(managedResultsHandle));
            });
        }
Ejemplo n.º 5
0
        private void SubscribeForNotifications()
        {
            Debug.Assert(_notificationToken == null, "_notificationToken must be null before subscribing.");

            var managedResultsHandle = GCHandle.Alloc(this);
            var token       = new NotificationTokenHandle(Handle.Value);
            var tokenHandle = Handle.Value.AddNotificationCallback(GCHandle.ToIntPtr(managedResultsHandle), RealmCollectionNativeHelper.NotificationCallback);

            token.SetHandle(tokenHandle);

            _notificationToken = token;
        }
Ejemplo n.º 6
0
        private void SubscribeForNotifications()
        {
            Debug.Assert(_notificationToken == null, "_notificationToken must be null before subscribing.");

            _realm.ExecuteOutsideTransaction(() =>
            {
                if (ObjectHandle.IsValid)
                {
                    var managedObjectHandle = GCHandle.Alloc(this, GCHandleType.Weak);
                    _notificationToken      = ObjectHandle.AddNotificationCallback(GCHandle.ToIntPtr(managedObjectHandle), NotificationsHelper.NotificationCallback);
                }
            });
        }
Ejemplo n.º 7
0
        private void SubscribeForNotifications()
        {
            Debug.Assert(_notificationToken == null, "_notificationToken must be null before subscribing.");

            if (IsFrozen)
            {
                throw new RealmFrozenException("It is not possible to add a change listener to a frozen RealmObjectBase since it never changes.");
            }

            _realm.ExecuteOutsideTransaction(() =>
            {
                if (ObjectHandle.IsValid)
                {
                    var managedObjectHandle = GCHandle.Alloc(this, GCHandleType.Weak);
                    _notificationToken      = ObjectHandle.AddNotificationCallback(GCHandle.ToIntPtr(managedObjectHandle));
                }
            });
        }
Ejemplo n.º 8
0
        private void SubscribeForNotifications()
        {
            Debug.Assert(_notificationToken == null);

            var managedResultsHandle = GCHandle.Alloc(this);
            var token       = new NotificationTokenHandle(ResultsHandle);
            var tokenHandle = NativeResults.add_notification_callback(ResultsHandle, GCHandle.ToIntPtr(managedResultsHandle), RealmResultsNativeHelper.NotificationCallback);;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            { }
            finally
            {
                token.SetHandle(tokenHandle);
            }

            _notificationToken = token;
        }
Ejemplo n.º 9
0
        private void SubscribeForNotifications()
        {
            Debug.Assert(_notificationToken == null, "_notificationToken must be null before subscribing.");

            var managedResultsHandle = GCHandle.Alloc(this);
            var token       = new NotificationTokenHandle(ResultsHandle);
            var tokenHandle = ResultsHandle.AddNotificationCallback(GCHandle.ToIntPtr(managedResultsHandle), RealmResultsNativeHelper.NotificationCallback);

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
            }
            finally
            {
                token.SetHandle(tokenHandle);
            }

            _notificationToken = token;
        }
Ejemplo n.º 10
0
 private void UnsubscribeFromNotifications()
 {
     _notificationToken?.Dispose();
     _notificationToken = null;
 }
Ejemplo n.º 11
0
 private void UnsubscribeFromNotifications()
 {
     _notificationToken?.Dispose();
     _notificationToken            = null;
     _deliveredInitialNotification = false;
 }